Hi,
I'm a C--/Java programmer, not necessarily very experienced.
I mainly created GUI-based applications and this is my first time trying to make a game, or an application that is constantly in a loop.
I've looked for about a week trying to figure out how I should start with, but most of them are dated, looking totally different from the template I start with when I create a new project on Xcode.
I can start programming on my own when the base is complete, so I really want to ask for your help on the start.
I'm trying to make a 2D game using OpenGL ES 2.0. As this is my learning experience, I wish not to use other engines like Cocos2D. My template is an OpenGL ES application and I would like to start from it.
I just want to ask few questions. I'm pretty sure this is nothing for experts so please help me get through this...
Here is what my application would look like, but I have no idea
where and how I should implement following algorithms into the template.:
//I have no idea where I should put this piece of chunk:
superclass.gameLoop
{
currentGameState.manageUserInput();
currentGameState.controlGameLogic();
currentGameState.render();
drawRenderedGraphics();
}
Where do I put that algorithm?
There are ViewController, EAGLView and AppDelegate.
In which one and what method should I start putting my main code like gameLoop?
How do I use UI objects into OpenGL view?
For example, I would like to do all the drawings on OpenGL, but since it's a game I need to put buttons and other UI objects into the screen.
I tried putting the following code:
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(100, 170, 100, 30);
[button setTitle:@"Button" forState:UIControlStateNormal];
into - (void)drawFrame from TestAppViewController.m, but I know it's wrong.
If I add that code into like "- (void)viewWillAppear

BOOL)animated", the button will be functional, but there would be some cases that I will draw images on them.
Also how can I animate them, like moving their coordinates?
My game will have different states (or game screens) which will function differently.
Each state will have a class of its own in a following structure:
//Each state will inherit this class.
gameStateClass
{
- render
- controlGameLogic
- manageUserInput
}
I know what AppDelegate does, but I'm not sure where I should put all the codes that should be in the super class.
Like current game state information, changeState method and all those kinds of things.
Do I usually need one ViewController if I'm going to have different states or is it something that I need it for each view (state)?
I've read a lot of documents, books and even the Apple Developer Library, but I couldn't understand it clearly.
Sorry I have many questions, but it would be SO GREAT AND THANKFUL if anyone can help me through this.
Thank you so much in advance.