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

Author Topic: TGUI question  (Read 1190 times)

0 Members and 1 Guest are viewing this topic.

ScArL3T

  • Newbie
  • *
  • Posts: 32
    • View Profile
TGUI question
« on: June 21, 2015, 12:22:07 pm »
I have a header file in which there are extern variables.
Should I declare :
extern tgui::Gui gui;
//and use it once in main:
gui.setWindow(window);
 

Or should i just declare it once in every class I have?

I'm asking because in SFGUI you shouldn't declare it globally.


Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: TGUI question
« Reply #1 on: June 21, 2015, 12:29:02 pm »
Neither. You should declare it once in one class, and reference it in the other places you need it.

And you should get rid of your header file with global variables; this design is most probably terrible. Reason.
« Last Edit: June 21, 2015, 12:32:43 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

ScArL3T

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: TGUI question
« Reply #2 on: June 21, 2015, 12:32:49 pm »
Thank you!

 

anything