Hi! I want to draw a pair of surface but can not get me the paint well. First I create 2 surface. Surface 1: Draw a Rectangle color red. Surface 2: Draw a Rectangle color blue. Now i draw the surface 1 wait 5 second draw surface 2 and wait 5 second and draw surface 1 again. the first time paint the red rectangle but de second time paint both rectangle and the last time don't draw nothing.
Am I doing it correctly? I add the code and the makefile. PS: I was wrong and I sent the same email to Directb-users list. Thanks! Regards.
#include <stdio.h>
#include <unistd.h>
#include <directfb.h>
static IDirectFB *dfb = NULL;
static IDirectFB *dfb2 = NULL;
static IDirectFBSurface *primary = NULL;
static IDirectFBSurface *primary2 = 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>:\n\t", __FILE__, __LINE__ ); \
DirectFBErrorFatal( #x, err ); \
} \
}
int main (int argc, char **argv)
{
DFBSurfaceDescription dsc;
DFBCHECK (DirectFBInit (&argc, &argv));
DFBCHECK (DirectFBCreate (&dfb));
DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
dsc.flags = DSDESC_CAPS;
dsc.caps = DWCAPS_ALPHACHANNEL;
DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary2 ));
DFBCHECK (primary->SetColor (primary, 0xff, 0x00, 0x00, 0xff));
DFBCHECK (primary->FillRectangle (primary, 10, 10, 50, 30));
DFBCHECK (primary->Flip (primary, NULL, 0));
sleep (5);
DFBCHECK (primary2->SetColor (primary2, 0x00, 0x00, 0xff, 0xff));
DFBCHECK (primary2->FillRectangle (primary2, 230, 170, 310, 220));
DFBCHECK (primary2->Flip (primary2, NULL, 0));
sleep (5);
DFBCHECK (primary->Flip (primary, NULL, 0));
sleep (5);
primary->Release( primary );
dfb->Release( dfb );
return 23;
}
Makefile
Description: Binary data
_______________________________________________ directfb-dev mailing list [email protected] http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev
