Set a sf::RenderWindow from other class
« on: 12 January 2014, 01:44:08 »
Hello!  I am trying to set up a GUI system.  However, my RenderWindow instance is inside of a different class than what I am trying to access it from, and I can only access it via a RenderWindow*.  Is there a way to set the tgui::Gui to the RenderWindow* that I have, or do I need to do something else?  (Sorry if this is a little noob, I'm not that awesome at C++)

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Set a sf::RenderWindow from other class
« Reply #1 on: 12 January 2014, 11:56:30 »
If I understand the question correctly then this is indeed about a basic part of c++.

With some basic type:
int i1 = 0; // Create an integer
int* p = &i1; // Create a pointer with the address of i1
int i2 = *p; // Dereference the pointer (get the value of i1)

You are in the exact same situation as the last line, you need a RenderWindow while you only have a RenderWindow* (just like you needed an int and had an int*).
So you can just initialize the gui like this:
tgui::Gui gui(*renderWindowPointer);

Re: Set a sf::RenderWindow from other class
« Reply #2 on: 12 January 2014, 17:00:25 »
Thanks, this worked!  xD 

Also, because I couldn't find it anywhere else, how do you skin the buttons?  I haven't really found a tutorial by the developer or any third party that shows how to do this. 

*

texus

  • *****
  • 1161
    • View Profile
    • Texus's Blog
Re: Set a sf::RenderWindow from other class
« Reply #3 on: 12 January 2014, 19:10:15 »
You should take a look here: https://tgui.eu/tutorials/v06/config-files/.

You should just try to have a look at the existing styles and try to learn how it workes by just changing some parameters and look at the results. But feel free to ask if you have a more specific question.
« Last Edit: 09 March 2014, 00:20:13 by texus »