SFML community forums
General => SFML projects => Topic started 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:
button: a push button which display some text
scrollbar: a scrollbar(horizontal and vertical) which supports mouse and wheel movements
textfield: a single line edit text field(can be read-only) which support mouse clicking(but no selection) and some useful shortcuts like end or home
statictext: can display some text without any interaction
checkbox: a two state checkbox which displays some text
listbox: a list box with an automatic scrollbar if necessarywhich support mouse wheel and keyboard
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.
-
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 ^^
-
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.
-
ok, thx, I've tried it.
works fine here!
-
Great job, I'm gonna check it out.
-
Very nice job :)
Why don't you put it on the wiki ? There's a project category for this kind of contributions.
-
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.
-
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
-
Any idea why setting the RenderWindow to fullscreen breaks this? Well it works but hangs and crashes on exit.
-
Hello, can anybody post again the code of this gui please.
thanks