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

Messages - Strikerklm96

#1
Awesome, everything works! I saw that parameter, but stupidly concluded I needed to pass in true to do what I wanted instead of false.
#2
That's probably what I will do. Using old code feels scary now  :'(
#3
Wow, so a lot has changed. What is the new equivalent of bindCallbackEx ?
#4
Hmm, I don't seem to have that function, and gui.getWindow()->setView(view) doesn't work either :/ Guess I gotta go grab the latest.  :P
#5
Help requests / Resizing Window Skews Buttons
07 April 2016, 05:46:54
When resizing the window, the buttons become squished, as you can image. However, resetting the windows view before drawing them does not fix it, and resetting the gui window doesn't either.
Code (cpp) Select

//doesnt fix it
theResizedWindow.setView(recalculatedDefaultView);
gui.draw()

//doesnt fix it
gui.setWindow(theResizedWindow);

I also tried both at once.
Should these work, or is there something else I need to be doing?
#6
Haha thanks, I could always use an old version of TGUI, or do it the way you intend, which is to bind a function to each callback possibility (right?)
#7
It's complicated :P

I have wrappers for various tgui things such as editboxes, buttons, panels, because I have a gamewide eventing system for my game, which I want the tgui stuff to use (and it does and works great)

I put a bunch of logic in a base class, and one thing that I wanted to put in there was the f_callback (binded) function.

Code (cpp) Select
void WidgetBase::f_callback(const tgui::Callback& callback)
{
if(callbackHook(callback))
{

}
else if(callback.trigger == tgui::Widget::WidgetCallbacks::MouseEntered)
{
f_MouseEntered();
}
else if(callback.trigger == tgui::Widget::WidgetCallbacks::MouseLeft)
{
f_MouseLeft();
}
else if(callback.trigger == tgui::ClickableWidget::LeftMouseClicked)
{
f_LeftMouseClicked();
}
else if(callback.trigger == tgui::ClickableWidget::LeftMousePressed)
{
f_LeftMousePressed();
}
else if(callback.trigger == tgui::ClickableWidget::LeftMouseReleased)
{
f_LeftMouseReleased();
}
}
void WidgetBase::f_MouseEntered()
{
sf::Packet pack;
mouseEnteredHook(pack);
m_io.event(EventType::MouseEntered, 0, pack);
}


Then, derived classes can override
Code (cpp) Select
bool callbackHook(const tgui::Callback& callback);
to see if they want to handle the callback.

There are also hooks on the event functions such as mouseEnteredHook which some of the classes do special things with.
So essentially, the derived classes can only handle special events if the function was binded to recieve all events, because the widgetbase binds the function
Code (cpp) Select

void WidgetBase::f_assign(tgui::Widget* pWidget)
{
m_pWidget->bindCallbackEx(&WidgetBase::f_callback, this, 4095);
}
#8
It doesnt get called for editbox callbacks, such as tgui::EditBox::ReturnKeyPressed

Basically I am calling that bind on a base pointer to the widget, and I have a function that I want to get called for all possible triggers that would trigger the derived widget. For instance, m_pWidget could be a tgui::EditBox::Ptr or tgui::Button::Ptr.
#9
Help requests / Bind this function for all callbacks
16 September 2015, 21:44:25
Code (cpp) Select
m_pWidget->bindCallbackEx(&WidgetBase::f_callback, this, tgui::ClickableWidget::AllClickableWidgetCallbacks);
I want to bind this so that it will call f_callback for ALL possible callback triggers. How can I do this?
Can I bind it to multiple triggers?
#10
Quote from: texus on 21 October 2014, 10:21:03If you have multiple sfml and tgui folders you should remove them to make sure that you can't be using the wrong one accidentally. And make sure that all dll files are coming from these folders.

We actually went through and did exactly that step :/ I we will go through again though just to make sure.

Quote from: texus on 21 October 2014, 10:21:03There must still be a configuration mistake on his pc then.

Here are all the things I know how to check:
All CMake settings (we checked Advanced too)
Code::Blocks Compiler settings: Settings->Compiler->Toolchain Executables (his match mine)
Path Environment Variables: I understand what these do, should I check for anything? In the past he had a misconfigured MinGW directory, which was causing a different problem, so we made the only MinGW/bin variable point at the new correct one.

What other things can I check for?

And thank you both for your input!
#11
Strangely, it works fine in Debug mode, but not in Release. Only his computer has this problem.
#12
Ok, so since we were compiling with the same compiler, we assumed our libs would be the same (as you indicated correctly) so I was trying to use his libs, so we were both getting the error.
I rebuilt my libs, and everything works on my machine.

We looked at the file sizes of the libs he was building, and his sfml-window-2.dll file was 146KB, while mine is 830KB. Everything else was different too, shouldn't they be the same? Also, he is Windows 8, I'm windows 7.

We double, triple, and quadruple checked his CMake settings. I also had him download the exact same SFML source I downloaded. We are currently working on getting everything in debug mode to get the callstack.
#13
I really like TGUI, so great job on it  ;D

I just switched to using this as my compiler: https://sourceforge.net/projects/mingw-w64
After rebuilding SFML and TGUI, SFML works fine, but if I try and do anything with TGUI, I get a crash in the SFML Graphics library:


There was a bunch of steps that lead up to this post, which can be seen in this SFML thread:
https://en.sfml-dev.org/forums/index.php?topic=16579.0

I'm pretty sure (can I get a confirmation?) that this compiler uses DW2. I thought that rebuilding TGUI would allow it to work. What is the problem?
Thanks
#14
Help requests / Re: Draggable Panel
10 April 2014, 19:24:51
Works perfectly! Here it is if you want to see it.

            if (rEvent.key.code == sf::Keyboard::F1)
            {
                m_pCPT->setState(PlayerState::Editing);
            }

// somewhere else in the code:

else if(m_pCPT->getState() == PlayerState::Editing)
        {
            if (rEvent.type == sf::Event::MouseButtonPressed)
            {
                tgui::Widget::Ptr widget = f_MouseOnWhichWidget(rEvent.mouseButton.x, rEvent.mouseButton.y, m_rGui.getWidgets());
                if(widget != nullptr)
                {
                    if(widget->getWidgetType() == tgui::WidgetTypes::Type_Panel)
                    {
                        if(f_MouseOnWhichWidget(rEvent.mouseButton.x, rEvent.mouseButton.y, tgui::Panel::Ptr(widget)->getWidgets()) == nullptr)
                        {
                            m_pDraggingWidget = widget;
                            m_pDraggingPosition = sf::Vector2f(rEvent.mouseButton.x, rEvent.mouseButton.y);
                        }
                    }
                }
            }
            else if (rEvent.type == sf::Event::MouseButtonReleased)
            {
                m_pDraggingWidget = nullptr;
            }
            else if (rEvent.type == sf::Event::MouseMoved)
            {
                if (m_pDraggingWidget != nullptr)
                {
                    m_pDraggingWidget->setPosition(m_pDraggingWidget->getPosition().x + rEvent.mouseMove.x - m_pDraggingPosition.x,
                                                   m_pDraggingWidget->getPosition().y + rEvent.mouseMove.y - m_pDraggingPosition.y);

                    m_pDraggingPosition = sf::Vector2f(rEvent.mouseMove.x, rEvent.mouseMove.y);
                }
            }
        }
#15
Help requests / Re: Draggable Panel
09 April 2014, 01:17:14
tgui::Widget::Ptr MouseOnWhichWidget(float x, float y, std::vector<tgui::Widget::Ptr>& widgets)
{
    for (std::vector<tgui::Widget::Ptr>::reverse_iterator it = widgets.rbegin(); it != widgets.rend(); ++it)
        if (((*it)->isVisible()) && ((*it)->isEnabled()) && ((*it)->mouseOnWidget(x, y)))
            return *it;

    return nullptr;
};