Adds buttons for iOS too
This commit is contained in:
parent
647265895f
commit
eed30d9f12
1 changed files with 15 additions and 0 deletions
|
@ -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{
|
||||||
|
|
Reference in a new issue