SFML community forums

Help => Graphics => Topic started by: mioan on July 20, 2009, 09:26:28 am

Title: Newbie: Can SFML do this? (Does it have graphic Layers?)
Post by: mioan on July 20, 2009, 09:26:28 am
Hi,
I am searching for a cross platform library for simple graphics.
I am collecting my findings here:
http://www.24hsoftware.com/DevelopersForum/CrossPlatform-C-Library.html

SFML looks a very good solution but there is something I was not able to answer by reading the site.

My screensaver has about 4 layers of graphics (excuse me for not using the most appropriate graphics terms).
Layer 0 is a static background made of a tiling image.
Layer 1 to 3 display objects either by drawing them with pixels and lines or by puting bitmaps.
Every object has x,y,Layer, speed_x, xpeed_y. (they are moving inside their layer)
Objects in higher layers should be in front of object is lower layers.

Does SFML have layers to do such operations easily?
Any code samples?

Thank you very much for any help.

Mike
Title: Newbie: Can SFML do this? (Does it have graphic Layers?)
Post by: Laurent on July 20, 2009, 09:43:38 am
SFML doesn't have an explicit support for layers, but it can be done easily.
Title: Newbie: Can SFML do this? (Does it have graphic Layers?)
Post by: Kingdom of Fish on July 20, 2009, 01:15:29 pm
All you have to do is draw each "layer" in the bottom-top order, that is, each frame you draw layer 0-3 in that order.
Title: flicker?
Post by: mioan on July 20, 2009, 03:35:25 pm
Thank you for answering.

If I draw them in the sequence of the layer, the screen will flicker, right?
E.g. if an object in layer 1 is partially coverred by an object in layer 2.

Should I put the whole screen in double buffer? Isn't that too much memory and CPU load to copy the whole screen?

Sorry for asking basic questions I am new to graphics.

I wish there was a way to assign all these "tasks" to a simple graphics engine and the engine would take care  of them. This is why I am searching for a graphics library.

Mike.
P.S. The graphics I will produce are very simple. See the screenshot of the night sky here to get an idea of what I am trying to achieve:
http://www.starmessage.info/screenshots.html
Title: Newbie: Can SFML do this? (Does it have graphic Layers?)
Post by: Laurent on July 20, 2009, 03:59:20 pm
SFML takes care of all this stuff, you don't have to worry about flickering or double-buffering. Just draw your sprites in order and that's it.
Title: That's good news.
Post by: mioan on July 20, 2009, 05:17:51 pm
Thank you for giving me the "lights". I will try to merge it in to my software.
Mike