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

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

0 Members and 4 Guests are viewing this topic.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI
« Reply #75 on: November 04, 2011, 05:43:58 pm »
UPDATE

We recently merged our dev branch into master that fixed a lot of stuff and changed many things internally. Changes:

  • Removed the Boost dependency completely.
  • Signals now all have the signature "void(void)", fast delegates are used for connecting them.
  • Internal event processing improved, doesn't utilize signals anymore.
  • Hooks completely removed.
  • A bunch of new example applications that show the single widgets.
  • Little game "Guess My Number" added.
  • Fixed several issues with compiling with MSVC.


Have fun and tell us what you think. :-) Remember to visit the SFGUI forum for reporting issues and/or getting support. This thread is primary for news.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
SFGUI
« Reply #76 on: November 04, 2011, 06:24:20 pm »
The current examples don't cover all widgets. More examples are bound to come soon covering the other widgets. Until then... I guess you can play around with the current ones :P
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

victorlevasseur

  • Full Member
  • ***
  • Posts: 206
    • View Profile
SFGUI
« Reply #77 on: November 04, 2011, 06:44:25 pm »
Cool update. :)
But now, how can we receive the oldstate in the signal stateChanged, or the mouse position in the mouseClick signal ?

asdatapel

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
SFGUI
« Reply #78 on: November 04, 2011, 07:12:07 pm »
so ive been looking at the examples. It looks like everything requires a window. Is it possible to do without?

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
SFGUI
« Reply #79 on: November 04, 2011, 08:03:58 pm »
Quote from: "victorlevasseur"
Cool update. :)
But now, how can we receive the oldstate in the signal stateChanged, or the mouse position in the mouseClick signal ?


Well when you receive an OnClick signal you can query SFML for the mouse coordinates yourself. Or am I misunderstanding something? Using SFGUI doesn't prohibit you from using SFML as usual. And regarding state change.. may I ask why you need the old state?

Quote from: "asdatapel"
so ive been looking at the examples. It looks like everything requires a window. Is it possible to do without?


Just replace your window by the widget you want to use and send it the events and and draw it every frame. You have to do that with every widget and you won't have to use a window.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Naufr4g0

  • Full Member
  • ***
  • Posts: 112
    • View Profile
SFGUI
« Reply #80 on: November 04, 2011, 09:45:39 pm »
Wow an update! :D
I can configure e generate build files, but I obtain some annoying warnings, that don't allow me to build the library (with a lot of errors)

Code: [Select]

WARNING: Target "Box" requests linking to directory "C:/sfml/sfml2".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "Button" requests linking to directory "C:/sfml/sfml2".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "Entry" requests linking to directory "C:/sfml/sfml2".  Targets may link only to libraries.  CMake is dropping the item.
...

victorlevasseur

  • Full Member
  • ***
  • Posts: 206
    • View Profile
SFGUI
« Reply #81 on: November 04, 2011, 10:01:24 pm »
It was just an example, it's useless.

What do you mind by "remove hook" ? Is this linked to the fact that I had to manage manually widgets' focus (in the previous version of SFGUI donwloaded before this update) because I don't use container ?

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
SFGUI
« Reply #82 on: November 04, 2011, 10:39:19 pm »
Quote from: "victorlevasseur"
It was just an example, it's useless.

What do you mind by "remove hook" ? Is this linked to the fact that I had to manage manually widgets' focus (in the previous version of SFGUI donwloaded before this update) because I don't use container ?


Hooking was a mechanism used internally to make sure some widgets got high priority access to certain events. It bypassed most of the hierarchical event passing and was therefore removed to clean up the library a bit.

In principle all widgets were designed to be used within some sort of container be it a window or box etc. Adding your widgets to your application one by one without use of a root container isn't recommended because as you mentioned focus changing won't get handled properly, among other things. Please try to use windows as much as you can or if you don't want a window then a box as the root widget.

Quote from: "Naufr4g0"
Wow an update! :D
I can configure e generate build files, but I obtain some annoying warnings, that don't allow me to build the library (with a lot of errors)

Code: [Select]

WARNING: Target "Box" requests linking to directory "C:/sfml/sfml2".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "Button" requests linking to directory "C:/sfml/sfml2".  Targets may link only to libraries.  CMake is dropping the item.
WARNING: Target "Entry" requests linking to directory "C:/sfml/sfml2".  Targets may link only to libraries.  CMake is dropping the item.
...


It seems like you set your SFML library file paths wrong. Instead of "C:/sfml/sfml2" you should set it to something like "C:/sfml/sfml2/lib/libsfml-window-s.a" for example (if you are using GCC). Note that it is a FILE PATH and not a DIRECTORY PATH. You have to give CMake the right path for each of the library files it needs. Hope this helps.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Naufr4g0

  • Full Member
  • ***
  • Posts: 112
    • View Profile
