[SDL] Making a GUI system in SDL

L-28C kixdemp at gmail.com
Tue Feb 12 23:08:14 PST 2008


Thanks all! I'll be using the first method for now. =)

Andre Krause wrote:
> you can avoid any form of callback troubles of you go the route of
> 
> "immediate mode gui" - IMGUI
> 
> http://sol.gfxile.net/imgui/
> 
> https://mollyrocket.com/forums/viewforum.php?f=10
> 
> on molly rocket, there is also a video tutorial.
> 
> imguis are the way to go if you want a quick solution and if you want to save a 
> lot of time.
> 
> but if you are hardcore and have lots of time to waste, just go on and design 
> "yet another gui system".
> 
> if not, you might also rather use guichan, crazy eddies gui , agar , fltk, ... 
> just browse this mailing list a bit.
> 
> L-28C wrote:
>> Hello everyone!
>>
>> My system works like this:
>>
>> Control (base class)
>>   -- GUI (control container)
>>   -- Button (sample control)
>>   -- ...other controls
>>
>> And the event system works like this (in this case we'll use mouse 
>> clicks): the main application calls the "OnClick()" method in the GUI 
>> class with the mouse pointer's position as a parameter. The GUI class 
>> then sees which control was clicked (based on the mouse's position), and 
>> calls the "OnClick()" method in that control (in this case we'll use a 
>> button). But here's the problem; how can this control (button) class let 
>> the main application know that it was clicked?
>>
>> I tried to place a function pointer called "m_pfnOnClickEvent" and let 
>> the main application set a function to it when it creates the button... 
>> but C++ doesn't let you put member methods onto function pointers, and 
>> my program is 100% object-oriented.
>>
>> Any ideas? Thanks!
>>
>> _______________________________________________
>> SDL mailing list
>> SDL at lists.libsdl.org
>> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>>



More information about the SDL mailing list