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

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

0 Members and 1 Guest are viewing this topic.

kralo9

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: SFGUI (0.1.0 released)
« Reply #405 on: March 19, 2013, 07:43:42 pm »
You need to destroy the old widgets. While they still exist (because you still own them) they will be rendered. If you don't intend on using them any more in the future, just let them go out of scope or explicitly call .reset() on each of their Ptrs. If you do intend on using them again in the future, do not remove them from the desktop to stop them from being displayed, simply hide them instead.

Thanks. If I hide the sfg::Window I can use it later :) but I hope the widgets aren't interactive when hided, are they?

Edit: Additionally: How did you mask the password entry in the text.exe?
« Last Edit: March 19, 2013, 07:46:27 pm by kralo9 »
I'm totally exhausted. I've got 3 children and no money! Why can't I have no children and 3 money? - Homer S.

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: SFGUI (0.1.0 released)
« Reply #406 on: March 19, 2013, 07:55:34 pm »
void sfg::Entry::HideText ( sf::Uint32  c)
I think..
Back to C++ gamedev with SFML in May 2023

kralo9

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Email
Re: SFGUI (0.1.0 released)
« Reply #407 on: March 19, 2013, 08:19:24 pm »
void sfg::Entry::HideText ( sf::Uint32  c)
I think..

Ah obvious function detected :D Yes thanks.
I'm totally exhausted. I've got 3 children and no money! Why can't I have no children and 3 money? - Homer S.

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: SFGUI (0.1.0 released)
« Reply #408 on: March 25, 2013, 12:40:41 am »
#include <SFML/Graphics.hpp>
#include <SFGUI/SFGUI.hpp>
int main()
{
        sf::RenderWindow app(sf::VideoMode(600,480),"Heh");
        app.setFramerateLimit(30);
        sfg::SFGUI sfgui;
        sfg::Desktop desk;
        sf::Event eve;
        sf::Clock clo;

        sfg::Window::Ptr win=sfg::Window::Create();
        sfg::ScrolledWindow::Ptr scr=sfg::ScrolledWindow::Create();
        scr->SetRequisition(sf::Vector2f(150.f,150.f));
        win->Add(scr);
        sfg::Box::Ptr box2=sfg::Box::Create();
        scr->AddWithViewport(box2);

        for(int i=0;i<10;++i)
        {
                box2->Pack(sfg::Label::Create("Hello World"));
        }
        desk.Add(win);
        app.resetGLStates();
        while(app.isOpen())
        {
                app.clear();
                while(app.pollEvent(eve))
                {
                        if(eve.type==sf::Event::Closed) app.close();
                        desk.HandleEvent(eve);
                }
                desk.Update(clo.restart().asSeconds());
                sfgui.Display(app);
                app.display();
        }
}
Is this wrong usage? If not, this causes a bug where scrolled window scrolls appear as 1 pixel thin lines untill window is resized, clicked, etc. Could someone confirm this?

[attachment deleted by admin]
« Last Edit: March 25, 2013, 12:56:23 am by FRex »
Back to C++ gamedev with SFML in May 2023

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: SFGUI (0.1.0 released)
« Reply #409 on: March 25, 2013, 06:27:48 pm »
Please report it as a bug at our tracker. binary1248 will be quite happy to hear from another ScrolledWindow bug. ;)

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: SFGUI (0.1.0 released)
« Reply #410 on: March 25, 2013, 06:36:10 pm »
That went well..., I thought that selecting my code and clicking 'inline code' will mark it as 'source code' and display it in a box or something, spoiler: it didn't:
http://redmine.boxbox.org/issues/603
Back to C++ gamedev with SFML in May 2023

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFGUI (0.1.0 released)
« Reply #411 on: March 25, 2013, 07:31:26 pm »
You could have saved yourself the trouble. I already looked into it last night right after you posted. The fix was already done this afternoon. Tank always rushes people to add stuff to the tracker. He thinks he can put me under pressure that way, and yet he still hasn't merged in the last several commits I made ::).
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: SFGUI (0.1.0 released)
« Reply #412 on: March 26, 2013, 01:29:48 am »
No, I ask people to add stuff to the tracker so they won't be forgotten and they are at one place, instead of having to look through forum threads. Pressure? This is volunteer work, that's wouldn't be very fair. ;) Nice that a fix is already there. I really try to merge tomorrow and prepare a bug fix release. Thank you.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: SFGUI (0.1.0 released)
« Reply #413 on: March 26, 2013, 09:57:17 am »
Merged in 0.2.0 branch. I think we gonna release a bugfix release prior to 0.2.0. I have to talk to eXpl0it3r, the build master. :P

kamui

  • Sr. Member
  • ****
  • Posts: 291
    • View Profile
Re: SFGUI (0.1.0 released)
« Reply #414 on: March 26, 2013, 09:33:08 pm »
Hello,

I started using your library, and all works great, but I didn't find how to align my boxes to the center of my sfml window. I saw some threads where binary1234 gave explanations on using sfg::alignment, but it has no effect on my code.

Here's an example of what I tried :

sfg::Box::Ptr box = sfg::Box::Create( sfg::Box::VERTICAL );
sfg::Alignment::Ptr center = sfg::Alignment::Create();
center->SetAlignment(sf::Vector2f(1366.f, 768.f));
box->Pack(center, true, true);
 