SFGUI
« Reply #83 on: November 04, 2011, 11:14:29 pm »
Quote from: "binary1248"

It seems like you set your SFML library file paths wrong. Instead of "C:/sfml/sfml2" you should set it to something like "C:/sfml/sfml2/lib/libsfml-window-s.a" for example (if you are using GCC). Note that it is a FILE PATH and not a DIRECTORY PATH. You have to give CMake the right path for each of the library files it needs. Hope this helps.


Ok with your suggestions I solved build files generation issue! :D
Anyway when I build the solution under VS2010 I get 8 MSB3073 errors in the file:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets
:(

Update: the issue was only examples-related (maybe). Nevertheless I obtained lib files :)

Naufr4g0

  • Full Member
  • ***
  • Posts: 112
    • View Profile
SFGUI
« Reply #84 on: November 05, 2011, 01:19:28 am »
I have another events handler in my project, executed after sfgui-related handler.
How can I prevent the canvas.HandleEvents() method is called when a sfgui event occurs?
This is a piece of my code:

Code: [Select]

   while( window.IsOpened() ) {

while( window.PollEvent( event ) ) {
// sfgui events
m_wndmain->HandleEvent( event );
// sfml window events
if( event.Type == sf::Event::Closed ) window.Close();
// canvas events
canvas.HandleEvents(event);
}

window.Clear( sf::Color::Black );
window.Draw( text );
canvas.Draw(window);
m_wndmain->Expose( window );
window.Display();
}

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
SFGUI
« Reply #85 on: November 05, 2011, 02:18:46 am »
Quote from: "Naufr4g0"

Ok with your suggestions I solved build files generation issue! :D
Anyway when I build the solution under VS2010 I get 8 MSB3073 errors in the file:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets
:(

Update: the issue was only examples-related (maybe). Nevertheless I obtained lib files :)


This should be fixed in a patch applied as soon as Tank comes around. Thanks for reporting it.

Quote from: "Naufr4g0"
I have another events handler in my project, executed after sfgui-related handler.
How can I prevent the canvas.HandleEvents() method is called when a sfgui event occurs?


If I understand you correctly, you want to prevent the event from being handled by your canvas if SFGUI made use of it, i.e. it resulted in something happening with the GUI. Because the recommended way of using SFGUI is by containing all widgets within a root widget (mostly a window or box) and sending that widget all SFML events, all you have to do is Connect() the signals you are interested in and set a flag to prevent sending the currently processed event on to your canvas when SFGUI signals that it did something.

Code: [Select]

   bool block_event = false;

   ...

   m_wndmain->OnMouseButtonPress.Connect( &SFGUIConsume );

   ... more Signal types here ...

   while( window.IsOpened() ) {

while( window.PollEvent( event ) ) {
// sfgui events
m_wndmain->HandleEvent( event );
// sfml window events
if( event.Type == sf::Event::Closed ) window.Close();
// canvas events
if( !block_event ) {
canvas.HandleEvents(event);
}
block_event = false;
}

window.Clear( sf::Color::Black );
window.Draw( text );
canvas.Draw(window);
m_wndmain->Expose( window );
window.Display();
   }

   ...

   void SFGUIConsume() {
    block_event = true;
   }


Hope I understood you correctly and was able to help.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Naufr4g0

  • Full Member
  • ***
  • Posts: 112
    • View Profile
SFGUI
« Reply #86 on: November 05, 2011, 01:36:39 pm »
Quote from: "binary1248"

Hope I understood you correctly and was able to help.


Now it works! Thanks for your valuable tips! :)
I think SFGUI have the necessary requirements to become a new standard for GUIs under SFML library. :)

asdatapel

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
SFGUI
« Reply #87 on: November 05, 2011, 07:20:45 pm »
Ive run into a problem. I cant add anything into a window becuase it gives an error
Code: [Select]
undefined reference to `_imp___ZN3sfg9Container3AddEN5boost10shared_ptrINS_6WidgetEEE'|
Also, I tried to do a button by itself but there are problems with that to. When I create a button and run in debug mode, all i get is a black screen, even if all i do is Create() it.

keyforge

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
SFGUI
« Reply #88 on: November 05, 2011, 07:47:06 pm »
I get an error unresolved external symbol public static class sf::Color const sf::Color::Black in Brew.obj
Need a place to upload your code, files or screenshots? Use SFML Uploads!

victorlevasseur

  • Full Member
  • ***
  • Posts: 206
    • View Profile
SFGUI
« Reply #89 on: November 05, 2011, 07:59:43 pm »
Compile your project with C++0x :
Code: [Select]
--std=c++0x

But, Tank said :
Quote
Please use our forum for support!

http://sfgui.sfml-dev.de/forum/