-
Notifications
You must be signed in to change notification settings - Fork 1
/
GESingleViewGame.m
41 lines (34 loc) · 929 Bytes
/
GESingleViewGame.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// GESingleViewGame.m
// BallStack
//
// Created by Adam McDonald on 11/9/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
// Class for games that only need to manage a single game view.
#import "GESingleViewGame.h"
#import "GEGameViewController.h"
@implementation GESingleViewGame
@synthesize gameViewController;
- (id)initWithFrame:(CGRect)frame managedByGameViewController:(GEGameViewController *)aController {
if (self = [super initWithFrame:frame]) {
// Setup
self.gameViewController = aController;
}
return self;
}
- (void)drawRect:(CGRect)rect {
// Iterate layers
NSMutableArray *layers = [gameViewController layers];
for (id layer in layers) {
// Iterate contents of layers
NSMutableArray *contents = [(GELayer *)layer gameObjects];
for (GEGameObject *gObj in contents) {
if ( [gObj visible] ) [gObj draw];
}
}
}
- (void)dealloc {
[super dealloc];
}
@end