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.