From: hackbard Date: Sun, 9 Feb 2003 22:37:16 +0000 (+0000) Subject: - X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Fivac.git;a=commitdiff_plain;h=85121cf5ceb381e5502a8f6cb6423d54c152cdfe - --- diff --git a/dfb_api.c b/dfb_api.c index 7435ad4..56534e3 100644 --- a/dfb_api.c +++ b/dfb_api.c @@ -9,7 +9,7 @@ /* dfb includes */ #include -#define MY_FONT_HEIGHT 48 +#define MY_FONT_HEIGHT 18 /* global stuff */ @@ -22,24 +22,27 @@ static int screen_height = 0; static IDirectFBSurface *logo = NULL; static IDirectFBFont *font = NULL; -static char *text_top="Internet Video / Audio Conferencing" +static char *text_top="Internet Video / Audio Conferencing"; /* image to load */ char dfb_image[]="./images/ivac_logo.png"; +/* font to use */ +char dfb_font[]="./fonts/decker.ttf"; int main (int argc, char **argv) { - int i; - DFBFontDescription font_desc; + int i,font_width; + DFBFontDescription font_dsc; DFBSurfaceDescription dsc; /* image provider */ IDirectFBImageProvider *provider; /* init */ - DirectFBInit (&argc, &argv); - DirectFBCreate (&dfb); - dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN); + DirectFBInit(&argc,&argv); + DirectFBCreate(&dfb); + dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN); dsc.flags=DSDESC_CAPS; - dsc.caps=DSCAPS_PRIMARY | DSCAPS_FLIPPING; + // dsc.caps=DSCAPS_PRIMARY | DSCAPS_FLIPPING; + dsc.caps=DSCAPS_PRIMARY; dfb->CreateSurface(dfb,&dsc,&primary); primary->GetSize(primary,&screen_width,&screen_height); printf("debug: w/h = %d / %d\n",screen_width,screen_height); @@ -58,20 +61,32 @@ int main (int argc, char **argv) { /* create font */ font_dsc.flags=DFDESC_HEIGHT; font_dsc.height=MY_FONT_HEIGHT; - + dfb->CreateFont(dfb,dfb_font,&font_dsc,&font); + + /* set font */ + primary->SetFont(primary,font); + font->GetStringWidth(font,text_top,-1,&font_width); - /* slide logo */ + /* slide logo + write text_top */ for(i = -dsc.width; i < screen_width; i++) { /* clear screen */ primary->FillRectangle(primary,0,0,screen_width,screen_height); + /* write text */ + primary->SetColor(primary,0x0,0x0,0x0,0xff); + primary->DrawString(primary,text_top,-1,(screen_width/2)-(font_width/2), + screen_height/4,DSTF_LEFT); + /* blit image */ primary->Blit(primary,logo,NULL,i,(screen_height-dsc.height)/2); /* flip */ primary->Flip(primary,NULL,DSFLIP_WAITFORSYNC); - } + } + + /* release font */ + font->Release(font); /* release image */ logo->Release(logo);