Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Replaced glColor4x with glColor4f, maybe it will fix some isues repor…

…ted by users
  • Loading branch information...
commit bba4301405caa9b71896dde3ae3d7d73415b0824 1 parent d0a5bd4
@pelya authored
View
9 project/jni/sdl-1.2/src/video/android/SDL_androidvideo-1.2.c
@@ -910,10 +910,9 @@ static void ANDROID_FlipHWSurfaceInternal(int numrects, SDL_Rect *rects)
// Do it old-fashioned way with direct GL calls
glPushMatrix();
glLoadIdentity();
- glOrthox( 0, SDL_ANDROID_sFakeWindowWidth * 0x10000, SDL_ANDROID_sFakeWindowHeight * 0x10000, 0, 0, 1 * 0x10000 );
- glColor4x(0, 0, 0, 0x10000);
+ glOrthof( 0.0f, SDL_ANDROID_sFakeWindowWidth, SDL_ANDROID_sFakeWindowHeight, 0.0f, 0.0f, 1.0f );
glEnableClientState(GL_VERTEX_ARRAY);
- glColor4x(0, 0, 0, 0x10000);
+ glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
GLshort vertices[] = { frame.x, frame.y,
frame.x + frame.w, frame.y,
frame.x + frame.w, frame.y + frame.h,
@@ -991,7 +990,7 @@ static void ANDROID_FlipHWSurfaceInternal(int numrects, SDL_Rect *rects)
SDL_GetMouseState(&x, &y);
x = x * SDL_ANDROID_sRealWindowWidth / SDL_ANDROID_sFakeWindowWidth;
y = y * SDL_ANDROID_sRealWindowHeight / SDL_ANDROID_sFakeWindowHeight;
- SDL_ANDROID_DrawMouseCursor( x, y, 0, 255 );
+ SDL_ANDROID_DrawMouseCursor( x, y, 0, 1.0f );
}
if( SDL_ANDROID_ShowScreenUnderFinger != ZOOM_NONE )
{
@@ -1005,7 +1004,7 @@ static void ANDROID_FlipHWSurfaceInternal(int numrects, SDL_Rect *rects)
SDL_ANDROID_ShowScreenUnderFingerRect.h / SDL_ANDROID_ShowScreenUnderFingerRectSrc.h;
x = x * SDL_ANDROID_sRealWindowWidth / SDL_ANDROID_sFakeWindowWidth;
y = y * SDL_ANDROID_sRealWindowHeight / SDL_ANDROID_sFakeWindowHeight;
- SDL_ANDROID_DrawMouseCursor( x, y, 16, 255 );
+ SDL_ANDROID_DrawMouseCursor( x, y, 16, 1.0f );
}
}
}
View
4 project/jni/sdl-1.2/src/video/android/SDL_androidvideo.c
@@ -111,8 +111,8 @@ int SDL_ANDROID_CallJavaSwapBuffers()
{
glPushMatrix();
glLoadIdentity();
- glOrthox( 0, (SDL_ANDROID_sRealWindowWidth) * 0x10000, SDL_ANDROID_sRealWindowHeight * 0x10000, 0, 0, 1 * 0x10000 );
- glColor4x(0, 0, 0, 0x10000);
+ glOrthof( 0.0f, SDL_ANDROID_sRealWindowWidth, SDL_ANDROID_sRealWindowHeight, 0.0f, 0.0f, 1.0f );
+ glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
glEnableClientState(GL_VERTEX_ARRAY);
GLshort vertices[] = { SDL_ANDROID_ForceClearScreenRect.x, SDL_ANDROID_ForceClearScreenRect.y,
View
2  project/jni/sdl-1.2/src/video/android/SDL_androidvideo.h
@@ -69,7 +69,7 @@ extern void SDL_ANDROID_initFakeStdout();
extern SDL_VideoDevice *ANDROID_CreateDevice_1_3(int devindex);
extern void SDL_ANDROID_ProcessDeferredEvents();
extern void SDL_ANDROID_WarpMouse(int x, int y);
-extern void SDL_ANDROID_DrawMouseCursor(int x, int y, int size, int alpha);
+extern void SDL_ANDROID_DrawMouseCursor(int x, int y, int size, float alpha);
extern void SDL_ANDROID_DrawMouseCursorIfNeeded();
extern void SDL_ANDROID_CallJavaTogglePlainAndroidSoftKeyboardInput();
extern void SDL_ANDROID_CallJavaStartAccelerometerGyroscope(int start);
View
56 project/jni/sdl-1.2/src/video/android/SDL_touchscreenkeyboard.c
@@ -56,7 +56,7 @@ static short touchscreenKeyboardShown = 1;
static short AutoFireButtonsNum = 0;
static short buttonsize = 1;
static short buttonDrawSize = 1;
-static short transparency = 128;
+static float transparency = 128.0f/255.0f;
static SDL_Rect arrows, arrowsExtended, buttons[MAX_BUTTONS], buttonsAutoFireRect[MAX_BUTTONS_AUTOFIRE];
static SDL_Rect arrowsDraw, buttonsDraw[MAX_BUTTONS];
@@ -174,7 +174,7 @@ static inline void endDrawingTex()
glEnableClientState(GL_COLOR_ARRAY);
}
-static inline void drawCharTexFlip(GLTexture_t * tex, SDL_Rect * src, SDL_Rect * dest, int flipX, int flipY, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+static inline void drawCharTexFlip(GLTexture_t * tex, SDL_Rect * src, SDL_Rect * dest, int flipX, int flipY, float r, float g, float b, float a)
{
GLint cropRect[4];
@@ -183,7 +183,7 @@ static inline void drawCharTexFlip(GLTexture_t * tex, SDL_Rect * src, SDL_Rect *
glBindTexture(GL_TEXTURE_2D, tex->id);
- glColor4x(r * 0x100, g * 0x100, b * 0x100, a * 0x100 );
+ glColor4f(r, g, b, a);
if(src)
{
@@ -213,7 +213,7 @@ static inline void drawCharTexFlip(GLTexture_t * tex, SDL_Rect * src, SDL_Rect *
glDrawTexiOES(dest->x, SDL_ANDROID_sWindowHeight - dest->y - dest->h, 0, dest->w, dest->h);
}
-static inline void drawCharTex(GLTexture_t * tex, SDL_Rect * src, SDL_Rect * dest, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
+static inline void drawCharTex(GLTexture_t * tex, SDL_Rect * src, SDL_Rect * dest, float r, float g, float b, float a)
{
drawCharTexFlip(tex, src, dest, 0, 0, r, g, b, a);
}
@@ -221,24 +221,24 @@ static inline void drawCharTex(GLTexture_t * tex, SDL_Rect * src, SDL_Rect * des
static void drawTouchscreenKeyboardLegacy()
{
int i;
- int blendFactor;
+ float blendFactor;
blendFactor = ( SDL_GetKeyboardState(NULL)[SDL_KEY(LEFT)] ? 1 : 0 ) +
( SDL_GetKeyboardState(NULL)[SDL_KEY(RIGHT)] ? 1 : 0 ) +
( SDL_GetKeyboardState(NULL)[SDL_KEY(UP)] ? 1 : 0 ) +
( SDL_GetKeyboardState(NULL)[SDL_KEY(DOWN)] ? 1 : 0 );
if( blendFactor == 0 )
- drawCharTex( &arrowImages[0], NULL, &arrowsDraw, 255, 255, 255, transparency );
+ drawCharTex( &arrowImages[0], NULL, &arrowsDraw, 1.0f, 1.0f, 1.0f, transparency );
else
{
if( SDL_GetKeyboardState(NULL)[SDL_KEY(LEFT)] )
- drawCharTex( &arrowImages[1], NULL, &arrowsDraw, 255, 255, 255, transparency / blendFactor );
+ drawCharTex( &arrowImages[1], NULL, &arrowsDraw, 1.0f, 1.0f, 1.0f, transparency / blendFactor );
if( SDL_GetKeyboardState(NULL)[SDL_KEY(RIGHT)] )
- drawCharTex( &arrowImages[2], NULL, &arrowsDraw, 255, 255, 255, transparency / blendFactor );
+ drawCharTex( &arrowImages[2], NULL, &arrowsDraw, 1.0f, 1.0f, 1.0f, transparency / blendFactor );
if( SDL_GetKeyboardState(NULL)[SDL_KEY(UP)] )
- drawCharTex( &arrowImages[3], NULL, &arrowsDraw, 255, 255, 255, transparency / blendFactor );
+ drawCharTex( &arrowImages[3], NULL, &arrowsDraw, 1.0f, 1.0f, 1.0f, transparency / blendFactor );
if( SDL_GetKeyboardState(NULL)[SDL_KEY(DOWN)] )
- drawCharTex( &arrowImages[4], NULL, &arrowsDraw, 255, 255, 255, transparency / blendFactor );
+ drawCharTex( &arrowImages[4], NULL, &arrowsDraw, 1.0f, 1.0f, 1.0f, transparency / blendFactor );
}
for( i = 0; i < MAX_BUTTONS; i++ )
@@ -274,7 +274,7 @@ static void drawTouchscreenKeyboardLegacy()
autoFireDest.w = pos1dst;
drawCharTex( &buttonImages[i*2+1],
- &autoFireCrop, &autoFireDest, 255, 255, 255, transparency );
+ &autoFireCrop, &autoFireDest, 1.0f, 1.0f, 1.0f, transparency );
autoFireCrop.x = pos2src;
autoFireCrop.w = buttonImages[i*2+1].w - pos2src;
@@ -282,7 +282,7 @@ static void drawTouchscreenKeyboardLegacy()
autoFireDest.w = buttonsDraw[i].w - pos2dst;
drawCharTex( &buttonImages[i*2+1],
- &autoFireCrop, &autoFireDest, 255, 255, 255, transparency );
+ &autoFireCrop, &autoFireDest, 1.0f, 1.0f, 1.0f, transparency );
autoFireCrop.x = pos1src;
autoFireCrop.w = pos2src - pos1src;
@@ -290,13 +290,13 @@ static void drawTouchscreenKeyboardLegacy()
autoFireDest.w = pos2dst - pos1dst;
drawCharTex( &buttonAutoFireImages[i*2+1],
- &autoFireCrop, &autoFireDest, 255, 255, 255, transparency );
+ &autoFireCrop, &autoFireDest, 1.0f, 1.0f, 1.0f, transparency );
}
else
{
drawCharTex( ( i < AutoFireButtonsNum && ButtonAutoFire[i] ) ? &buttonAutoFireImages[i*2] :
&buttonImages[ SDL_GetKeyboardState(NULL)[buttonKeysyms[i]] ? (i * 2 + 1) : (i * 2) ],
- NULL, &buttonsDraw[i], 255, 255, 255, transparency );
+ NULL, &buttonsDraw[i], 1.0f, 1.0f, 1.0f, transparency );
}
}
}
@@ -305,7 +305,7 @@ static void drawTouchscreenKeyboardSun()
{
int i;
- drawCharTex( &arrowImages[0], NULL, &arrowsDraw, 255, 255, 255, transparency );
+ drawCharTex( &arrowImages[0], NULL, &arrowsDraw, 1.0f, 1.0f, 1.0f, transparency );
if(pointerInButtonRect[BUTTON_ARROWS] != -1)
{
SDL_Rect touch = arrowsDraw;
@@ -313,7 +313,7 @@ static void drawTouchscreenKeyboardSun()
touch.h /= 2;
touch.x = joystickTouchPoints[0] - touch.w / 2;
touch.y = joystickTouchPoints[1] - touch.h / 2;
- drawCharTex( &arrowImages[0], NULL, &touch, 255, 255, 255, transparency );
+ drawCharTex( &arrowImages[0], NULL, &touch, 1.0f, 1.0f, 1.0f, transparency );
}
for( i = 0; i < MAX_BUTTONS; i++ )
@@ -339,10 +339,10 @@ static void drawTouchscreenKeyboardSun()
if( i < AutoFireButtonsNum && ButtonAutoFire[i] )
drawCharTex( &buttonAutoFireImages[i*2+1],
- NULL, &buttonsDraw[i], 255, 255, 255, transparency );
+ NULL, &buttonsDraw[i], 1.0f, 1.0f, 1.0f, transparency );
drawCharTexFlip( &buttonImages[ pressed ? (i * 2 + 1) : (i * 2) ],
- NULL, &buttonsDraw[i], (i >= 2 && pressed), 0, 255, 255, 255, transparency );
+ NULL, &buttonsDraw[i], (i >= 2 && pressed), 0, 1.0f, 1.0f, 1.0f, transparency );
if( i < AutoFireButtonsNum && ! ButtonAutoFire[i] &&
( ButtonAutoFireX[i*2] > 0 || ButtonAutoFireX[i*2+1] > 0 ) )
@@ -359,7 +359,7 @@ static void drawTouchscreenKeyboardSun()
autoFireDest.y = buttonsDraw[i].y + buttonsDraw[i].h/2 - autoFireDest.h/2;
drawCharTex( &buttonAutoFireImages[i*2],
- NULL, &autoFireDest, 255, 255, 255, transparency );
+ NULL, &autoFireDest, 1.0f, 1.0f, 1.0f, transparency );
}
}
}
@@ -700,12 +700,12 @@ JAVA_EXPORT_NAME(Settings_nativeSetupScreenKeyboard) ( JNIEnv* env, jobject thi
buttonDrawSize = drawsize;
switch(_transparency)
{
- case 0: transparency = 32; break;
- case 1: transparency = 64; break;
- case 2: transparency = 128; break;
- case 3: transparency = 192; break;
- case 4: transparency = 255; break;
- default: transparency = 192; break;
+ case 0: transparency = 32.0f/255.0f; break;
+ case 1: transparency = 64.0f/255.0f; break;
+ case 2: transparency = 128.0f/255.0f; break;
+ case 3: transparency = 192.0f/255.0f; break;
+ case 4: transparency = 255.0f/255.0f; break;
+ default: transparency = 192.0f/255.0f; break;
}
// Arrows to the lower-left part of screen
@@ -778,16 +778,16 @@ JAVA_EXPORT_NAME(Settings_nativeSetTouchscreenKeyboardUsed) ( JNIEnv* env, jobj
SDL_ANDROID_isTouchscreenKeyboardUsed = 1;
}
-void SDL_ANDROID_DrawMouseCursor(int x, int y, int size, int alpha)
+void SDL_ANDROID_DrawMouseCursor(int x, int y, int size, float alpha)
{
SDL_Rect r;
- // I've failed with size calcualtions, so leaving it as-is
+ // I've failed with size calculations, so leaving it as-is
r.x = x - MOUSE_POINTER_X;
r.y = y - MOUSE_POINTER_Y;
r.w = MOUSE_POINTER_W;
r.h = MOUSE_POINTER_H;
beginDrawingTex();
- drawCharTex( &mousePointer, NULL, &r, 255, 255, 255, alpha );
+ drawCharTex( &mousePointer, NULL, &r, 1.0f, 1.0f, 1.0f, alpha );
endDrawingTex();
}
Please sign in to comment.
Something went wrong with that request. Please try again.