Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SFGUI (0.4.0 released)  (Read 393895 times)

0 Members and 7 Guests are viewing this topic.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFGUI (0.1.1 released)
« Reply #465 on: August 07, 2013, 07:15:37 am »
SFGUI also doesn't try to hold references to the SFML window. This would not only introduce really bad coupling, it would also make it harder for us to become independent of SFML if we chose to ;).
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Bitbridge

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Manuel Reinfurt - Website
Re: SFGUI (0.1.1 released)
« Reply #466 on: August 12, 2013, 05:50:56 pm »
Hello,

I'm currently using SFML 2.x for a project and I'm also thinking about using Thor and SFGUI. I do use Visual Studio 2013 Preview and used Cmake to build/compile SFML (dynamic libs) and Thor which worked great.

However, when I try to generate a VS 2013 solution for SFGUI using Cmake it says it cannot find the SFML module. Now there are apparently 2 ways to solve this.

1: Set SFML_Dir to the directory containing "installed" SFML
When I do this (same when generating Thor) it just says it cannot find SFML and resets the SFML_DIR variable to "SFML_DIR-NOTFOUND". Some posts suggested also using SFML_ROOT and SFML_INCLUDE_DIR, which I tried and didn't help.

The SFML Directory, however, does not contain the SFMLConfig.cmake. If I rename the Config.cmake in SFML/Cmake and link to this folder it says that the SFML version is not supported (2).

2: Copy the FindSFML.cmake to the CMAKE_MODULE_PATH
When doing this, it says it cannot find specific SFML modules (graphics, system).

Here's a screenshot of my settings and the error.


I'm not really experienced with Cmake, but I hope we can find a solution. :)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: SFGUI (0.1.1 released)
« Reply #467 on: August 12, 2013, 06:45:03 pm »
That you'll have to define SFML_ROOT is said in the User Guide, unfortunately the part with actually finding SFML, isn't explain though.

For CMake to find SFML you'll have to add CMAKE_MODULE_PATH and set path to <path-to-sfml>/cmake/Modules/. Then you set SFML_ROOT to <path-to-sfml> and you should be fine. On the other hand you can manually install the FindSFML.cmake to <path-to-cmake>/share/cmake-2.8/Modules, just make sure to update every time it changes in SFML.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Bitbridge

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Manuel Reinfurt - Website
Re: SFGUI (0.1.1 released)
« Reply #468 on: August 12, 2013, 07:08:34 pm »
Thanks, that worked. Life can be so easy sometimes. ;)

ChronicRat

  • Sr. Member
  • ****
  • Posts: 327
  • C++ programmer
    • View Profile
    • My blog
Re: SFGUI (0.1.1 released)
« Reply #469 on: August 25, 2013, 05:13:57 pm »
I've just started to use SFGUI, and i have a question. How to check that event was proccessed in Desktop::Update(event)? For now if i'm dragging window by caption then i'm dragging game field too. Is there any possibility to check it?

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: SFGUI (0.1.1 released)
« Reply #470 on: August 25, 2013, 05:40:09 pm »
No. :-X
http://en.sfml-dev.org/forums/index.php?topic=6112.msg76198#msg76198
Maybe go bug tank about that and more gtk-ish callbacks like I do and he will change his mind. :-\

I had a thing to do something very much like flash does when it's in browser tab:
last click landed in gui = all events go to SFGUI(except super special events like closed, resized window etc.),
last click landed outside of gui = all events go to app(+ movements go to GUI event then because it makes sense)
the class that does these methods would wrap around desktop and never show it to client, and you'd add/remove using it's methods and it'd take weak widget ptr and add it to m_Solids if you added a 'solid' widget just now
Full code is on github, but, messy as hell so beware: https://github.com/FRex/ee/blob/master/src/ee/GUI/Core.cpp
This also fails(only place I know where it does, might fail more places) when top level widget is window that has a combobox in it and that combo extends its items list outside of window allocation, it'll the not detect clicks on these items that stick out.
Don't let the comment about coming 'proper fix' (a hack around SFG limitation really..) give you any hope tho. :P
Also, my repos(ee and Game) are MIT licensed.. so try not to just take(too much) code from it if you don't want to include a .txt file with your end app that has LICENSE file content in it to give me credit. ;)
And there should be check to see that result of lock() in checkForHit is valid shared_ptr.
bool alwaysSend(const sf::Event& event)
{
    switch (event.type)
    {
        default:
            return false;
        case sf::Event::Closed:
        case sf::Event::GainedFocus:
        case sf::Event::LostFocus:
        case sf::Event::Resized:
        case sf::Event::MouseLeft:
        case sf::Event::MouseEntered:
            return true;
    }
}

void GUICore::update(float seconds)
{
    m_Desktop.Update(seconds);
}

