Browse Source

Adds buttons for iOS too

master
Joshua Moerman 11 years ago
parent
commit
eed30d9f12
  1. 15
      GLEssentials/iOS/ViewController.m

15
GLEssentials/iOS/ViewController.m

@ -72,6 +72,21 @@
- (void)setupGL{ - (void)setupGL{
[EAGLContext setCurrentContext:self.context]; [EAGLContext setCurrentContext:self.context];
game = [[Game alloc] init]; game = [[Game alloc] init];
CGFloat x = 20;
CGFloat y = 20;
for (NSString * a in game.actions) {
UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(x, y, 200, 22)];
[myButton setTitle:a forState:UIControlStateNormal];
[myButton addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview: myButton];
y += 22;
}
}
- (void) action:(UIButton*) sender{
[game action:[sender titleForState:UIControlStateNormal]];
} }
- (void)tearDownGL{ - (void)tearDownGL{