/* dfb includes */
#include <directfb.h>
-#define MY_FONT_HEIGHT 48
+#define MY_FONT_HEIGHT 18
/* global stuff */
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);
/* 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);