PocketMatrix forums

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

Dynamic surface HELP!!!

Hi all,
I want to change the content of a surface when
it's running. I found there is a CGapiSurface::FreeResources() but it's protected.
I tried to call CreateSurface in ProcessNextFrame
but it becomes very slow and new surface doesn't
show up. I think it uses up memory (?).

Does anyone have similiar experience with dynamic
surface?

Thanks for any help!!!
-CZ
Depends on what you mean by dynamic surfaces. If you want to destroy a surface and recreate it then you can do this just by using pointers to surfaces and creating them dynamically via new/delete, etc.

However this will be slow. The best route is to reuse surfaces that are already created at a size sufficient to hold the image data you want on it. You can then just clear the surface with a blit to black and load a new image over it. Or just load a new image over it.