How to create a Clickable Button?

Started by xJan45x, October 13, 2014, 21:07:31

Previous topic - Next topic

xJan45x

Hello,
I Development a 3D Survival Game(like Minecraft). I like a startMenu with Buttons Example:(Start Game, Options, Exit). I don't know to create a clickable button. And on Youtube I find nothing.
People can help me? Please?
(Sorry, for my bad English i come form Germany(Deutschland). And my English is not prefect)

Cornix

This has nothing to do with OpenGL.
OpenGL is used to render primitives. GUI components, like buttons, labels, etc, are all at a much higher level of abstraction. You usually need to program these kinds of things yourself.
One way might be to get the mouse coordinates and check whether they are within a certain area when a mouse button is pressed.

xJan45x

ok, thank you!
Do you maybe have an example code for it?

abcdef

1) Read up on how to draw 2D objects on the screen using opengl (Plenty of these on the net, port to LWJGL if required)
2) Learn how to read mouse and keyboard events (http://www.lwjgl.com/wiki/index.php?title=LWJGL_Basics_2_(Input))
3) Combine 1 and 2 to build a button

or

Use an existing library

http://twl.l33tlabs.org/
http://nifty-gui.lessvoid.com/