bool GUICore::handleEvent(const sf::Event& eve)
{
    //TODO: improve here
    if(eve.type==sf::Event::MouseMoved)//always handle mouse movements..(?)
    {
        m_Desktop.HandleEvent(eve);
    }
    if(eve.type==sf::Event::MouseButtonPressed/*&&eve.mouseButton.button==sf::Mouse::Left*/)//cmted for now..
    {
        checkForHit(sf::Vector2f(static_cast<float>(eve.mouseButton.x),static_cast<float>(eve.mouseButton.y)));
    }
    if(m_Active)
    {
        m_Desktop.HandleEvent(eve);
        return alwaysSend(eve);//special event
    }
    if(eve.type==sf::Event::MouseButtonPressed)//hack for combo boxes with long item lists
    {
        //m_Desktop.HandleEvent(eve);//it caused other bug which fix fixes this one too, if long combo lists come there can be proper fix later
    }
    return true;// !m_Active == true
}

void GUICore::checkForHit(sf::Vector2f pos)
{
    m_Active=true;

    for(auto it=m_Solid.begin();it!=m_Solid.end();++it)
    {
        if((*it).lock()->IsGloballyVisible() && (*it).lock()->GetAllocation().contains(pos)) return;
    }
    m_Active=false;
}
« Last Edit: August 25, 2013, 05:47:44 pm by FRex »
Back to C++ gamedev with SFML in May 2023

ChronicRat

  • Sr. Member
  • ****
  • Posts: 327
  • C++ programmer
    • View Profile
    • My blog
Re: SFGUI (0.1.1 released)
« Reply #471 on: August 25, 2013, 05:50:55 pm »
Ok, thanks. So no floating or resizeable windows to user will be. =) Creating own check system is too much cost.
« Last Edit: August 25, 2013, 05:53:17 pm by ChronicRat »

ChronicRat

  • Sr. Member
  • ****
  • Posts: 327
  • C++ programmer
    • View Profile
    • My blog
Re: SFGUI (0.1.1 released)
« Reply #472 on: September 01, 2013, 04:49:28 pm »
There is any standard possibility to automatic scroll down to the end? I have log window and i need to see last posted messages without manual scroll by mouse.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFGUI (0.1.1 released)
« Reply #473 on: September 01, 2013, 05:08:06 pm »
Just make sure the adjustment is set to its maximum every time it changes with OnChange.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

ChronicRat

  • Sr. Member
  • ****
  • Posts: 327
  • C++ programmer
    • View Profile
    • My blog
Re: SFGUI (0.1.1 released)
« Reply #474 on: September 01, 2013, 05:48:40 pm »
Thanks, it works:
       
        mScrolledWindow->Refresh();
        const sfg::Adjustment::Ptr& scroll = mScrolledWindow->GetVerticalAdjustment();
        scroll->SetValue(scroll->GetUpper());
 
But will be nice to make it by one command.

upd: post edited, no questions anymore. =)
« Last Edit: September 01, 2013, 06:51:08 pm by ChronicRat »

two-tone-

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: SFGUI (0.1.1 released)
« Reply #475 on: September 18, 2013, 12:44:35 am »
Question, will there be a tutorial on how to use SFGUI in the future?

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFGUI (0.1.1 released)
« Reply #476 on: September 18, 2013, 01:21:53 am »
If by tutorial you mean our example source code with slightly more comments written in pretty HTML and CSS so people can read them better in their internet browser instead of source code editor... yeah maybe. If you are expecting prose text that is 20 times more verbose than the code, you might be out of luck.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

infinitebox

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: SFGUI (0.1.1 released)
« Reply #477 on: November 18, 2013, 08:55:39 am »
That you'll have to define SFML_ROOT is said in the User Guide, unfortunately the part with actually finding SFML, isn't explain though.

For CMake to find SFML you'll have to add CMAKE_MODULE_PATH and set path to <path-to-sfml>/cmake/Modules/. Then you set SFML_ROOT to <path-to-sfml> and you should be fine. On the other hand you can manually install the FindSFML.cmake to <path-to-cmake>/share/cmake-2.8/Modules, just make sure to update every time it changes in SFML.

Im also having trouble with this. After doing what you've explained, I'm now getting a "Could NOT find SFML (missing: SFML_GRAPHICS_LIBRARY SFML_WINDOW_LIBRARY SFML_SYSTEM_LIBRARY)" error in CMake.

The call stack shows:
CMakeLists.txt:22 (find_package)



UPDATE: nvm. my problem was my lib files were in different directories :P
« Last Edit: November 18, 2013, 09:03:25 am by infinitebox »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: SFGUI (0.1.1 released)
« Reply #478 on: November 18, 2013, 09:03:21 am »
I haven't built SFML as of late, not sure if the CMake scripts got a change, but it sounds rather that your <path-to-sfml> on SFML_ROOT is not set right.
Does the specified directory contain the lib and include directories of SFML?
« Last Edit: November 18, 2013, 09:18:19 am by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

infinitebox

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: SFGUI (0.1.1 released)
« Reply #479 on: November 18, 2013, 09:04:45 am »
I haven't built SFML as of late, not sure if the CMake scripts got a change, but it sounds rather that you're <path-to-sfml> on SFML_ROOT is not set right.
Does the specified directory contain the lib and include directories of SFML?
I had my lib files in different directories so CMake couldn't find them :P (it was a custom VS2013 build).