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

Author Topic: SFGUI (old thread)  (Read 78620 times)

0 Members and 1 Guest are viewing this topic.

panithadrum

  • Sr. Member
  • ****
  • Posts: 304
    • View Profile
    • Skyrpex@Github
    • Email
SFGUI (old thread)
« Reply #30 on: May 28, 2010, 10:21:37 am »
Quote from: "Tank"
Are you guys using Code::Blocks and/or Visual Studio? I'm looking for someone who's able to create proper project files when SFGUI is being released.


I use Visual Studio 2008-2010. I can make the projects for you :-P

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
SFGUI (old thread)
« Reply #31 on: May 28, 2010, 10:27:52 am »
I use C::B under Windows and Linux ;)
Mindiell
----

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI (old thread)
« Reply #32 on: May 29, 2010, 01:34:07 pm »
Thanks a lot, your help is very appreciated. :)

Quote
You'd have said 1-2 weeks

True, but there've been some real life issues that had to be fixed. ;) However, I think it's better that a release takes more time to just make it better than releasing in time with glitches/bugs/whatever.

Quote
Why don't you let us play with it in order to help you finding "maybe other glitches" and permitting us to advance with it ?

That has been possible since the beginning of SFGUI. Just download/clone the sources from http://github.com/TankOs/SFGUI and try it out. Keep in mind that the IDE project files are not up-to-date. So, if anyone updates those or creates new ones, please let me know so I can push them into the repository (and also tell me your name if you like for an entry in the CONTRIB file).

Windows users must pay attention at pre-processor directives: Like SFML, SFGUI also needs a defined macro when linking dynamically, namely "SFGUI_DYNAMIC".


Some words to the progress: I'm still facing the documentation, the features are almost complete, so nothing new gets added until release (only bugfixes or critical changes when any are found).

Again, thank you very much for your effort and interest, keeps me motivated. ;)

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
SFGUI (old thread)
« Reply #33 on: May 29, 2010, 06:58:24 pm »
Edit: Oops.. rewriting in english :mrgreen: .

Edit 2:

Okay. I tried to compile the whole stuff.. and I got 2 errors.

The first one is in GUI.inl line 5. I replaced std::auto_ptr with std::auto_ptr_ref. I absolutely don't know auto_ptr so I don't know whether what I did is correct.

The error message was :
Code: [Select]
/Users/ceylo/Development/sfgui/../../SFGUI/src/GUI.cpp:28:0 /Users/ceylo/Development/sfgui/../../SFGUI/src/GUI.cpp:28:   instantiated from here


/Users/ceylo/Development/sfgui/../../SFGUI/include/SFGUI/GUI.inl:5:0 /Users/ceylo/Development/sfgui/../../SFGUI/include/SFGUI/GUI.inl:5: error: no matching function for call to 'std::auto_ptr<sfg::BaseWidgetFactory>::auto_ptr(std::auto_ptr<sfg::BaseWidgetFactory>)'


/usr/include/c++/4.2.1/memory:349:0 /usr/include/c++/4.2.1/memory:349: note: candidates are: std::auto_ptr<_Tp>::auto_ptr(std::auto_ptr_ref<_Tp>) [with _Tp = sfg::BaseWidgetFactory]


/usr/include/c++/4.2.1/memory:212:0 /usr/include/c++/4.2.1/memory:212: note:                 std::auto_ptr<_Tp>::auto_ptr(std::auto_ptr<_Tp1>&) [with _Tp1 = sfg::BaseWidgetFactory, _Tp = sfg::BaseWidgetFactory]


/usr/include/c++/4.2.1/memory:199:0 /usr/include/c++/4.2.1/memory:199: note:                 std::auto_ptr<_Tp>::auto_ptr(std::auto_ptr<_Tp>&) [with _Tp = sfg::BaseWidgetFactory]


Then I got
Code: [Select]
/usr/include/c++/4.2.1/ext/new_allocator.h:107:0 /usr/include/c++/4.2.1/ext/new_allocator.h:107: error: passing 'const std::auto_ptr<sfg::BaseWidgetFactory>' as 'this' argument of 'std::auto_ptr<_Tp>::operator std::auto_ptr_ref<_Tp1>() [with _Tp1 = sfg::BaseWidgetFactory, _Tp = sfg::BaseWidgetFactory]' discards qualifiers
Same file, same line. This time I dunno what to do ^^
Note that I get this error with and without my previous change.

