リビジョン | 338aa963b202b2527e2758961095be599549b2db (tree) |
---|---|
日時 | 2023-03-02 17:04:11 |
作者 | sebastian_bugiu |
コミッター | sebastian_bugiu |
Added onScreenKeyboard.
@@ -17,5 +17,7 @@ | ||
17 | 17 | void pause(void *gameViewController_); |
18 | 18 | void resume(void *gameViewController_); |
19 | 19 | |
20 | +void setOnscreenKeyboardVisible(bool visible, void *gameViewController_, void *textDelegate_); | |
21 | + | |
20 | 22 | |
21 | 23 | #endif /* GameViewControllerIntf_h */ |
@@ -44,6 +44,8 @@ | ||
44 | 44 | |
45 | 45 | using namespace Demo; |
46 | 46 | |
47 | +UITextField* text = 0; | |
48 | + | |
47 | 49 | @implementation GameViewController |
48 | 50 | { |
49 | 51 | Demo::GameState *_graphicsGameState; |
@@ -96,6 +98,36 @@ | ||
96 | 98 | [viewController viewWillAppear:NO]; |
97 | 99 | } |
98 | 100 | |
101 | +void setOnscreenKeyboardVisible(bool visible, void *gameViewController_, | |
102 | + void *textDelegate_) | |
103 | +{ | |
104 | + if (text == 0) | |
105 | + { | |
106 | + CGRect someRect = CGRectMake(0.0, 0.0, 100.0, 30.0); | |
107 | + text = [[UITextField alloc] initWithFrame:someRect]; | |
108 | + [text setKeyboardType:UIKeyboardTypeDefault]; | |
109 | + [text setReturnKeyType:UIReturnKeyDone]; | |
110 | + [text setAutocapitalizationType:UITextAutocapitalizationTypeNone]; | |
111 | + [text setAutocorrectionType:UITextAutocorrectionTypeNo]; | |
112 | + [text setSpellCheckingType:UITextSpellCheckingTypeNo]; | |
113 | + [text setHidden:TRUE]; | |
114 | + [text setText:@"x"]; | |
115 | + GameViewController* viewController = (__bridge GameViewController *)gameViewController_; | |
116 | + [viewController.view addSubview:text]; | |
117 | + } | |
118 | + if (visible) | |
119 | + { | |
120 | + [text becomeFirstResponder]; | |
121 | +// UITextFieldDelegate(__bridge UITextFieldDelegate*)textDelegate_; | |
122 | +// [text setDelegate:]; | |
123 | + text.delegate = (__bridge id)textDelegate_; | |
124 | + } | |
125 | + else | |
126 | + { | |
127 | + [text resignFirstResponder]; | |
128 | + } | |
129 | +} | |
130 | + | |
99 | 131 | -(void)dealloc |
100 | 132 | { |
101 | 133 | // [self shutdownOgre]; |