From 762278d8efdf373f93eb7f17b6ddd13e65e43fca Mon Sep 17 00:00:00 2001 From: chsieh Date: Thu, 28 Apr 2011 00:43:01 -0700 Subject: [PATCH] Game main WIP. --- Littlest.xcodeproj/project.pbxproj | 6 +++++ Littlest/Game/GameMain.h | 26 ++++++++++++++++++++++ Littlest/Game/GameMain.m | 41 ++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 0 deletions(-) create mode 100644 Littlest/Game/GameMain.h create mode 100644 Littlest/Game/GameMain.m diff --git a/Littlest.xcodeproj/project.pbxproj b/Littlest.xcodeproj/project.pbxproj index 93b507c..cae4ba3 100644 --- a/Littlest.xcodeproj/project.pbxproj +++ b/Littlest.xcodeproj/project.pbxproj @@ -170,6 +170,7 @@ 4B8CC1CB135BFEDE00B3E49F /* LittlestViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B8CC1BC135BFEDE00B3E49F /* LittlestViewController.m */; }; 4BE72E371367CCB600E8F668 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BE72E361367CCB600E8F668 /* RootViewController.m */; }; 4BE72E3D1367CE5100E8F668 /* GLES-Render.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BE72E3C1367CE5100E8F668 /* GLES-Render.mm */; }; + 4BE72E461367CF9B00E8F668 /* GameMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BE72E451367CF9B00E8F668 /* GameMain.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -520,6 +521,8 @@ 4BE72E381367CD1400E8F668 /* GameConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GameConfig.h; path = OS/GameConfig.h; sourceTree = ""; }; 4BE72E3B1367CE5100E8F668 /* GLES-Render.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "GLES-Render.h"; path = "Engine/Render/GLES-Render.h"; sourceTree = ""; }; 4BE72E3C1367CE5100E8F668 /* GLES-Render.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "GLES-Render.mm"; path = "Engine/Render/GLES-Render.mm"; sourceTree = ""; }; + 4BE72E441367CF9B00E8F668 /* GameMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameMain.h; sourceTree = ""; }; + 4BE72E451367CF9B00E8F668 /* GameMain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameMain.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1073,6 +1076,8 @@ isa = PBXGroup; children = ( 4B8CC1C1135BFEDE00B3E49F /* Scene */, + 4BE72E441367CF9B00E8F668 /* GameMain.h */, + 4BE72E451367CF9B00E8F668 /* GameMain.m */, ); path = Game; sourceTree = ""; @@ -1324,6 +1329,7 @@ 4B8CC1CB135BFEDE00B3E49F /* LittlestViewController.m in Sources */, 4BE72E371367CCB600E8F668 /* RootViewController.m in Sources */, 4BE72E3D1367CE5100E8F668 /* GLES-Render.mm in Sources */, + 4BE72E461367CF9B00E8F668 /* GameMain.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Littlest/Game/GameMain.h b/Littlest/Game/GameMain.h new file mode 100644 index 0000000..1c2c6d9 --- /dev/null +++ b/Littlest/Game/GameMain.h @@ -0,0 +1,26 @@ +// +// GameMain.h +// Littlest +// +// Created by Doris Chen on 4/26/11. +// Copyright 2011 __MyCompanyName__. All rights reserved. +// + +#import + +@class RootViewController; + +@interface GameMain : NSObject { + UIWindow* window; + RootViewController* viewController; +} + +@property (nonatomic, retain) UIWindow *window; + ++(GameMain*) createGameMain; ++(void) runWithWindow:(id)uiWindowId; + +-(void) initialize:(UIWindow*)uiWindow; +-(void) run; + +@end diff --git a/Littlest/Game/GameMain.m b/Littlest/Game/GameMain.m new file mode 100644 index 0000000..7807dd0 --- /dev/null +++ b/Littlest/Game/GameMain.m @@ -0,0 +1,41 @@ +// +// GameMain.m +// Littlest +// +// Created by Doris Chen on 4/26/11. +// Copyright 2011 __MyCompanyName__. All rights reserved. +// + +#import "GameMain.h" +#import + +@implementation GameMain + +@synthesize window; + ++(GameMain*) createGameMain { + if ( (self = [super init]) ) + { + return [[GameMain alloc] init]; + } + return Nil; +} + ++(void) runWithWindow:(id)uiWindowId { + GameMain* game = [GameMain createGameMain]; + [game initialize: (UIWindow*)uiWindowId]; + [game run]; +} + +-(void) initialize:(UIWindow *)uiWindow { + window = uiWindow; +} + +-(void) run { + bool quit = false; + while (!quit) { + + } +} + +@end -- 1.7.0.4