From: hackbard Date: Tue, 25 Feb 2003 15:56:14 +0000 (+0000) Subject: title bild X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Fdfb-photoshow.git;a=commitdiff_plain;h=ed1c6fe15bbe02311f626ce27085c574aa2e1f7d;ds=sidebyside title bild --- diff --git a/Makefile b/Makefile index ee8479e..eb51441 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ # Makefile of dfb-photoshow INCLUDEDIR = /usr/include +DATADIR = /usr/share/DFBSee -CFLAGS = -DDEBUG -O3 -Wall -I/usr/X11/include -I/usr/include/directfb +CFLAGS = -DDEBUG -O3 -Wall -I/usr/X11/include -I/usr/include/directfb -DDATADIR=$(DATADIR) LIBS = -L/usr/X11/lib -L/usr/lib/directfb-0.9.15 -lX11 -lXext -ldirectfb OBJS = dfb-photoshow.o diff --git a/dfb-photoshow.c b/dfb-photoshow.c index 68af401..ac06c8b 100644 --- a/dfb-photoshow.c +++ b/dfb-photoshow.c @@ -7,6 +7,7 @@ #include #include +#include #include IDirectFB *dfb = NULL; @@ -25,10 +26,18 @@ int screen_height = 0; IDirectFBSurface *logo = NULL; IDirectFBFont *font = NULL; -char *text = "directfb photoshow (written by hackbard 2003)"; +char *title_txt = "directfb photoshow"; +char *author_txt="hackbard@hackdaworld.dyndns.org"; +char *hp_txt="http://hackdaworld.dyndns.org"; +char *msg1_txt="(press return to continue ...)"; + +void clear_primary(void) { + DFBCHECK(primary->SetColor(primary,0x00,0x00,0x00,0x00)); + DFBCHECK(primary->FillRectangle(primary,0,0,screen_width,screen_height)); +} int main(int argc,char **argv) { - int i; + int i,str_width; DFBSurfaceDescription dsc; DFBFontDescription font_dsc; IDirectFBImageProvider *img_prov; @@ -42,23 +51,33 @@ int main(int argc,char **argv) { dsc.caps=DSCAPS_PRIMARY|DSCAPS_FLIPPING; DFBCHECK(dfb->CreateSurface(dfb,&dsc,&primary)); - font_dsc.flags = DFDESC_HEIGHT; - font_dsc.height = 20; - DFBCHECK(dfb->CreateFont(dfb,"./decker.ttf",&font_dsc,&font)); - DFBCHECK(primary->SetFont(primary,font)); - DFBCHECK(primary->GetSize(primary,&screen_width,&screen_height)); fprintf(stdout,"dimensions: %dx%d\n",screen_width,screen_height); - /* welcome */ - DFBCHECK(primary->SetColor(primary,0x00,0x00,0x00,0x00)); - DFBCHECK(primary->FillRectangle(primary,0,0,screen_width,screen_height)); + /* title */ + font_dsc.flags=DFDESC_HEIGHT; + font_dsc.height=screen_height/20; + DFBCHECK(dfb->CreateFont(dfb,"/usr/share/DFBSee/decker.ttf",&font_dsc,&font)); + DFBCHECK(primary->SetFont(primary,font)); + DFBCHECK(font->GetStringWidth(font,title_txt,-1,&str_width)); + clear_primary(); DFBCHECK(primary->SetColor(primary,0x80,0x80,0xff,0xff)); - DFBCHECK(primary->DrawString(primary,text,-1,5,screen_height/2,DSTF_LEFT)); + DFBCHECK(primary->DrawString(primary,title_txt,-1,(screen_width-str_width)/2,screen_height/4,DSTF_LEFT)); + /* author,homepage,msg */ + font_dsc.height=screen_height/40; + DFBCHECK(dfb->CreateFont(dfb,"/usr/share/DFBSee/decker.ttf",&font_dsc,&font)); + DFBCHECK(primary->SetFont(primary,font)); + DFBCHECK(font->GetStringWidth(font,author_txt,-1,&str_width)); + DFBCHECK(primary->DrawString(primary,author_txt,-1,(screen_width-str_width)/2,screen_height/2,DSTF_LEFT)); + DFBCHECK(font->GetStringWidth(font,hp_txt,-1,&str_width)); + DFBCHECK(primary->DrawString(primary,hp_txt,-1,(screen_width-str_width)/2,(screen_height/2)+font_dsc.height,DSTF_LEFT)); + DFBCHECK(font->GetStringWidth(font,msg1_txt,-1,&str_width)); + DFBCHECK(primary->DrawString(primary,msg1_txt,-1,(screen_width-str_width)/2,(screen_height/2)+3*font_dsc.height,DSTF_LEFT)); DFBCHECK(primary->Flip(primary,NULL,DSFLIP_WAITFORSYNC)); - sleep(10); + getc(stdin); font->Release(font); - + + /* display pictures */ for(i=2;iCreateImageProvider(dfb,argv[i],&img_prov)); DFBCHECK(img_prov->GetSurfaceDescription(img_prov,&dsc));