Browse Source

Adds buttons for iOS too

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

15
GLEssentials/iOS/ViewController.m

@ -72,6 +72,21 @@
- (void)setupGL{
[EAGLContext setCurrentContext:self.context];
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{