Jump to content

  • Log In with Google      Sign In   
  • Create Account






Component Manager and GUI

Posted by JD_Rushing, 10 October 2013 · 425 views

GUI
So my custom GUI uses an inherited 'GUIObject.hpp'. They are then kept in a std::Vector of pointers. I have a ComponentManager that handles different screens/frames (however you want to look at it), the ComponentGui (cGui), and Component2d (c2d). Both cGui and c2d are 2d components, but the latter is going to handle the 2d objects and animations.
This time around, I am making sure every object has a constructor, a copy constructor, and an =operator override. Now obviously when translating from c++ to java for android, there will be changes. But a lot of use of the GUI is for the model/scene creation, and not the game itself.
The GUI before used to use mouse coordinates, a combination of left, middle, and right buttons as function parameters that is sent to the first GUI that the mouse coordinates were inside. The order of checking was determined by controlOrder, a vector variable that held a string and integer. It kept the position of guiObject[], and the type of object it was. I used a variable to order my controls and screens versus reordering the original vector because that seemed like the more efficient code. Changing the order of a complex variable would theoretically take more time than to change a variable that held an integer and string.
This time around, I am still using controlOrder to keep track of the drawing order. But, I am making sure that each guiObject[] has a Draw and a DrawPick function. The pick function takes one of its parameters as a pick color value. That value is then drawn in place of its normal color/texture value. I then use the glReadPixels to read a pixel value off the screen at the mouse coordinates.

R = Type. Is this a GUI_TYPE, a C2D_TYPE, SCREEN_TYPE (0 left as nothing for R)
G = Index1. Which GUI, C2D, SCREEN
B = Sub-Index. Which GUI Component, C2D Component, SCREEN part (control box, frame);

So far, this will limit me to 255 types, 256 indices, and 256 sub-indices. I am pretty sure I won't cry over limiting myself to 256 2d Objects on screen.

I have read so many articles, I couldn't tell you where I read how to do some of these things.




July 2014 »

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728 29 3031  

Recent Entries

Recent Comments

PARTNERS