Hi,
I try to modify 'Drawing text' which is in DirectFB Tutorials.
'Drawing text' runs without problem!
Instead of allowing the text to move, I would block it.
When I compile and run it, I have no error, but my window is black and the
message is not printed.
This is the 'program'
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <directfb.h>
//(Globals)
static IDirectFB *dfb = NULL;
static IDirectFBSurface *primary = NULL;
static int screen_width = 0;
static int screen_height = 0;
//The font we will use to draw the text.
static IDirectFBFont *font = NULL;
static char *text = "hello!";
int main (int argc, char **argv)
{
int i, width;
//A structure describing font properties.
DFBFontDescription font_dsc;
//(Locals)
DFBSurfaceDescription dsc;
//(Initialize)
DFBCHECK (DirectFBInit (&argc, &argv));
DFBCHECK (DirectFBCreate (&dfb));
DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
dsc.flags = DSDESC_CAPS;
dsc.caps = DSCAPS_PRIMARY | DSCAPS_FLIPPING;
DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
//First we need to create a font interface by passing a filename
//and a font description to specify the desired font size. DirectFB will
//find (or not) a suitable font loader.
font_dsc.flags = DFDESC_HEIGHT;
font_dsc.height = 48;
DFBCHECK (dfb->CreateFont (dfb, "/root/decker.ttf", &font_dsc, &font));
//Set the font to the surface we want to draw to.
DFBCHECK (primary->SetFont (primary, font));
//Determine the size of our string when drawn using the loaded font.
//Since we are interested in the full string, we pass -1 as string length.
DFBCHECK (font->GetStringWidth (font, text, -1, &width));
//Clear the screen
DFBCHECK (primary->SetColor (primary, 0x0, 0x0, 0x0, 0xFF));
DFBCHECK (primary->FillRectangle (primary, 0, 0, screen_width,
screen_height));
//Set the color that will be used to draw the text
DFBCHECK (primary->SetColor (primary, 0x80, 0x0, 0x20, 0xFF));
DFBCHECK (primary->DrawString (primary, text, -1, screen_width / 2,
screen_height / 2, DSTF_CENTER));
sleep(10);
//Release the font
font->Release (font);
//(Release)
primary->Release (primary);
dfb->Release (dfb);
return 23;
}
The function 'DrawString' seems to be correct!
It's strange!
Thank you for your help
BR
_________________________________________________________________
Consultez vos emails Orange, Gmail, Yahoo!, Free ... directement depuis HOTMAIL
!
http://www.windowslive.fr/hotmail/agregation/
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev