Alright, thanks for clearing it up.
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
#include "TGUI/TGUI.hpp"
int main() {
sf::RenderWindow window(sf::VideoMode(800, 600), "Group Test");
tgui::Gui gui(window);
tgui::Button::Ptr button_1 = tgui::Button::create("Button 1");
button_1->setPosition(5, 5);
tgui::Button::Ptr button_2 = tgui::Button::create("Button 2");
button_2->setPosition(5, 30);
tgui::Group::Ptr group = tgui::Group::create();
group->setSize(400, 300);
group->add(button_1);
group->add(button_2);
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
switch (event.type) {
case sf::Event::Closed:
window.close();
break;
}
gui.handleEvent(event);
window.clear();
group->draw(window, sf::RenderStates::Default);
gui.draw();
window.display();
}
}
}
group->draw(window, sf::RenderStates::Default);
gui.draw();
group->draw(window, sf::RenderStates::Default);
//gui.draw();
tgui::Gui gui;
gui.setTarget(window);
tgui::WidgetGroup group_1;
tgui::WidgetGroup group_2;
group_1.add(); // Add widgets to the group similarly to Gui::add()
group_2.add();
gui.draw(group_1); // Draw the widgets that belong to the given group only
gui.draw(group_2);
current_state->render();
gui->render();int getNum() { return 5; }
void func1(int i);
void func2(int value);
picture->connect("clicked", func1, std::bind(getNum));
button->connect("pressed", func2, std::bind(&tgui::Slider::getValue, slider));void TitleMenuButton::SetFunctions(bool& button_selected, std::string& current_button, std::function<Button&(std::string)> get_button_function) {
button_image->connect("MouseEntered", &TitleMenuButton::ButtonFocused, this, std::ref(button_selected), std::ref(current_button), std::bind(get_button_function, current_button));
button_image->connect("MouseLeft", &TitleMenuButton::ButtonUnfocused, this, std::ref(button_selected), std::ref(current_button));
}std::function<Button&(std::string)> get_button_function = std::bind(&ButtonList::GetButton, this, std::placeholders::_1);
button->SetFunctions(is_focusing_button, current_button, get_button_function);public:
Button& GetButton(std::string button_name) { return *button_list.at(button_name); }
private:
std::unordered_map<std::string, std::unique_ptr<Button>> button_list;