|
|
| Keyboard on iOS |
|
seibelj
Member #16,618
January 2017
|
I have been trying for many hours to programmatically show and hide the keyboard on iOS. The file containing my main method is in C, not objective c. How can I get the keyboard to show and hide? Is the answer something like in this stack overflow question? http://stackoverflow.com/questions/7253477/how-to-display-the-iphone-ipad-keyboard-over-a-full-screen-opengl-es-app Do I need to change the file containing my main method to a .m (objective c) file? Can I leave it as .c, then call out to a .m file (somehow)? The more specific you can be, the better. The documentation for iOS with allegro is pretty sparse. Thanks. |
|
jmasterx
Member #11,410
October 2009
|
I made a working implementation in my game: This also handles in app purchases. The solution is heavily coupled to my gui and game but should be adaptable to another game. My solution actually allows you to write directly to my text widgets when you tap a textbox. Agui GUI API -> https://github.com/jmasterx/Agui |
|
Mark Oates
Member #1,146
March 2001
|
That's impressive, jmasterx. I would love to have both features (in-app purchases, native touch keyboard) in AllegroFlare. Is it just for iOS, or does it also handle Android? -- |
|
Elias
Member #358
May 2000
|
In android it's very simple anyway as your game provides the Activity.java and you can just copy and paste some sample Java code. (Doing it in the NDK would be an alternative but more involved...) -- |
|
jmasterx
Member #11,410
October 2009
|
Never finished the Android port. Got it running n there but lost interest. Never did the keyboard code. Agui GUI API -> https://github.com/jmasterx/Agui |
|
Mark Oates
Member #1,146
March 2001
|
Elias said: In android it's very simple anyway as your game provides the Activity.java and you can just copy and paste some sample Java code. (Doing it in the NDK would be an alternative but more involved...) Could this be incorporated through C++ code? -- |
|
Elias
Member #358
May 2000
|
Yes, in Android NDK=C++ API and SDK=Java API -- |
|
seibelj
Member #16,618
January 2017
|
Thank you so much jmasterx. I was struggling with that for several hours. My Objective-C experience is pretty minimal. For anyone who is curious about how to do this in the future using C, here's what I had to do:
Edit - About Android, implementing that was trivial from wiki instructions: https://wiki.allegro.cc/index.php?title=Running_Allegro_applications_on_Android#Displaying_the_Android_keyboard Edit 2 - It doesn't seem that the keyboard eventing system gets key strokes as they happen. As my current system is listening for these events, my plan is to emit them directly into the eventing system from the KeyboardHandleriOS code, so that everything expecting keyboard events gets them as they happen, unless anyone has any better ideas. |
|
|