Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

User Interface

This topic is 5587 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

Hi, I''m creating a billiard game in OpenGL and VC++. I would like to know how to create a User Interface apart from using the GLUI lib. Thx

Share this post


Link to post
Share on other sites
Advertisement
so you want to do it all yourself? i hope you dont need more than buttons, edit fields and text (and know about function pointers).

a button could look like this:

vec2d position (upper left corner), width, height, texture (or textures for normal, pressed, mouse over), click-function etc..

your gui could check if your cursor is above an element. if so i would set a selected element pointer to it. if the mouse moves, check if its still above that element. if not, deselect it and check the rest. if its clicked call the click-function (for edit fields you might want a changed-function or return-pressed-function whatever... and of course it should have a string).

and i prefer to store everything as value between 0 and 1, so all positions and sizes are relative to the screen and it wont wander into the upper left part of the screen in a higher resolution. of course extreme differences like 320x200 and 1600x1200 might require different textures to look good. for longer texts you might want to implement a system to wrap the text, so it will make use of the fact that higher resolutions offer more space (and not just increase the font size). but those are details i wouldnt worry about yet ,-)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!