Hi Friends,
I am using on line example programme with a little modification but
failing.Please let me know to draw text with the following code.
Thanks in Advance.
Here i taken DrawText example programme with a little modification but it
failing to display the text.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <directfb.h>
static IDirectFB *dfb = NULL;
static IDirectFBSurface *primary = NULL;
static int screen_width = 0;
static int screen_height = 0;
#define DFBCHECK(x...)
{
DFBResult err = x;
if (err != DFB_OK)
{
fprintf( stderr, "%s <%d>:nt", __FILE__, __LINE__ );
DirectFBErrorFatal( #x, err );
}
}
static IDirectFBFont *font = NULL;
static char *text = "DirectFB rulez!";
int main (int argc, char **argv)
{
int i, width;
DFBFontDescription font_dsc;
DFBFontDescription font_dsc;
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 (pr font_dsc.flags = DFDESC_HEIGHT;
font_dsc.height = 48;
DFBCHECK (dfb->CreateFont (dfb, DATADIR"/decker.ttf", &font_dsc,
&font));
DFBCHECK (primary->SetFont (primary, font));
DFBCHECK (font->GetStringWidth (font, text, -1, &width));
DFBCHECK (primary->SetColor (primary, 0x0, 0x0, 0x0, 0xFF));
for (i = screen_width; i > -width; i--)
{
DFBCHECK (primary->SetColor (primary, 0x80, 0x0, 0x20,
0xFF));
DFBCHECK (primary->DrawString (primary, text, -1, i,
screen_height / 2, DSTF_LEFT))
DFBCHECK (primary->Flip (primary, NULL,
DSFLIP_WAITFORSYNC));
}
font->Release (font);
primary->Release (primary);
dfb->Release (dfb);
return 23;
}
imary->GetSize (primary, &screen_width, &screen_height));
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users