Otherwise, I'mma try to add functions for saving the GUI in a YAML file.

Edit 3: after some searches in your stuff, looks like the YAML classes are for read purposes only. So I'm a bit stuck... did you remove the writing part yourself or is it really read only ?
Besides, I don't understand why you do your own parsing in Skin.cpp as you have a YAML class ?
Want to play movies in your SFML application? Check out sfeMovie!

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI (old thread)
« Reply #34 on: May 29, 2010, 09:58:24 pm »
Make sure that you always pull the latest commit from the Git repository. The auto_ptr problem has been fixed some days before (got replaced by raw pointers). I used auto_ptr wrongly, but g++ didn't complain about that. ;)

Regarding to the skin definition files:
Yeah, that's still one of the "glitches" I was talking about in a previous post. There's already test code that uses YAML skin definition files. I guess that is one change that will make it into the first release (everything else would be kinda dumb: switching such a distinctive thing after a first release).

YAML can be also emitted to a file, not only read. Since SFGUI uses the yaml-cpp library, check out the proper manual page here: http://code.google.com/p/yaml-cpp/wiki/HowToEmitYAML

I won't implement emitting YAML code from widgets to SFGUI, since saving a GUI's state doesn't really belong to a GUI library, but more to a designer tool. However, it should be very easy to extend yaml-cpp to be able to save SFGUI widget's properties.

If you like, I can extend sfg::GUI by a method like "GetWidgets()" or better "GetTopWidget()" (the container that's used as the parent by sfg::GUI) to be able to get a full list of all added widgets.

Thanks for your input.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
SFGUI (old thread)
« Reply #35 on: May 29, 2010, 10:10:20 pm »
Hum.. how am I supposed to get the latest sources with an existing Git cloned directory ? I dunno whether there's something like "svn update". I actually did "git checkout" in the git repository and it looked fine so.. I thought that was it, but seems like I was wrong.

Okay, I'll let you fix this "glitch" then ^^.

As for YAML writing.. I didn't see the Emitter class, thank you !!

And as for the GUI, don't bother with this now (until you need it for yourself), I need to do some more thinking on how the UI'll be stored/loaded by the user application/designer (even considering you already support UI loading, I need to have a closer look at your work :P ).


Edit: I found "git pull" to update my files :) .
Edit 2: it now compiles fine except the linking step :) (that is because there is no SFML 2 on Mac OS X).
Want to play movies in your SFML application? Check out sfeMovie!

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
SFGUI (old thread)
« Reply #36 on: May 30, 2010, 07:08:27 am »
So.. I've had a closer look at your work and I must say it's quite comprehensive and well designed. I noticed some very simple ways to do tricky concepts :) .

I also looked at how you handle events, how you process the rendering and how you load the YAML files. From what I read, you can programmatically add widgets, and sub-widgets in these parent widgets. But your YAML loader does only support flat loading, I mean it doesn't support creating the sub-widgets. Am I wrong ?

If I'm not, is it what you wanted/chose ? Or is it because you want to keep the things simple on the YAML loader for the first release ? Or is it because you don't know for now how to represent the child-parent relationship in the YAML file ?


It doesn't look really tricky to implement but.. if you think it's better to keep this work for the next version, I'd understand. Flat hierarchy is already more than enough for simple GUIs.

Ceylo
Want to play movies in your SFML application? Check out sfeMovie!

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI (old thread)
« Reply #37 on: May 30, 2010, 09:40:08 pm »
Quote from: "Ceylo"
So.. I've had a closer look at your work and I must say it's quite comprehensive and well designed. I noticed some very simple ways to do tricky concepts :) .

Thank you! :)

Quote
From what I read, you can programmatically add widgets, and sub-widgets in these parent widgets. But your YAML loader does only support flat loading, I mean it doesn't support creating the sub-widgets. Am I wrong ?

You're right, up to now there's only a flat hierarchy possible -- but that doesn't mean it's final for the first release.

I'm currently working on this and the hierarchy will later look like this:
Code: [Select]

Widgets:
  -
    Type: Container
    Children:
      -
        Type: Container
        Children:
          -
            Type: Button
