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.


Topics - RamblingBaba

Pages: [1]
1
Installation help / 0.9 Errors
« on: 01 May 2020, 06:57:02 »
Hello,

I've just switched to 0.9 since I saw it had some features I really wanted. I'm getting these errors though,

Severity        Code    Description     Project File    Line    Suppression State
Error   C2672   'tgui::SignalTyped<const tgui::String &>::connect': no matching overloaded function found       TGUI    E:\Libaries\TGUI-0.9-dev\include\TGUI\Signal.hpp        468    
 

Severity        Code    Description     Project File    Line    Suppression State
Error   C2783   'unsigned int tgui::SignalTyped<const tgui::String &>::connect(const Func &,const BoundArgs &...)': could not deduce template argument for '__formal'  
TGUI    E:\Libaries\TGUI-0.9-dev\include\TGUI\Signal.hpp        467    
 

I know connect was replaced with a more direct version (like onPress()). But I'm not sure how to repair this.

Thanks

2
Help requests / Updating Real Time
« on: 01 May 2020, 03:30:21 »
Hello, I'm having trouble figuring out how to update the text live. I have 3 sliders, 3 labels sayings "Red, Green, Blue", and 3 labels that are supposed to show the value of each individual slider. The sliders change the color of the background of a child window. I've basically stripped out the "All Widgets Example" provided.

1st Question: How can I change the position of the slider at startup? It always starts at 0 (it's at zero now as I tried to fix), yet I assumed setValue would position it to the value correctly.
(UPDATE: I saw this on a thread " I've added a ThumbWithinTrack option to the renderer in TGUI 0.9-dev. Setting it to true will make the side of the thumb align with the side of the track when the thumb has minimum or maximum value."

2nd Question:   (SOLVED, I FIGURED IT OUT, HAD TO GET FROM GUI. I STILL HAVE TO CLICK EACH SLIDER FOR IT TO UPDATE THE VALUES FOR THE CHILD BACKGROUND)
   
int r = 0, g = 0, b = 0;
...
        // Red
        auto slider = tgui::Slider::create();
        slider->setRenderer(theme.getRenderer("Slider"));
        slider->setPosition(55, 360);
        slider->setSize(200, 18);
        slider->setValue(0);
        slider->setMaximum(255);
        slider->setMinimum(0);
        slider->connect("ValueChanged", [&]() {
            r = slider->getValue();

            child->getRenderer()->setBackgroundColor({ (sf::Uint8)r, (sf::Uint8)g, (sf::Uint8)b });
            gui.get<tgui::Label>("red_value")->setText(std::to_string((int)gui.get<tgui::Slider>("red").get()->getValue()));
        });
        gui.add(slider, "red");

        label = tgui::Label::create();
        label->setRenderer(theme.getRenderer("Label"));
        label->setText("Red");
        label->setPosition("red.left - width - 10","red.top");
        label->setTextSize(14);
        gui.add(label, "red_label");

        label = tgui::Label::create();
        label->setRenderer(theme.getRenderer("Label"));
        label->setText(std::to_string(r));
        label->setPosition("red.left + red.width + 10", "red.top");
        label->setTextSize(14);
        gui.add(label, "red_value");

        // Green
        slider = tgui::Slider::copy(slider);
        slider->setPosition("red.left", "red.top + 35");
        slider->connect("ValueChanged", [&]() {
            g = slider->getValue();

            child->getRenderer()->setBackgroundColor({ (sf::Uint8)r, (sf::Uint8)g, (sf::Uint8)b });
            gui.get<tgui::Label>("green_value")->setText(std::to_string((int)gui.get<tgui::Slider>("green").get()->getValue()));

            });
        gui.add(slider, "green");

        label = tgui::Label::create();
        label->setRenderer(theme.getRenderer("Label"));
        label->setText(std::to_string(g));

        label->setPosition("green.left + green.width + 10", "green.top");
        label->setTextSize(14);
        gui.add(label, "green_value");

        label = tgui::Label::create();
        label->setRenderer(theme.getRenderer("Label"));
        label->setText("Green");
        label->setPosition("green.left - width - 10", "green.top");
        label->setTextSize(14);
        gui.add(label, "green_label");

        // Blue
        slider = tgui::Slider::copy(slider);
        slider->setPosition("green.left", "green.top + 35");
        slider->connect("ValueChanged", [&]() {
            b = slider->getValue();
            child->getRenderer()->setBackgroundColor({ (sf::Uint8)r, (sf::Uint8)g, (sf::Uint8)b });
            gui.get<tgui::Label>("blue_value")->setText(std::to_string((int)gui.get<tgui::Slider>("blue").get()->getValue()));

            });
        gui.add(slider, "blue");

        label = tgui::Label::create();
        label->setRenderer(theme.getRenderer("Label"));
        label->setText("Blue");
        label->setPosition("blue.left - width - 10", "blue.top");
        label->setTextSize(14);
        gui.add(label, "blue_label");

        label = tgui::Label::create();
        label->setRenderer(theme.getRenderer("Label"));
        label->setText(std::to_string(b));
        label->setPosition("blue.left + blue.width + 10", "blue.top");
        label->setTextSize(14);
        gui.add(label, "blue_value");
 

Here is the code for what I'm doing with the sliders and labels. How can I get these label values to change as I scroll? EDIT: I got it to scroll and display the value correctly, but I realized the color of the background is definitely not accurate.

3rd: What does the method update actually do? (Besides the obvious) What is being updated and when would I want to manually call update? Also, what is updateTime() method in the Gui suppose to do?

4th: How do I manually call a Widgets connect callback?

Any help would greatly be appreciated, thanks!

3
Help requests / Highlighting Keywords
« on: 29 January 2020, 03:25:39 »
I'm just messing around with TGUI and getting familiar with it. I'm just making a mock chat room and I was wondering if there is a way to have multiple colors on one line?
For example:

RamblingBaba: Hello, World.

And have the username color (say Red) and the message a different color (say Green).

I'm assuming there may be a way that isn't very apparent. I was messing with the index function, but I always came back to realizing there is only addline() and I couldn't figure out a way to emulate it.

Question 2
I was having a problem with the timing of pressing enter (so it doesn't spam the message). Frame management seemed to be ignored. I managed to get it working nicely, but I came across a question? I have a button that can be used to send the message from the edit box to the chatbox. Is there a way to activate the buttons connect callback without actually doing the command "pressed". I was basically looking for like an activate(true) method or something similar. I did "Focused" which was a guessing game to find what is required (tried 'up, keyup, released, etc..'). So I would type a message, press enter (didn't understand onReturnKeyPressed since it's not a bool), focus to the send button, which automatically activates the callback lambda on the button to send the edit box text to the chatbox, clear the edit box, and focus back to the edit box.

And question 2.5 is there a way to do that process quicker or perhaps more efficient?

Thanks!

4
Help requests / "Keyword list"
« on: 27 January 2020, 16:40:05 »
Hello,

So I'm looking through the documentation regarding "string keywords" for some functions (like connect). But the tutorial leaves it too vague and assumed such as "pressed" etc. It seems to be the common sense of "pressed" "MouseUp". But is there an actual list of all these without searching function by function? As much common sense as it seems, I'm sure I might not be thinking of the correct keyword when I'm trying to do something. For example, is it "scroll" "slide" "drag"? So a list would be great!

PS: Very nice GUI for SFML. By far the most productive and least confusing out of the few I tried. Also, are there any really nice screenshots of this being used in games? I have seen a few (not necessarily games), but the gallery isn't very big. 

Pages: [1]