Hi All,

Here i am running a on line example Drawtext programme with little modification 
but it is not displaying the text.
Below is the code.Please let me know why it is not displaying the code,i think 
i am doing right in the code.

Thanks In Advance...................


#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;
      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));
    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));
    DFBCHECK (primary->FillRectangle (primary, 0, 0, 
screen_width, screen_height));

    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;
}

  
_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to