Jump to content

  • Log In with Google      Sign In   
  • Create Account

2d Game Creation

Component Manager and GUI

Posted by , 10 October 2013 - - - - - - · 618 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.


Beginnings

Posted by , 10 October 2013 - - - - - - · 556 views

I have started and abandons/restarted so many games/engines. Every since third grade, multitude of languages (QBasic, Visual Basic, C++, Java). I think in 20 years, I have completed 3 games (Tic Tac Toe, Dodger (a simple space craft moving right faster, astroids), and a simple 2d fighter). For the last 9 years I have restarted the same 3d engine with custom 2d GUI in opengl. Dont get me wrong, every time I restarted, I got farther and caught back up to my previous point with better code. It is really sad to realize how much time has gone by without finishing anything though.

So I am going to create a 2d game, but use skeletal animations. I want it a version on Android and PC.

So good luck to me.





October 2013 »

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  

Recent Entries

Recent Comments