Set a sf::RenderWindow from other class

Started by Charsmud, 12 January 2014, 01:44:08

Charsmud

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

If I understand the question correctly then this is indeed about a basic part of c++.

With some basic type:
Code (c++) Select
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:
Code (c++) Select
tgui::Gui gui(*renderWindowPointer);

Charsmud

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

#3
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.