How to make my own gui using opengl and SDL and C++ or whateva? :)

Started by
14 comments, last by H3g3m0n 12 years, 7 months ago
hello im a novice at programming tired of crap and wanting to be less crap by creating things that i can work with but for me too do that i need to know where to start because everything is so dam non logical in the world of coding when theres no explanations or tutorials simplfied word by word on how to do what i want

so im assuming you want to know what i want :P

well this is it

How do i make a Graphical User interface that works ontop of OpenGL and SDL ?

no i do not want to use GLUT or freeGLUT or CEGUI or AntTweakBar

i want to make my own :)

And where did you find information on it because i cant find anything using google ("bet people do that to make it more harder for programmers") * coughs

and i dont want to hear how complex it is ,etc i just want somewhere to start that will give me anuff know how to do it for myself thanks
i really tryed hoping that i didnt have to ask but i guess theres no where else to go so

i aslo wanna state that i learn by learning word for word :) not from massive statements with comments which is just not flexible anuff imo

and ! :D i may sound like i dont know what im doing and thats because i do im guesser / reader :D it works

also i dont want to sound like im bashing just annoyed :)
Advertisement
first you need to make objects such as buttons and menus.
If you're just doing this in SDL, you can blit these to the screen and when you flip the screen they will appear.
If you're using opengl with SDL, you need to make objects/plates and display them in ortho mode.

If you don't know what I am on about, you should learn SDL and OpenGL and it will all become clear.

so i create a class with a bunch of objects in it using what win32? :) or something else what do i use

so i create a class with a bunch of objects in it using what win32? :) or something else what do i use


For simple things like buttons you really only need to draw a textured quad , change the texture when the mouse moves over that quad or when you click on it (up to you how advanced you want it).

You don't need anything other than SDL (for mouse and keyboard events) and OpenGL (for drawing) to make your GUI.

More advanced controls are obviously more complex and a complete GUI system with customizable controls is a huge undertaking. (Most games don't really need a complete GUI system though, most will do just fine with a few buttons, sliders and input boxes)
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
* You have to define what principles the GUI should follow: A traditional point-&-click GUI? A crossing based GUI? A ZUI? Or what else ...

* A UI does not only consist of a graphical front-end but also has to deal with user input. What input devices do you want to support? Some principles expect a particular kind of input device to be in use.

* Decide what kinds of "widgets" (or whatever the building blocks will be) you need to support.

* Shall internationalization be supported? Which text systems shall be supported?

* Clarify how the UI affects the application data model and how it is supported to read from the data model as well. Do you want to use data binding? Callbacks? Delegates? Signals and slots? Events?

* Shall the GUI be resolution independent?

* Shall the GUI support theming as is often desired (for GUI middleware) for games?

* Shall the GUI be animatable as is often desired for games?

* Shall the GUI (or at least input) be run in an own thread to be e.g. responsive independently on the frame rate? (Okay, this is really advanced ;))


All this (and probably more) has an influence on answering the OP. "Making" a GUI in the sense of rendering is far after planning it.
il go the opengl route then :) be much funner that way as well
I would suggest some gui coding in java; you'll have better luck rolling your own gui components oce you've seen how they implement theirs.

"It's like naming him Asskicker Monstertrucktits O'Ninja" -Khaiy

Experience of application GUI programming is certainly a good idea, to see how toolkits should be properly implemented - though he might as well try something in the language he's using rather than (possibly) learning a whole new one. For example, for C++, I'd recommend Qt.

http://erebusrpg.sourceforge.net/ - Erebus, Open Source RPG for Windows/Linux/Android
http://conquests.sourceforge.net/ - Conquests, Open Source Civ-like Game for Windows/Linux

I would also recommend to first see how other GUI systems are implemented and then try to roll your own. I'm currently doing the same thing, mostly borrowing concepts from Qt and WPF.

You basic block would most likely be a Widget or Control which has several parameters (position, size, etc.. come in mind). I would keep the inheritance hierarchy very small (most widgets directly inherit from widget in my case) and perfer composition instead. Depending on your needs this will be a huge amount of work (I'm currently two weeks in and have a plan for at least another month of work).


hello im a novice at programming tired of crap and wanting to be less crap by creating things that i can work with but for me too do that i need to know where to start because everything is so dam non logical in the world of coding when theres no explanations or tutorials simplfied word by word on how to do what i want

so im assuming you want to know what i want :P

well this is it

How do i make a Graphical User interface that works ontop of OpenGL and SDL ?

no i do not want to use GLUT or freeGLUT or CEGUI or AntTweakBar

i want to make my own :)

And where did you find information on it because i cant find anything using google ("bet people do that to make it more harder for programmers") * coughs

and i dont want to hear how complex it is ,etc i just want somewhere to start that will give me anuff know how to do it for myself thanks
i really tryed hoping that i didnt have to ask but i guess theres no where else to go so

i aslo wanna state that i learn by learning word for word :) not from massive statements with comments which is just not flexible anuff imo

and ! :D i may sound like i dont know what im doing and thats because i do im guesser / reader :D it works

also i dont want to sound like im bashing just annoyed :)


There are a few ways of doing this. The level of complexity and the amount of work that goes into it depends on what features you want. What will your GUI consist of? Screens, buttons, labels, and toggle switches are simple to implement yourself.

Think up a couple of use cases.
Don't thank me, thank the moon's gravitation pull! Post in My Journal and help me to not procrastinate!

This topic is closed to new replies.

Advertisement