/* dfb includes */
#include <directfb.h>
+#define MY_FONT_HEIGHT 18
+
/* global stuff */
/* well ... */
static IDirectFB *dfb = NULL;
-/* surface */
static IDirectFBSurface *primary = NULL;
static int screen_width = 0;
static int screen_height = 0;
+
static IDirectFBSurface *logo = NULL;
+
+static IDirectFBFont *font = NULL;
+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;
+ 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);
dfb->CreateSurface(dfb,&dsc,&logo);
/* render image */
provider->RenderTo(provider,logo,NULL);
-
provider->Release(provider);
- /* slide logo */
+ /* 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 + 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);