...


Implementing that is rather easy, just some recursive stuff.

Quote
It doesn't look really tricky to implement but.. if you think it's better to keep this work for the next version, I'd understand. Flat hierarchy is already more than enough for simple GUIs.

Yeah, there exist workarounds if SFGUI wouldn't be able to load deep hierarchies. But those workarounds would be annoying (loading one YAML file, then loading the children and providing the wanted widget as parent to LoadYAML()). So you can definitely count on that feature for the first release.

I hope that makes the thing a bit clearer why SFGUI won't be released in 1-2 weeks. Stuff like that still needs to be improved, and like I said, I don't want to release unfinished stuff or make compromises (or even leave bugs inside ;)).

However, thank you very much for your feedback. Don't hesitate to point out things that aren't good (or complete crap) in your eyes. I'm always thankful for opinions of other people.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
SFGUI (old thread)
« Reply #38 on: May 30, 2010, 09:52:58 pm »
Well.. I already told you all I've noticed as far as features are concerned. One other point I can think of is your code lacks some comments. You put some but not enough to my mind. It makes your code a bit tricky to understand sometimes.

And.. you already know what I told you about delegating the widget serialization/deserialization in the concerned widget's code instead of doing so in the widget factory (especially because the widget factory would become bigger and bigger as you add widgets and probably harder to maintain). But I think that's fine for now (considering the size of your library) and you should just keep that in mind for later (or convince me it's absolutely useless ^^). The other issue with this that I can think of now... is the user forgetting to update its widget factory according to his changes to the widget. That's not much but, it'd make the things easier (and I suppose your purpose is to provide an easy-to-use library :P ).

Edit: forgot to comment on the YAML file : I'd need to do real tests but it does look fine to me.

Edit 2: one point I thinked of too is not processing the YAML loading through the GUI class. I'd rather think of a specific YAML loader/writer class (just because it doesn't really fit the GUI class's role to my mind, and because it would ease my work (working both on the same class looks like a mess to me, especially if it's not required)).
Want to play movies in your SFML application? Check out sfeMovie!

Mindiell

  • Hero Member
  • *****
  • Posts: 1261
    • ICQ Messenger - 41484135
    • View Profile
SFGUI (old thread)
« Reply #39 on: May 31, 2010, 09:10:41 am »
Quote from: "Ceylo"
Edit 2: one think I thinked of too is not processing the YAML loading through the GUI class. I'd rather think of a specific YAML loader/writer class (just because it doesn't really fit the GUI class's role to my mind, and because it would ease my work (working both on the same class looks like a mess to me, especially if it's not required)).

Yes, like an interface. This would easily permit to use other file format than YAML if someone want to.
Mindiell
----

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI (old thread)
« Reply #40 on: May 31, 2010, 01:37:22 pm »
Quote from: "Ceylo"
One other point I can think of is your code lacks some comments. You put some but not enough to my mind. It makes your code a bit tricky to understand sometimes.

I put comments everywhere I had the feeling of "Okay, this can be confusing when being read in the future again". Of course other people have different feelings and didn't write the code (thus having another understanding). I'll try to keep the level up.

Quote
And.. you already know what I told you about delegating the widget serialization/deserialization in the concerned widget's code instead of doing so in the widget factory

I don't like this idea much, since widgets shouldn't be concerned with any type of serialization. That's the task of other instances. Also this would eliminate the possibility to exchange the serialization driver (or would make it at least at lot more painful to implement/increase complexity).

Quote
(especially because the widget factory would become bigger and bigger as you add widgets and probably harder to maintain).

That's something where you can't do anything against it. If you put the serialization code into the single classes, it's still there, no matter if it's  inside the widget's class or a big factory class. The advantage is however that the code is completely separated, which makes it indeed better to maintain.

One thing you could do is splitting up your custom factory code into more classes and register each via sfg::GUI::RegisterFactory(). You can even create one factory class for each custom widget *and* put the deserialization code into the widget's class if you like that approach. ;)

Quote
The other issue with this that I can think of now... is the user forgetting to update its widget factory according to his changes to the widget. That's not much but, it'd make the things easier (and I suppose your purpose is to provide an easy-to-use library :P ).

