Fixed on-screen keyboard not drawing

This commit is contained in:
pelya
2011-02-02 10:26:35 +00:00
parent f6c8bd724a
commit 36128968af
3 changed files with 20 additions and 22 deletions

View File

@@ -17,7 +17,6 @@ class Globals {
// Set this value to true if you're planning to render 3D using OpenGL - it eats some GFX resources, so disabled for 2D
public static boolean NeedDepthBuffer = false;
// Set this value to true if you're planning to render 3D using OpenGL - it eats some GFX resources, so disabled for 2D
public static boolean HorizontalOrientation = true;
// prevent device from going to suspend mode
@@ -92,7 +91,7 @@ class Globals {
public static int MultitouchGestureSensitivity = 1;
public static int TouchscreenCalibration[] = new int[4];
public static String DataDir = new String("");
public static boolean SmoothVideo = false;
public static boolean SmoothVideo = true; // It looks nicer and doesn't take that much time if you have GFX accelerator
}
class LoadLibrary {

View File

@@ -1 +1 @@
ufoai
ballfield

View File

@@ -119,23 +119,6 @@ static inline void beginDrawingTex()
// It's very unlikely that some app will use GL_TEXTURE_CROP_RECT_OES, so just skip it
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if( SDL_ANDROID_SmoothVideo )
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
}
static inline void endDrawingTex()
@@ -164,6 +147,21 @@ static inline void drawCharTex(GLTexture_t * tex, SDL_Rect * src, SDL_Rect * des
glColor4x(r * 0x100, g * 0x100, b * 0x100, a * 0x100 );
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
if( SDL_ANDROID_SmoothVideo )
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
cropRect[0] = 0;
cropRect[1] = tex->h;
cropRect[2] = tex->w;
@@ -171,9 +169,9 @@ static inline void drawCharTex(GLTexture_t * tex, SDL_Rect * src, SDL_Rect * des
if(src)
{
cropRect[0] = src->x;
cropRect[1] = src->h; // TODO: check if height works as expected in inverted GL coords
cropRect[1] = src->h;
cropRect[2] = src->w;
cropRect[3] = -src->h; // TODO: check if height works as expected in inverted GL coords
cropRect[3] = -src->h;
}
glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect);
glDrawTexiOES(dest->x, SDL_ANDROID_sWindowHeight - dest->y - dest->h, 0, dest->w, dest->h);
@@ -667,6 +665,7 @@ static int setupScreenKeyboardButton( int buttonID, Uint8 * charBuf )
glGenTextures(1, &data->id);
glBindTexture(GL_TEXTURE_2D, data->id);
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "On-screen keyboard generated OpenGL texture ID %d", data->id);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture_w, texture_h, 0, GL_RGBA,
format ? GL_UNSIGNED_SHORT_4_4_4_4 : GL_UNSIGNED_SHORT_5_5_5_1, NULL);