Did I do something wrong ?

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: SFGUI (0.1.0 released)
« Reply #415 on: March 26, 2013, 11:08:41 pm »
What stage is std::bind integration at? Because I just took few minutes and added it in, I edited Signal.hpp and Signal.inl, all the other code is the same, I had to typedef sfg::Delegate to std::function<void(void)> and do something in the body of your Connect overload for method so your internal widgets code would work.
Examples seem to work still..
This code now work:
#include <SFML/Graphics.hpp>
#include <SFGUI/SFGUI.hpp>
#include <iostream>
void testfunction1(const std::string& str,char chr)
{
        std::cout<<str<<chr<<std::endl;
}
void testfunction2()
{
        std::cout<<"WHY!?"<<std::endl;
}
class testclass
{
public:
        void testmethod()
        {
                std::cout<<"P.S. sfg::ListBox and YAML are missing still too"<<std::endl;
        }
};
int main()
{
        sfg::SFGUI sfgui;
        sfg::Desktop desk;
        sfg::Window::Ptr win=sfg::Window::Create();
        desk.Add(win);
        sfg::Box::Ptr box=sfg::Box::Create(sfg::Box::VERTICAL,1.f);
        sfg::Button::Ptr button=sfg::Button::Create("TestBound");
        button->GetSignal(sfg::Button::OnLeftClick).Connect(std::bind(testfunction1,"Stefan why no std::bind :(",'?'));
        box->Pack(button);
        button=sfg::Button::Create("TestFree");
        button->GetSignal(sfg::Button::OnLeftClick).Connect(testfunction2);
        box->Pack(button);
        button=sfg::Button::Create("TestMember");
        testclass obj;
        button->GetSignal(sfg::Button::OnLeftClick).Connect(&testclass::testmethod,&obj);
        box->Pack(button);
        win->Add(box);
        sf::RenderWindow app(sf::VideoMode(600,480),"std::bind is (not) a lie");
        app.resetGLStates();
        app.setFramerateLimit(30);
        sf::Clock clo;
        sf::Event eve;
        while(app.isOpen())
        {
                while(app.pollEvent(eve))
                {
                        if(eve.type==sf::Event::Closed) app.close();
                        desk.HandleEvent(eve);
                }
                desk.Update(clo.restart().asSeconds());
                app.clear();
                sfgui.Display(app);
                app.display();
        }
}
Of course my trick is quite stupid (could also get it to pass the instigator widget to bound function after some deeper work, that'd be even nicer that plain std::bind) and not tested at all but it seems to work, if anyone is willing to test/risk using that stuff I added it in attachment.
Also, if c++11 is going to happen, will you remove sfg::SharedPtr?
And I've added '//FREX' comment to every line I edited or added so you can grep for them if you want to see what I did.
Sorry if I sound patronizing or whiny.

[attachment deleted by admin]
« Last Edit: March 26, 2013, 11:13:36 pm by FRex »
Back to C++ gamedev with SFML in May 2023

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: SFGUI (0.1.0 released)
« Reply #416 on: March 27, 2013, 02:35:02 am »
Hello,

I started using your library, and all works great, but I didn't find how to align my boxes to the center of my sfml window. I saw some threads where binary1234 gave explanations on using sfg::alignment, but it has no effect on my code.

Here's an example of what I tried :

sfg::Box::Ptr box = sfg::Box::Create( sfg::Box::VERTICAL );
sfg::Alignment::Ptr center = sfg::Alignment::Create();
center->SetAlignment(sf::Vector2f(1366.f, 768.f));
box->Pack(center, true, true);
 

Did I do something wrong ?
Look at Layout.cpp in the examples folder.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: SFGUI (0.1.0 released)
« Reply #417 on: March 27, 2013, 08:37:20 am »
I think we gonna release a bugfix release prior to 0.2.0. I have to talk to eXpl0it3r, the build master. :P
Oh no! I'm not here, never have, never will be! ;D

Na, I'll just have to recreate the build scripts for SFGUI as well, but I'm already behind with Thor. :o
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: SFGUI (0.1.0 released)
« Reply #418 on: March 27, 2013, 11:09:21 am »
FRex:
It's almost finished. I'm not just replacing the fast delegates by std::function, but also change the whole signalling concept internally. Besides of that, we're also dropping sfg::SharedPtr in favor of std::shared_ptr.

After the changes there will be only one function that can be used to register a signal callback. It expects a function<void( uint32_t, shared_ptr<sfg::Object> )>, where the first parameter is the signal ID and the second the emitter object (or widget).

To make it more comfortable to work with, I'm writing sfg::SignalRouter, which you can use to register signals per widget like this:

sfg::SignalRouter router;
router.AddHandler( my_widget, sfg::Button::OnLeftClick, []( shared_ptr<sfg::Button> button ) { // Do something } );

The router will then dispatch signals whenever it receives them from the proper object. The third parameter, by the way, is a std::function.

Also, for a future version (maybe for 0.3.0 or 0.4.0, it's really not decided yet), it's planned to decouple the widgets completely from rendering. At the moment they are calling the active rendering engine to get visuals, which makes them dependent on the engine.

So basically at least the signalling/shared_ptr stuff is what's taking so long -- besides me not having as much free time as I'd love to have. ;)

Quote
Na, I'll just have to recreate the build scripts for SFGUI as well, but I'm already behind with Thor.
SFGUI is more important!!1! ;)

kamui

  • Sr. Member
  • ****
  • Posts: 291
    • View Profile
Re: SFGUI (0.1.0 released)
« Reply #419 on: March 27, 2013, 01:14:45 pm »
Hello,

I started using your library, and all works great, but I didn't find how to align my boxes to the center of my sfml window. I saw some threads where binary1234 gave explanations on using sfg::alignment, but it has no effect on my code.

Here's an example of what I tried :

sfg::Box::Ptr box = sfg::Box::Create( sfg::Box::VERTICAL );
sfg::Alignment::Ptr center = sfg::Alignment::Create();
center->SetAlignment(sf::Vector2f(1366.f, 768.f));
box->Pack(center, true, true);
 

Did I do something wrong ?
Look at Layout.cpp in the examples folder.

thanks.

 

anything