SFML community forums

Help => Graphics => Topic started by: Zorgie on December 14, 2007, 04:02:10 pm

Title: Creating a "black box"
Post by: Zorgie on December 14, 2007, 04:02:10 pm
Hi, i'm kinda new to using SFML, and i might have missed this in the tutorial or past forum posts, which i have searched, but anyways, here goes:

I want to create some kind of black box on the screen, overlapping any images below it, alternatively get some kind of way in what order the sprites are showing on the screen, which ones getting priority to be shown if they are on the same spot.

Thanks
Title: Creating a "black box"
Post by: Merkoth on December 15, 2007, 09:18:50 pm
Well, the order will be determined by the order in what you call the Draw() method.

for example:

Code: [Select]

// App is an instance of the RenderWindow object

App.Draw( myBackground );
App.Draw( myShip );
App.Draw( myExplosion );

// render
App.Display();


That would render the background on the... err... back, the ship over the background and, finally, the explosion over the ship. Think of it as Photoshop's Layers.

Now, I'm not really sure I understand what you mean by black box. You should be able to use a simple square image which you than assign to a sprite.

Hope this helps :)
Title: Ty
Post by: Zorgie on December 19, 2007, 10:57:24 am
Thanks, that helps :)