Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - crdl_pls

#1
I'm trying to create a label that will automatically centre itself. I'm attempting to do this:
label->setAutoSize(true);
label->setPosition(screenSize.x / 2.f - bindWidth(label)/2.f, YVALUE);


So no matter what I set the text to, in theory, the width should adjust accordingly, and then the position should change based on the width.
However, it seems that bindWidth(label) isn't updating when the length changes, and label has no text value until I change it, bindWidth(label) is always 0.

In the image "Get Ready!!!" is the label.

Any ideas? The width is changing correctly but that doesn't seem to affect the binding.
#2
I tried to follow your tutorial here on signals, but I seem to be making a mistake when trying to connect a  member function to a signal.
Error:'&': illegal operation on bound member function expression

Here is the minimal context:

// stateMainMenu.cpp
void stateMainMenu::Init(gameEngine* game) {
tgui::Button::Ptr buttonQuit = std::make_shared<tgui::Button>();
buttonQuit->connect("clicked", &(game->Quit), &game); // Crash Here
gui.add(buttonQuit, "buttonQuit");
}


and the class definition for gameEngine:


// gameEngine.h
class gameEngine {

public:
//Other Stuff
bool Running() { return isRunning; }
void Quit() { isRunning = false; }

private:
bool isRunning;
};


So far I've tried small stuff I thought would work like making both isRunning and Quit static, or writing a small function in gameEngine.cpp to run game->quit, and then connect that function to the button. The last two work but I want to see if I can get the function pointers working. Any help would be amazing.
#3
Help requests / Theme.txt Syntax
28 February 2016, 00:38:54
Sorry for all the questions, I really appreciate your help.

I'm trying to figure out the syntax of the Black.txt file included in the download so I can make my own from premade textures. I can't seem to find a description on either the forum or the main site. I assumed that the brackets with 4 values were (top,left,width,height) but that doesn't appear to work.

Also is it possible to do something like this:
Button {
    NormalImage     : "ThemeNormalImage.png" Part(whatever) Middle(whatever);
    HoverImage      : "ThemeHoverImage.png" Part(whatever) Middle(whatever);
    DownImage       : "ThemeDownImage.png" Part(whatever) Middle(whatever);


so that I could load every individual texture from its own file? Granted not safe efficient but I have them split up as it is.
#4
I was looking through the tutorials, trying to understand layouts and binding, and I just have no idea what they are or how they work. I assume they're meant to allow fixing the size/position of one widget based on another widget, but then I don't get binding ranges. Is that to make sure it stays within a specific range?

If anyone could just explain this, I would be really grateful. Thanks  :)