Game GUIs

Started by
53 comments, last by sakky 21 years, 1 month ago
you could simplify your formula to:
currentValue = (max*tabX)/width;

and then scale it to the scale you want:
currentValue = ((max*tabX)/width)*(rangeHI-rangeLO)+rangeLO;



hey, since my GUI thread disappeared without even one reply (what, is there something hanging outta my nose or something?), i'm going to piggy-back.

i am working on an OpenGL GUI (partly because of this thread, and partly because i need a break from my other project), and i am curious whether it is better to use picking (as described in the NeHe tutorials), or just calculate which window the mouse is in based on the mouse coordinates and some regions defined in the window (i.e. check if the mouse (x,y) are within a window's boundary rect, and if it is check if it is within the rendered (not masked) area).

i am leaning towards calculating based on the mouse position, unless someone can point out some great benefits to using polygon picking.

[edited by - krez on February 14, 2003 3:31:30 PM]
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
Advertisement
thank you! though i had to fumble with it a little, but it''s still pretty much the same thing:

currentValue = ((tabPosition*maxValue)/w) * ((maxValue-minValue)/maxValue) + minValue;


as for your question, myself i just check using the mouse position and the bounds of the windows/objects. I don''t really see how picking would be better suited as it seems to me that it would be just more work. and if your drawing your gui in ortho, doesn''t that kind of defeat the purpose of picking in the first place? i don''t know much about it myself, so i may be completely wrong.

thanks again,
Scott


------------------------------------------------------------
Email
Website

"If you try and don''t succeed, destroy all evidence that you tried."
------------------------------------------------------------
I see I''m not alone developing a gui.. I made it in directx 8 tho. So far I have windows, lists, editboxes, textboxes, buttons, labels, checkboxes and sliders which can be binded to buttons as well as comboboxes.. They are all used in a top-down racing game about 60% finished.

That slider tabcalculation is a real pain in the ass. Maybe your formula works better than mine.
I also used the mouses position against the window/oject rects... I don''t see to major of an advantage to using picking, and it WILL be MUCH slower on lower hardware with picking, while checking mouse coords against rectangles takes practically nothing (much less than picking would take).
quote:Original post by wojtos
currentValue = ((tabPosition*maxValue)/w) * ((maxValue-minValue)/maxValue) + minValue;


I'm not really understanding the parentheses there, so I'm going to simplify that:
currentValue = (tabPosition/w)    * (maxValue-minValue)          + minValue;               fraction of slider * range of values represented  + offset value  


Ahh, makes much more sense now



______________________________

And the Phoenix shall rise from the ashes...

--Thunder_Hawk -- ¦þ
______________________________

[edited by - Thunder_Hawk on February 16, 2003 4:12:55 PM]
______________________________________________________________________________________The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ"So. Any n00bs need some pointers? I have a std::vector<n00b*> right here..." - ZahlmanMySite | Forum FAQ | File Formats______________________________________________________________________________________
oh, well that''s much easier thank you.

I haven''t been able to play with it much more since... i''m on my spring break, so i came home for the week without my computer
I still need to figure out how to make a GUI. I need one for a D&D game. I have a few ideas, but I think I can try to figure out how sertain controls would pass messages, but I need some source code because I''m having a hell of a time trying to figure it out.

I keep thinking about using MFC and overiding a control''s paint method. I would just paint the control with GL instead of GDI. This seems alot better because I don''t have to worry about message functions. I just need to wory about coloring the controls.
Take back the internet with the most awsome browser around, FireFox
quote:Original post by sakky
Hey all, i know the conversation took a different turn, just wanted to throw my GUI up there, see if anyone liked it.
I have it built into a Particle editor, so you can play with stuff.
Particle Editor 0.0a


~Main

==
Colt "MainRoach" McAnlis
Programmer
www.badheat.com/sinewave


This is what I''m talking about. You used small images to build your GUI instead of trying to draw it all out. That''s what I want to do with MFC and OpenGL. I no longer use WIN32 because it''s against my religion. I only use the power of C++ with MFC.

I want to see you’re messaging code please I like you GUI and the particle engine. Both of those I would like to do. Buy my particle engine sucked. It’s not a good as yours.

Dear Matthias, I''m trying to make E-Tools and other gads of toys.
Take back the internet with the most awsome browser around, FireFox
I think I know were I''m going to start. I''m going to use a linked list for the gui. I can make a few classes for window and other usefull things. I need a linked list to tell if there ary any windows to check messages for. Then I just draw the rectangle or what ever in the correct position. How ever I''ve still not got OpenGL to draw in 2D correctly. Do any of you have any actualy working code of OpenGL in 2D that I can see?
Take back the internet with the most awsome browser around, FireFox
NeHe''s Tutorial #21 explains how to set up the orthagonal viewport (i.e. 2D, no perspective), although the program in the tutorial uses lines, not quads or triangles. but, it should get you started, and you can easily replace the rendering stuff with your quads/triangles and textures.
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])

This topic is closed to new replies.

Advertisement