SFML community forums

Help => Window => Topic started by: laux927 on July 11, 2014, 05:47:58 am

Title: [Newbie question]Managing screens
Post by: laux927 on July 11, 2014, 05:47:58 am
Hey! I'm planning on doing a platformer, and I've got a problem/doubt. I want to make the splash screen, the menu, etc. How do i manage the screens? I soppose I have to make a ScreenManager class and go through the screens, clearing and loading the content of the next screen. Is this right?


Another doubt. How do I fade out a sprite?

Sorry if there's any mistake on my writing. I'm from Argentina.


Thanks!
Title: Re: [Newbie question]Managing screens
Post by: eXpl0it3r on July 11, 2014, 09:08:36 am
You could take a look at my SmallGameEngine (https://github.com/eXpl0it3r/SmallGameEngine), it essentially is a demo for managing screens/states and has an example on fading a sprite. It was originally based on this tutorial (http://gamedevgeek.com/tutorials/managing-game-states-in-c/), but has since diverged quite a bit, but you still might find it useful as to get an understanding on how screen managements works.
Title: Re: [Newbie question]Managing screens
Post by: Hapax on July 11, 2014, 09:18:48 am
How do I fade out a sprite?
If the question is just about how to control its alpha value, use .setColor on the sprite and use the fourth value (alpha) in the colour (keep the colour as full white).
e.g.
sf::Color(255, 255, 255, 255) = fully opaque.
sf::Color(255, 255, 255, 128) = half transparent.
sf::Color(255, 255, 255, 0) = fully transparent.
Title: Re: [Newbie question]Managing screens
Post by: laux927 on July 16, 2014, 05:05:07 am
Sorry I didn't answer (World Cup). Thanks eXpl0it3r for the engine, but I'm looking to do it on my own, because it's the first project I do. Plus, I have to hand it in for college.

Any other indication?
Title: AW: [Newbie question]Managing screens
Post by: eXpl0it3r on July 16, 2014, 08:03:25 am
Well you don't have to copy it, it's just an example, plus I gave you a tutorial. Not sure what more you want, if you have/want to do it on your own. ;)