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

Author Topic: How to implement Menu's?  (Read 2326 times)

0 Members and 1 Guest are viewing this topic.

Leugim

  • Newbie
  • *
  • Posts: 9
    • MSN Messenger - miguel_is_sexy@hotmail.com
    • View Profile
How to implement Menu's?
« on: September 23, 2011, 07:00:54 pm »
Now I've done this in SDL before, but I'm not exactly sure how I should do this in SFML... What I would usually do is have some abstract class, that has functions for the main loop, handle input and to load everything in. Now I was wondering, for the Rendering Window, should I declare a global variable of the window, so that all my classes can access them, or just parse it in by reference some how?

Or if you have any better ways of doing this, how do you do it?

keyforge

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
How to implement Menu's?
« Reply #1 on: September 23, 2011, 11:14:53 pm »
I have a class called Game which stores a renderwindow and runs the main loop. I pass down a pointer to Game in the main loop to my game states (using the this keyword) which pass it to other things that need it. I have a function in the Game class called GetWindow() which returns a pointer to the renderwindow. You can also store the renderwindow as a public member variable.
Need a place to upload your code, files or screenshots? Use SFML Uploads!