-(void) doStateChange: (Class) state;
As the name of the function states this function changes the current state. In the source code GameState.h file we have the following:
#import
We implement the framework "Foundation" we need this framework to "...include classes for objects representing basic data types, collections, and operating-system services." according to apple documentation.
#include "GameStateManager.h"
We are going to need to call the GameStateManager to use it in our source code .m functions.
@interface GameState : UIView
{
GameStateManager* m_pManager;
}
An interface class GameState that inherits from UIView which creates a Game State Manager pointer to use with initWithFrame: function. UIView "provides common methods you use to create all types of views and access their properties...The UIView class provides a number of methods for managing the view hierarchy." For the moment we need the UIView to manage one view, later on we will continue discussing how UIView different subviews.
-(id) initWithFrame: (CGRect)frame andManager:(GameStateManager*)pManager;
-(id) according to apple documentation id "is a pointer to an instance of a class." Overall the documentation of -(id) initWithFrame: (CGRect) frame "initializes and returns a newly allocated view object with the specified frame rectangle." Later we just pass the newly created pointer for the GameStateManager to change states.
-(void) Render;
-(void) Update;
These functions declaration do not return a value and does not accepts any parameters or variables to be use. Simply call Render and Update function which we will discuss in our analysis in our main source code .m. Here is the complete GameState.h source code:
//
// GameState.h
// TropicalHeat
//
// Created by Julio Cruz. on 3/28/10.
// Copyright 2010 Red Fox Software. All rights reserved.
//
#import
#include "GameStateManager.h"
@interface GameState : UIView {
GameStateManager* m_pManager;
}
-(id) initWithFrame:(CGRect)frame andManager:(GameStateManager*)pManager;
-(void) Render;
-(void) Update;
@end
Julio A. Cruz
No comments:
Post a Comment