Some improvements on Teeworlds port - it still crashes for no reason when I'm pressing 5-th button

This commit is contained in:
pelya
2010-09-08 12:52:26 +03:00
parent 7787b90910
commit b3571c8a67
11 changed files with 101 additions and 13 deletions

View File

@@ -111,11 +111,15 @@ void BINDS::set_defaults()
bind(KEY_F4, "vote no");
#ifdef ANDROID
unbindall();
bind(KEY_LEFT, "+left");
bind(KEY_RIGHT, "+right");
bind(KEY_UP, "+jump");
bind(KEY_DOWN, "+hook");
bind(KEY_RETURN, "+jump");
bind(KEY_SPACE, "+hook");
bind('q', "+nextweapon");
bind('e', "+prevweapon");
#endif
}

View File

@@ -182,8 +182,11 @@ bool CONTROLS::on_mousemove(float x, float y)
if(gameclient.snap.spectate)
{
if( inp_key_down(KEY_MOUSE_1) )
mouse_pos += vec2((x - gfx_screenwidth()/2) * 2, (y - gfx_screenheight()/2) * 2);
if( mouse_pos_old != vec2(x, y))
{
mouse_pos_old = vec2(x, y);
mouse_pos += vec2((x - gfx_screenwidth()/2), (y - gfx_screenheight()/2));
}
}
else
{
@@ -219,7 +222,7 @@ bool CONTROLS::on_mousemove(float x, float y)
}
#ifdef ANDROID
if(l * 2.0f > mouse_max)
if(l > gfx_screenheight()/4)
{
if(input_data.fire&1 != 1)
input_data.fire++;

View File

@@ -6,6 +6,7 @@ class CONTROLS : public COMPONENT
public:
vec2 mouse_pos;
vec2 target_pos;
vec2 mouse_pos_old; // for Android
NETOBJ_PLAYER_INPUT input_data;
int input_direction_left;