PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

GledPlay with MFC

clintsinger · 06 Dec 2006, 00:03 UTC
Hi,

I would like to try the GledPlay library in an MFC application on Windows CE. What does one need to do in order to get a Surface drawn on the screen. Obviously I won't be using the StateMachine or Application as base classes.

Cheers,
Clint
Hi,
This is a really interesting question.

You have to option: getting a GDI handler and use GDI routines (like BltFst) or using the Surface internal buffer.

Getting the GDI handler:

You can get a GDI handler from a GledPlay Surface, so you can use GledPlay surfaces with any GDI routine.
Here you have a link to the doc about this

Using internal Buffer.

3- You can have access to the internal Surface Buffer.
Here you'll find more info about this:
http://www.gledplay.com/doc/GledDraw/Surface.html#getBuffer
Basically, you'll have access to a pixel matrix, and you can create you own blitting routines.
Pixels are natively stored as RGB565, but you can use the nativeToColorref method to convert them to standard COLORREF values.

Now, there is a little problem with screen initialization.
If you don't use StateMachine or Application as base classes, currently, there is no way to tell GledPlay to automatically initialize the backbuffer display or the sound system. That's something we are working right now, and next week you'll have 2 new classes: Device and Display. With them (and a little help of other classes like Fps) you'll be able to create you own custom "Application base classes".

I hope this is usefull for you, otherwise, please let us know, and we'll see what we can do about it.

Best Regards,
Sergio.
Is this possible yet? Really want I'm looking to do is use something faster than GDI to render things for my application and then do a final blt to the DC when I'm done drawing. In GapiDraw, this is accomplished by using their offscreen buffer and it's quite simple. Is this something that's possible with GledPlay?
Yes, it is possible. You have in GledPlay the same options you have in GapiDraw for doing so, and it's done almost in the same way. You can access the raw internal buffer of each surface (a linear buffer, from left to right, from top to bottom, in RGB565 format, 2 bytes per pixel), or you can let GledPlay create a DC with the same content of your surface, and use the GDI blitting functions (like BltFst) for blitting the content of a surface in a DC.

Best regards,
Sergio.