I guess that'd be a plain PEBKAC. ;) I just like the idea to have a single instance that's responsible for deserializing widgets.


Quote
Edit 2: one think I thinked of too is not processing the YAML loading through the GUI class. I'd rather think of a specific YAML loader/writer class (just because it doesn't really fit the GUI class's role to my mind, and because it would ease my work (working both on the same class looks like a mess to me, especially if it's not required)).

You're right, I'll separate the YAML loading stuff from sfg::GUI. This is easily possible, because sfg::GUI's public interface provides everything that an external loader class needs.


Good points, keep it goin'! :)

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
SFGUI (old thread)
« Reply #41 on: May 31, 2010, 04:43:57 pm »
Quote from: "Tank"
Quote from: "Ceylo"
One other point I can think of is your code lacks some comments. You put some but not enough to my mind. It makes your code a bit tricky to understand sometimes.

I put comments everywhere I had the feeling of "Okay, this can be confusing when being read in the future again". Of course other people have different feelings and didn't write the code (thus having another understanding). I'll try to keep the level up.

This is useful especially if you don't want to have to maintain SFGUI for the remaining years of your life *joke*. More seriously, it would allow people to help you more easily (and notice the bad points faster btw).

Quote from: "Tank"
Quote
And.. you already know what I told you about delegating the widget serialization/deserialization in the concerned widget's code instead of doing so in the widget factory

I don't like this idea much, since widgets shouldn't be concerned with any type of serialization. That's the task of other instances. Also this would eliminate the possibility to exchange the serialization driver (or would make it at least at lot more painful to implement/increase complexity).

Do you mean changing the way the widgets are (de)serialized ?
If I'm right.. then you should just use an abstraction layer (baaaaaah *abstraction is evil* *gets out*). Okay that's still more work (I could work on it myself), but that would fix this point.
The other reason is... imagine you have several people working on 3-4 different new widgets. Is it easier to work on the same factory widget or working only on ones part ?

Quote from: "Tank"
Quote
(especially because the widget factory would become bigger and bigger as you add widgets and probably harder to maintain).

That's something where you can't do anything against it. If you put the serialization code into the single classes, it's still there, no matter if it's  inside the widget's class or a big factory class. The advantage is however that the code is completely separated, which makes it indeed better to maintain.

Yes you can !! *reminds me of something..*
As you say "The advantage is however that the code is completely separated, which makes it indeed better to maintain." : that's exactly what I wanted to point out. You cannot prevent the library from growing, but you can prevent developers from having to work on big factories => don't care about what have been done before and just focus on one thing.

Quote from: "Tank"
One thing you could do is splitting up your custom factory code into more classes and register each via sfg::GUI::RegisterFactory(). You can even create one factory class for each custom widget *and* put the deserialization code into the widget's class if you like that approach. ;)

And you get closer and closer by the idea of registering each class to be able to use a standardized (de)serialization process :) . The idea is.. as soon as a class implements the “serializable” interface, it'll be registered in the SFGUI runtime handler/global widget factory/whatever you want (let's call it Lily). And as soon as it is registered, the YAML loader (or any other format loader) knows it can look for Lily and ask her to (de)serialize the widget. Then Lily just has to use the provided interface to do her job.
(thank you Mindiell for the interface idea btw ^^)

Quote from: "Tank"
Quote
The other issue with this that I can think of now... is the user forgetting to update its widget factory according to his changes to the widget. That's not much but, it'd make the things easier (and I suppose your purpose is to provide an easy-to-use library :P ).

I guess that'd be a plain PEBKAC. ;) I just like the idea to have a single instance that's responsible for deserializing widgets.

PEBKAC is everywhere ^^, and you'll need more than a "I just like the idea" to convince me :-° *gets out before getting whipped*


Quote from: "Tank"
Quote
Edit 2: one think I thinked of too is not processing the YAML loading through the GUI class. I'd rather think of a specific YAML loader/writer class (just because it doesn't really fit the GUI class's role to my mind, and because it would ease my work (working both on the same class looks like a mess to me, especially if it's not required)).

You're right, I'll separate the YAML loading stuff from sfg::GUI. This is easily possible, because sfg::GUI's public interface provides everything that an external loader class needs.


Good points, keep it goin'! :)

