Sven Neumann wrote:

When I used SetCooperativeMode(FULLSCREEN) or (EXCLUSIVE), everything
drew fine but I had no cursor. When I took that line out, I got a
cursor, but the drawing was confined to a 640x480 surface in the
middle of the screen regardless of what I size I asked for. I believe
this is related to creating the main surface with DSCAPS_PRIMARY. If
I remove the DSCAPS_PRIMARY flag from the surface description, then
the surface is created at the right size but nothing draws at all to
the screen. Aaaargh

if you just create a surface which is not the primary and not a window
surface, you get an offscreen surface. I have no idea why your surface
is not created the size of the primary layer. Actually it should be
sufficient to set the capabilities to DSCAPS_PRIMARY and not specify
the size. You are not creating a new surface here, you only retrieve
an interface to the primary surface. It's size is already determined
by the size of the display layer.

I wish that were true, but that just doesn't seem to be the case. Here's my code's debug output, with the code following. If you can shed any light on this, I would be incredibly thankful. As I said previously, even explicitly setting the width and height for the CreateSurface call is ignored -- I always get 640x480.

Thanks,
Bill

Program output:
DFBDriver: Layer is 800x600
DFBDriver: About to create a 800x600 surface
DFBDriver: surface is 640x480

Program code:

DFBResult err;
DFBDisplayLayerConfig config;
DFBSurfaceDescription dsc;

if (DirectFBInit(NULL, NULL) != DFB_OK)
return false;

if (DirectFBCreate( &DFBObject ) != DFB_OK)
return false;

DFBObject->GetDisplayLayer( DFBObject, DLID_PRIMARY, &mLayer );
err = mLayer->GetConfiguration( mLayer, &config );
if (err != DFB_OK)
{
dbprintf( "DFBDriver: Could not get layer config\n");
}
dbprintf( "DFBDriver: Layer is %dx%d\n", config.width, config.height);

// Create our surface

dsc.flags = (DFBSurfaceDescriptionFlags)(DSDESC_CAPS);
dsc.caps = (DFBSurfaceCapabilities)(DSCAPS_PRIMARY | DSCAPS_FLIPPING);

dbprintf( "DFBDriver: About to create a %dx%d surface\n", config.width, config.height);

err = DFBObject->CreateSurface( DFBObject, &dsc, &mPrimarySurface );
if (err != DFB_OK)
{
dbprintf( "DFBDriver: Failed creating primary surface\n");
mLayer->Release( mLayer );
DFBObject->Release( DFBObject );
return false;
}

unsigned int width, height;
mPrimarySurface->GetSize( mPrimarySurface, &width, &height );

dbprintf( "DFBDriver: surface is %dx%d\n", width, height);




--
Info: To unsubscribe send a mail to [EMAIL PROTECTED] with "unsubscribe directfb-users" as subject.

Reply via email to