Toggling text input shows screen keyboard automatically, updated fheroes2

This commit is contained in:
pelya
2011-11-16 15:10:52 +02:00
parent 12771e9122
commit d5313cb08e
7 changed files with 37 additions and 52 deletions

View File

@@ -5,7 +5,7 @@ AppName="Free Heroes 2"
AppFullName=net.sourceforge.fheroes2
ScreenOrientation=h
InhibitSuspend=n
AppDataDownloadUrl="Heroes 2 DEMO data files (45 Mb)|http://downloads.pcworld.com/pub/new/fun_and_games/adventure_strategy/h2demo.zip|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/h2demo.zip/download^MIDI music support (18 Mb)|http://sourceforge.net/projects/libsdl-android/files/timidity.zip/download^Essential map pack (9 Mb)|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/EssentialMapPack.zip/download^Additional map pack (95 Mb)|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/AdditionalMapPack.zip/download^Mega map pack (280 Mb)|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/MegaMapPack.zip/download^Russian translation|:fheroes2.cfg:fheroes2-ru.cfg^Czech translation|:fheroes2.cfg:fheroes2-cs.cfg^Spanish translation|:fheroes2.cfg:fheroes2-es.cfg^French translation|:fheroes2.cfg:fheroes2-fr.cfg^Hungarian translation|:fheroes2.cfg:fheroes2-hu.cfg^Polish translation|:fheroes2.cfg:fheroes2-pl.cfg^Portugese translation|:fheroes2.cfg:fheroes2-pt_BR.cfg^Swedish translation|:fheroes2.cfg:fheroes2-sv.cfg^!Game data|data12.zip^!Game fonts|fonts2.zip"
AppDataDownloadUrl="Heroes 2 DEMO (45 Mb) - required to play|http://downloads.pcworld.com/pub/new/fun_and_games/adventure_strategy/h2demo.zip|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/h2demo.zip/download^MIDI music support (18 Mb)|http://sourceforge.net/projects/libsdl-android/files/timidity.zip/download^Essential map pack (9 Mb)|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/EssentialMapPack.zip/download^Additional map pack (95 Mb)|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/AdditionalMapPack.zip/download^Mega map pack (280 Mb)|http://sourceforge.net/projects/libsdl-android/files/FreeHeroes2/MegaMapPack.zip/download^!Game data|data12.zip^!Game data 2|data-cfg-fonts.zip^Russian translation|:fheroes2.cfg:fheroes2-ru.cfg^Czech translation|:fheroes2.cfg:fheroes2-cs.cfg^Spanish translation|:fheroes2.cfg:fheroes2-es.cfg^French translation|:fheroes2.cfg:fheroes2-fr.cfg^Hungarian translation|:fheroes2.cfg:fheroes2-hu.cfg^Polish translation|:fheroes2.cfg:fheroes2-pl.cfg^Portugese translation|:fheroes2.cfg:fheroes2-pt_BR.cfg^Swedish translation|:fheroes2.cfg:fheroes2-sv.cfg"
VideoDepthBpp=16
NeedDepthBuffer=n
NeedStencilBuffer=n

View File

@@ -26,7 +26,6 @@
#include "SDL_stdinc.h"
#include "SDL_video.h"
#include "SDL_keysym.h"
#include <jni.h>
/* On-screen keyboard exposed to the application, it's yet available on Android platform only */
@@ -77,16 +76,12 @@ extern DECLSPEC int SDLCALL SDL_ANDROID_ToggleScreenKeyboardTextInput(const char
/* Show Android on-screen keyboard, and pass entered text back to application in a buffer,
using buffer contents as previous text (UTF-8 encoded), the buffer may be of any size -
this call will block until user typed all text */
this call will block until user typed all text. */
extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardTextInput(char * textBuf, int textBufSize);
/* Whether user redefined on-screen keyboard layout via SDL menu, app should not enforce it's own layout in that case */
extern DECLSPEC int SDLCALL SDL_ANDROID_GetScreenKeyboardRedefinedByUser();
/** Exports for Java environment and Video object instance */
extern DECLSPEC JNIEnv* SDL_ANDROID_JniEnv();
extern DECLSPEC jobject SDL_ANDROID_JniVideoObject();
#ifdef __cplusplus
}
#endif

View File

@@ -120,7 +120,7 @@ int oldMouseButtons = 0;
static int UnicodeToUtf8(int src, char * dest)
{
int len = 0;
int len = 0;
if ( src <= 0x007f) {
*dest++ = (char)src;
len = 1;
@@ -713,7 +713,7 @@ JAVA_EXPORT_NAME(DemoRenderer_nativeTextInput) ( JNIEnv* env, jobject thiz, jin
SDL_ANDROID_MainThreadPushText(ascii, unicode);
else
{
if( textInputBufferPos < textInputBufferLen + 4 )
if( textInputBufferPos < textInputBufferLen + 4 && ascii != SDLK_RETURN && ascii != '\r' && ascii != '\n' )
{
textInputBufferPos += UnicodeToUtf8(unicode, textInputBuffer + textInputBufferPos);
}