I'll try to do so, thanks!
Want to play movies in your SFML application? Check out sfeMovie!

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
SFGUI (old thread)
« Reply #42 on: May 31, 2010, 07:41:55 pm »
Quote from: "Ceylo"
This is useful especially if you don't want to have to maintain SFGUI for the remaining years of your life *joke*. More seriously, it would allow people to help you more easily (and notice the bad points faster btw).

Yes, said nothing against it. So again: I'll try to keep the level up. :)

Quote
If I'm right.. then you should just use an abstraction layer (baaaaaah *abstraction is evil* *gets out*). Okay that's still more work (I could work on it myself), but that would fix this point.
The other reason is... imagine you have several people working on 3-4 different new widgets. Is it easier to work on the same factory widget or working only on ones part ?

Abstraction isn't a problem, since there's already a lot of it in the library (else it wouldn't be flexible enough). When more people are working on widgets, it depends on their personal strategy how they behave. I myself would go with one class and a good source code management system, but that depends. :)

Quote
As you say "The advantage is however that the code is completely separated, which makes it indeed better to maintain." : that's exactly what I wanted to point out. You cannot prevent the library from growing, but you can prevent developers from having to work on big factories => don't care about what have been done before and just focus on one thing.

That counts for both possibilities: One thing as in one factory or as in each widget.

Quote
And you get closer and closer by the idea of registering each class to be able to use a standardized (de)serialization process :) . The idea is.. as soon as a class implements the “serializable” interface, it'll be registered in the SFGUI runtime handler/global widget factory/whatever you want (let's call it Lily). And as soon as it is registered, the YAML loader (or any other format loader) knows it can look for Lily and ask her to (de)serialize the widget. Then Lily just has to use the provided interface to do her job.

Yeah, I know what you mean. That's comparible with serialization frameworks (like the Boost one, for example). Of course it's a neat thing, I'm just curious if that fits into the current design. I must admit that I'm at least thinking about it, so I guess it's 1:0 for you. ;)

Quote
PEBKAC is everywhere ^^, and you'll need more than a "I just like the idea" to convince me :-° *gets out before getting whipped*

Well, the argument that someone just forgets something isn't very strong, too. :)

And by the way, don't hesitate to push out your ideas/thoughts. That's the benefit Open Source has over other software. And I'm not the person that gets pissed, so there's no reason to hang back. :)

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
SFGUI (old thread)
« Reply #43 on: May 31, 2010, 08:28:50 pm »
Quote from: "Tank"
Quote
PEBKAC is everywhere ^^, and you'll need more than a "I just like the idea" to convince me :-° *gets out before getting whipped*

Well, the argument that someone just forgets something isn't very strong, too. :)

Mmmh... to sum up my reasons :
 + several user could work on several new widgets without messing up each other (but registering each class with a particular factory also solves this issue)
 + very little to add in order to make ones own widget serializable (I was doing a concrete example in the meantime and I'm gonna show you this soon)
 + restrained mistakes possibilities (=> see sample soon)
 - looks like there are some restrictions due to C++ "staticness" (=> see sample too)


=============
I finished the sample draft and I'm rather... disappointed (my method is heavy and doesn't look to have a lot of interest)

What I note is... the "very little to add" is also true with your way, and I can't find where the "restrainted mistake possiblities" happens. Oh yeah.. I found the difference : you don't have to call RegisterFactory *greaaat*. That's all. Disappointing.

Maybe there are some other advantages but I can't notice them for now.

Here is the draft : Serializable.hpp
Want to play movies in your SFML application? Check out sfeMovie!

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
SFGUI (old thread)
« Reply #44 on: May 31, 2010, 11:02:17 pm »
A short hint:
Code: [Select]
virtual const std::string className()
{
// using accessor to get the class name because
// there doesn't seem to exist any other reliable way
// typeid->className()'s result depends on compilers and I do not know any other way with C++
return "SampleWidget";
}

When all C++ compiler and runtime abstraction facilities fail, there's still the preprocessor to save you. :)
Code: [Select]
#define SFGUI_CLASSNAME(CLASS)        \
virtual const char* ClassName() const \
{                                     \
    return #CLASS;                    \
}

By the way, Tank, if you have already used Boost, might not the library Boost.Serialize be an option? At least, it contains some interesting concepts.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything