Advertisement

Colored Menus

Started by August 27, 2004 02:59 AM
4 comments, last by Zakyrus 20 years, 2 months ago
I am trying to figure out a simple way to make menus(GLUT) have backround color, text color, and different fonts. Can this be done simply or would I have to write some kind of structure. Also, can menus be done without the use of GLUT, so that I can eliminate any GLUT dependencies? -Zakyrus
Quote: Original post by Zakyrus
I am trying to figure out a simple way to make menus(GLUT) have backround color, text color, and different fonts. Can this be done simply or would I have to write some kind of structure. Also, can menus be done without the use of GLUT, so that I can eliminate any GLUT dependencies?

-Zakyrus


Of course you don't need GLUT!
GLUT only makes live for easier for the ones who has a rough time...
I, for one, have never used GLU, GLUT, GLAUX or whatever the rest is called and will probaly also never do it (if I have the option)...
Many of the functions are so obvious easy to do yourself and the rest is just a challenge (many are small)!
For example gluOrtho2D, why not use glOrtho?
The exe will also be smaller and your code will also be faster if you think about it ones or twice before implementing it...
The menus are just drawn quads or 2 tris with glColor, texture or blending attached, and then some cursor checking in the WM_LBUTTONDOWN.
Font can be done either with your own bitmap font and code or using Windows fonts and Windows font blitting which is slower (not noticeable with small areas of text) than most homemade codes.
NeHe has some font tutorials, which will teach you the two methods I mentioned.
Killers don't end up in jailThey end up on a high-score!
Advertisement
some people can use glut not only if they want an easier life but you can also build your own GUI on top of GLUT. also using GLUT is cleaner, probably faster and is cross platform(linux, mac etc etc)
heh
OK, I created a quad and added textures, how do I do a cursor check?
Quote: Original post by Zakyrus
OK, I created a quad and added textures, how do I do a cursor check?


What exactly do you mean? You can make a POINT cursor; variable which picks up mousemoving in WM_MOUSEMOVE via the lParam.
Another method is to call GetCursorPos(POINT*) in your gameloop, but the first is faster, since WM_MOUSEMOVE only updates the position when the cursor moves, whereas the other updates the cursor position every frame, even if the cursor hasn't moved since last position.

Then you can just do a bounding-box collision check, search if you don't know how...
Killers don't end up in jailThey end up on a high-score!
Ok, btw if I do use GLUT menus how can i customize the font, backroundcolor, textcolor and textbackround color? I think that would be much simpler than using quads with mouse detection, I don't really need anything too fancy but I searched all over the next and can't find very much on menus and OpenlGL.

-Zakyrus

This topic is closed to new replies.

Advertisement