I write some code to display text in a window's surface, compiled ok
the window is created, but no words appeared!
Is there somthing wrong with it??
Any help will be appreciated.

DirectFBCreate( &dfb );
dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );//a primary layer

font_dsc.flags=DFDESC_HEIGHT;
font_dsc.height=32;

dfb->CreateFont(dfb,"/zysong.ttf",&font_dsc,&font);//create font
font->GetStringWidth(font,text,-1,&font_len);//e.x:text="hello,world"

desc.flags=DWDESC_POSX|DWDESC_POSY|DWDESC_WIDTH|DWDESC_HEIGHT|DWDESC_CAPS;
desc.posx=400;
desc.posy=145;
desc.width=512;
desc.height=145;
     
layer->CreateWindow(layer,&desc,&font_window);//create window
font_window->GetSurface(font_window,&font_surface);
font_surface->SetFont(font_surface,font);//set font
font_window->SetOpacity(font_window,0xFF);

for(i=800,i>-font_len;i--)//draw from left to right
{
       font_surface->DrawString(font_surface,text,-1,i,200,DSTF_LEFT);
       font_surface->Flip(font_surface,NULL,DSFLIP_WAITFORSYNC);
}


_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to