Doc
Download
Forum

 

Font Objet

 

gdl support font of any size, with 256 char max by font


8*8 font : FONT8.png

16*16 font : FONT16.png

32*32 font : FONT32.png

(font bitmaps make by fagemul :)

create a font object

struct font my_font ;

load a font in a font object

simply use load_font function :

void load_font(struct font * font, unsigned char * img_font, unsigned char sx, unsigned char sy, unsigned short tr_color, unsigned char nb_char)

    
struct font * font                    pointer to the font object
    
unsigned char * img_font       pointer to the image who contain the font
    unsigned char sx                    x size in pixel of a letter
    unsigned char sy                    y size in pixel of a letter
    unsigned short tr_color          transparencie color
    unsigned char nb_char           number of letter to load


exemple :

        load_font(&font,(unsigned char *)FONT16,16,16,0xBF,64) ;
        load_font(&small_font,(unsigned char *)FONT8,8,8,0xB3,95) ;

draw a text

* draw_text

    this function draw specified txt at the specified pos

void draw_text(struct font * font,char * text, unsigned short x, unsigned short y)

    stuct font * font        pointer to the font object
    char * txt                 pointer to the text to draw
    unsigned short x,y    coordonate where draw the txt


* draw_text_rl

    this function draw specified txt, end of txt draw will be at the specified pos (right alignment)

void draw_text_rl(struct font * font,char * text, unsigned short x, unsigned short y)

    stuct font * font        pointer to the font object
    char * txt                 pointer to the text to draw
    unsigned short x,y    coordonate where draw the txt

exemple :
                draw_text(&font,"PAUSE",120,112) ;

                GPSPRINTF(buffer,"%i - %i", points, lives) ;
                draw_text_rl(&small_font,buffer,318,4) ;

 

 

 

Gfx
Key
Map
Other
Palette