SFML community forums

General => SFML projects => Topic started by: pamaury on June 28, 2008, 07:10:59 pm

Title: An simple immediate mode GUI with SFML
Post by: pamaury on June 28, 2008, 07:10:59 pm
Hello,
I've discovered few months ago what an immediate mode gui was(see http://sol.gfxile.net/imgui/ for an introduction) and wondered how easy it really was to implement some basic controls. Here is the result of my try. I've coded a very simple gui using this paradigm entirely with SFML(I'm not using any Opengl code, only shapes and text) with the following controls:

All those controls except the static text have basic support for keyboard focus using the Tab and Alt-Tab combinasion and the Space key to action it(button and check box only) and arrows for movements(list and edit).
Furthermore, you can customize the colors of the controls even if it's not really explained in the code(see the source to understand how it works). I think the code is sufficiently commented to be understood(the header is commented for Doxygen even if there few places where its unfinished).

They are still some things that are not perfect(some come from the immediate mode paradigm) but I've tried to make it as usable as possible. I don't really have time to maintain it because so I post the as-is, feel free to copy and modify it if you want.
Here is a screenshort:
(http://amaury.pouly.free.fr/Public/utgui.PNG)
And here is the code(the header is 400 lines long and the code is 1200 lines long)
http://amaury.pouly.free.fr/Public/SfmlIMGui.zip

I would also appreciate some feedbacks.
Title: An simple immediate mode GUI with SFML
Post by: Xylankant on June 28, 2008, 08:39:10 pm
hey pamaury,

this project seems interesting to me, however, if I try compiling the code (I'm using Code::Blocks as well), it says "cannot find -lfreetype"

What is that library?
is it from the freetype2-project?
would I have to install the whole freetype2 windows binaries?

hope you know, what I mean ^^
Title: An simple immediate mode GUI with SFML
Post by: pamaury on June 28, 2008, 09:42:05 pm
Well, SFML uses freetype to render some text so if you using the dll version of SFMl, just suppress this line. However, if you using the static version of SFMl, you need the binary but I think it is included in the SDK in the external dependencies folder.
Title: An simple immediate mode GUI with SFML
Post by: Xylankant on June 28, 2008, 09:57:24 pm
ok, thx, I've tried it.

works fine here!
Title: An simple immediate mode GUI with SFML
Post by: dabo on June 29, 2008, 12:14:45 am
Great job, I'm gonna check it out.
Title: An simple immediate mode GUI with SFML
Post by: Laurent on June 29, 2008, 07:09:16 am
Very nice job :)

Why don't you put it on the wiki ? There's a project category for this kind of contributions.
Title: An simple immediate mode GUI with SFML
Post by: pamaury on June 29, 2008, 07:44:40 am
Thx,
I'll perhaps do it later, I'm going to Paris for 3 weeks and I'm not sure to have an internet access so I will put it on the wiki in 3 weeks.
Title: An simple immediate mode GUI with SFML
Post by: eleinvisible on July 01, 2008, 10:32:19 pm
Very impressive... I suppose I'll just copy and paste this into the wiki then for you? Alright added it under Projects -> Extensions -> simple_imgui
Title: An simple immediate mode GUI with SFML
Post by: Andershizzle on September 05, 2009, 08:02:52 am
Any idea why setting the RenderWindow to fullscreen breaks this? Well it works but hangs and crashes on exit.
Title: An simple immediate mode GUI with SFML
Post by: wallytsx on February 11, 2011, 10:36:14 pm
Hello, can anybody post again the code of this gui please.
thanks