Sign in to follow this  

Colored Menus

This topic is 4844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

This topic is 4844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this