ios stuff

This commit is contained in:
Vladislav Khorev 2013-07-29 18:01:22 +00:00
parent 9a27aacbab
commit c20fd99897
3 changed files with 16 additions and 2 deletions

View File

@ -9,9 +9,12 @@ const std::string CONST_CLICK_SIGNAL_NAME = "OnClick";
const std::string CONST_DRAG_SIGNAL_NAME = "OnDrag"; const std::string CONST_DRAG_SIGNAL_NAME = "OnDrag";
boost::mutex KeyMutex;
void GuiManagerSetKeyboardText(std::string newText) void GuiManagerSetKeyboardText(std::string newText)
{ {
KeyMutex.lock();
ResourceManager->GUIManager.SetTextSignal(newText); ResourceManager->GUIManager.SetTextSignal(newText);
KeyMutex.unlock();
} }

View File

@ -78,8 +78,9 @@ void GuiManagerSetKeyboardText(std::string newText); //Find it in GUIManager.cpp
void SetKeyboardText(const char* newText) void SetKeyboardText(const char* newText)
{ {
GuiManagerSetKeyboardText(newText); SE::PerformInMainThreadAsync(boost::bind(&GuiManagerSetKeyboardText, newText));
NSLog(@"text: %s", newText); //GuiManagerSetKeyboardText(newText);
//NSLog(@"text: %s", newText);
} }
} //namespace SE } //namespace SE

View File

@ -71,6 +71,10 @@ void SetKeyboardText(const char* newText);
_hiddenTextField = [[UITextField alloc] initWithFrame:CGRectMake(-200,-200,0,0)]; _hiddenTextField = [[UITextField alloc] initWithFrame:CGRectMake(-200,-200,0,0)];
//[_hiddenTextField setReturnKeyType: UIReturnKeyDone];
_hiddenTextField.autocorrectionType = UITextAutocorrectionTypeNo;
[self.view addSubview:_hiddenTextField]; [self.view addSubview:_hiddenTextField];
extKeyboardTextView = _hiddenTextField; extKeyboardTextView = _hiddenTextField;
@ -145,6 +149,12 @@ void SetKeyboardText(const char* newText);
NSLog(@"End"); NSLog(@"End");
} }
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if([string isEqualToString:@"\n"])
[textField resignFirstResponder];
return YES;
}
#pragma mark - GLKView and GLKViewController delegate methods #pragma mark - GLKView and GLKViewController delegate methods