Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Newbie question]Managing screens  (Read 2306 times)

0 Members and 1 Guest are viewing this topic.

laux927

  • Newbie
  • *
  • Posts: 2
    • View Profile
[Newbie question]Managing screens
« 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!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: [Newbie question]Managing screens
« Reply #1 on: July 11, 2014, 09:08:36 am »
You could take a look at my 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, but has since diverged quite a bit, but you still might find it useful as to get an understanding on how screen managements works.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: [Newbie question]Managing screens
« Reply #2 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.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

laux927

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: [Newbie question]Managing screens
« Reply #3 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
AW: [Newbie question]Managing screens
« Reply #4 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. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/