diff --git a/project/jni/Application.mk b/project/jni/Application.mk index f49a87b7f..c37c42f69 100644 --- a/project/jni/Application.mk +++ b/project/jni/Application.mk @@ -7,4 +7,4 @@ APP_PROJECT_PATH := $(call my-dir)/.. APP_MODULES := application sdl sdl_main stlport tremor png jpeg freetype sdl_image -APP_ABI := armeabi +APP_ABI := armeabi armeabi-v7a diff --git a/project/jni/application/teeworlds/AppSettings.cfg b/project/jni/application/teeworlds/AppSettings.cfg index b7547d8e2..152e3bb63 100644 --- a/project/jni/application/teeworlds/AppSettings.cfg +++ b/project/jni/application/teeworlds/AppSettings.cfg @@ -13,7 +13,7 @@ AppUsesMultitouch=n RedefinedKeys="SPACE RETURN LEFT RIGHT LSHIFT ESCAPE RSHIFT LSHIFT" AppTouchscreenKeyboardKeysAmount=6 AppTouchscreenKeyboardKeysAmountAutoFire=0 -MultiABI=n +MultiABI=y AppVersionCode=5201 AppVersionName="0.5.2.01" CompiledLibraries="sdl_image" diff --git a/project/jni/application/teeworlds/src/engine/client/ec_gfx.cpp b/project/jni/application/teeworlds/src/engine/client/ec_gfx.cpp index 1bd0af29a..9a3772e12 100644 --- a/project/jni/application/teeworlds/src/engine/client/ec_gfx.cpp +++ b/project/jni/application/teeworlds/src/engine/client/ec_gfx.cpp @@ -155,8 +155,6 @@ static void flush() #define SINGLE_COLOR_PER_TEXTURE 1 #define USE_GL_DRAW_TEX 1 -#define GL_DRAW_TEX_SWAP_UP_DOWN 1 -#define GL_DRAW_TEX_SWAP_UP_DOWN_TEX 1 #define TEXTURE_OUT_OF_SCREEN_CHECK 1 // Some GLES renderers seems to not have this check #ifdef TEXTURE_OUT_OF_SCREEN_CHECK @@ -201,8 +199,6 @@ static void flush() ( vertices[i * 4 + 0].color.a + vertices[i * 4 + 1].color.a + vertices[i * 4 + 2].color.a + vertices[i * 4 + 3].color.a ) / 4.0f, }; - // Android GL implemetation seems to have swapped R and B color channels, fascinating isn't it? - // I wonder how the texturing works without hacks glColor4f(texcolor.r, texcolor.g, texcolor.b, texcolor.a); #endif @@ -224,55 +220,19 @@ static void flush() */ GLfloat cropRect[4] = { vertices[i * 4].tex.u * textures[active_texture].w, -#ifdef GL_DRAW_TEX_SWAP_UP_DOWN_TEX vertices[i * 4 + 2].tex.v * textures[active_texture].h, -#else - vertices[i * 4].tex.v * textures[active_texture].h, -#endif (vertices[i * 4 + 2].tex.u - vertices[i * 4].tex.u) * textures[active_texture].w, -#ifdef GL_DRAW_TEX_SWAP_UP_DOWN_TEX - - -#endif - (vertices[i * 4 + 2].tex.v - vertices[i * 4].tex.v) * textures[active_texture].h + -(vertices[i * 4 + 2].tex.v - vertices[i * 4].tex.v) * textures[active_texture].h }; float aspectX = screen_width / (screen_x1 - screen_x0); float aspectY = screen_height / (screen_y1 - screen_y0); - /* - GLint texid = 0; - glGetIntegerv( GL_TEXTURE_BINDING_2D, &texid ); - if( texid != textures[active_texture].tex ) - dbg_msg("glDrawTexfOES", "active_texture %d tex %d != real tex %d", active_texture, textures[active_texture].tex, texid); - */ - glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect); glDrawTexfOES( (vertices[i * 4].pos.x - screen_x0) * aspectX, -#ifdef GL_DRAW_TEX_SWAP_UP_DOWN - (screen_y1 - vertices[i * 4 + 2].pos.y) * aspectY, -#else - (vertices[i * 4].pos.y - screen_y0) * aspectY, -#endif + (screen_y1 - vertices[i * 4 + 2].pos.y) * aspectY, // Up and down are swapped for glDrawTex() 0, (vertices[i * 4 + 2].pos.x - vertices[i * 4].pos.x) * aspectX, (vertices[i * 4 + 2].pos.y - vertices[i * 4].pos.y) * aspectY ); - - /* - dbg_msg("glDrawTexfOES", "tex %d screen %fx%f:%fx%f tex UV %fx%f:%fx%f dest rect %fx%f:%fx%f", - (int)active_texture, - (float)screen_x0, (float)screen_y0, (float)screen_x1, (float)screen_y1, - (float)vertices[i * 4].tex.u, (float)vertices[i * 4].tex.v, - (float)vertices[i * 4 + 2].tex.u, (float)vertices[i * 4 + 2].tex.v, - (float)vertices[i * 4].pos.x, (float)vertices[i * 4].pos.y, - (float)vertices[i * 4 + 2].pos.x, (float)vertices[i * 4 + 2].pos.y); - dbg_msg("glDrawTexfOES", "crop rect %fx%f:%fx%f screen rect %fx%f:%fx%f tex WH %dx%d", - cropRect[0], cropRect[1], cropRect[2], cropRect[3], - (vertices[i * 4].pos.x - screen_x0) * aspectX, - (vertices[i * 4].pos.y - screen_y0) * aspectY, 0, - (vertices[i * 4 + 2].pos.x - vertices[i * 4].pos.x) * aspectX, - (vertices[i * 4 + 2].pos.y - vertices[i * 4].pos.y) * aspectY, - (int)textures[active_texture].w, (int)textures[active_texture].h ); - */ - } else #endif @@ -294,7 +254,7 @@ static void flush() } #else - // We're on acceptable hardware, not Android, just draw the texture wthout hacks + // We're on acceptable hardware, not Android, just draw the texture without speed hacks glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glVertexPointer(3, GL_FLOAT, @@ -873,7 +833,6 @@ int gfx_load_texture_raw(int w, int h, int format, const void *data, int store_f textures[tex].h = h; active_texture = tex; - /* calculate memory usage */ { int pixel_size = 4; diff --git a/project/jni/application/teeworlds/src/game/client/components/binds.cpp b/project/jni/application/teeworlds/src/game/client/components/binds.cpp index 1b950365e..28a8daae0 100644 --- a/project/jni/application/teeworlds/src/game/client/components/binds.cpp +++ b/project/jni/application/teeworlds/src/game/client/components/binds.cpp @@ -85,6 +85,7 @@ void BINDS::set_defaults() #ifdef ANDROID + bind(KEY_MOUSE_1, "+fire"); bind(KEY_LEFT, "+left"); bind(KEY_RIGHT, "+right"); bind(KEY_UP, "+jump"); diff --git a/project/jni/application/teeworlds/src/game/client/components/controls.cpp b/project/jni/application/teeworlds/src/game/client/components/controls.cpp index 0641b4424..964ef7670 100644 --- a/project/jni/application/teeworlds/src/game/client/components/controls.cpp +++ b/project/jni/application/teeworlds/src/game/client/components/controls.cpp @@ -17,8 +17,16 @@ static void con_key_input_state(void *result, void *user_data) ((int *)user_data)[0] = console_arg_int(result, 0); } +#ifdef ANDROID +static bool con_key_fire_android_triggered = false; +#endif + static void con_key_input_counter(void *result, void *user_data) { +#ifdef ANDROID + if(!con_key_fire_android_triggered) + return; +#endif int *v = (int *)user_data; if(((*v)&1) != console_arg_int(result, 0)) (*v)++; @@ -220,16 +228,11 @@ bool CONTROLS::on_mousemove(float x, float y) mouse_pos = normalize(mouse_pos)*mouse_max; l = mouse_max; } - -#ifdef ANDROID - if(l > gfx_screenheight()/4) - { - if(input_data.fire&1 != 1) - input_data.fire++; - input_data.fire &= INPUT_STATE_MASK; - } -#endif +#ifdef ANDROID + con_key_fire_android_triggered = (l > mouse_max/4); +#endif + //float offset_amount = max(l-deadzone, 0.0f) * follow_factor; //if(l > 0.0001f) // make sure that this isn't 0 //camera_offset = normalize(mouse_pos)*offset_amount;