More fixes to Teeworlds

This commit is contained in:
pelya
2010-09-07 15:14:54 +03:00
parent af072b3fc3
commit 7787b90910
4 changed files with 31 additions and 1 deletions

View File

@@ -46,6 +46,11 @@ void inp_mouse_absolute(int *x, int *y)
SDL_GetMouseState(x, y);
}
void inp_warp_mouse(int x, int y)
{
SDL_WarpMouse(x,y);
}
enum
{
INPUT_BUFFER_SIZE=32

View File

@@ -52,9 +52,15 @@ MACRO_CONFIG_INT(gfx_clear, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Clear screen
MACRO_CONFIG_INT(gfx_vsync, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Vertical sync")
MACRO_CONFIG_INT(gfx_display_all_modes, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
MACRO_CONFIG_INT(gfx_texture_compression, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use texture compression")
#ifdef ANDROID
MACRO_CONFIG_INT(gfx_high_detail, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "High detail")
MACRO_CONFIG_INT(gfx_texture_quality, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
MACRO_CONFIG_INT(gfx_fsaa_samples, 0, 0, 16, CFGFLAG_SAVE|CFGFLAG_CLIENT, "FSAA Samples")
#else
MACRO_CONFIG_INT(gfx_high_detail, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "High detail")
MACRO_CONFIG_INT(gfx_texture_quality, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
MACRO_CONFIG_INT(gfx_fsaa_samples, 0, 0, 16, CFGFLAG_SAVE|CFGFLAG_CLIENT, "FSAA Samples")
#endif
MACRO_CONFIG_INT(gfx_refresh_rate, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen refresh rate")
MACRO_CONFIG_INT(gfx_finish, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")

View File

@@ -246,6 +246,7 @@ void inp_update();
void inp_init();
void inp_mouse_mode_absolute();
void inp_mouse_mode_relative();
void inp_warp_mouse(int x, int y);
#ifdef __cplusplus
}

View File

@@ -179,7 +179,16 @@ bool CONTROLS::on_mousemove(float x, float y)
return false;
mouse_pos += vec2(x, y); // TODO: ugly
#ifdef ANDROID
mouse_pos = vec2(x, 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);
}
else
{
mouse_pos = vec2((x - gfx_screenwidth()/2) * 2, (y - gfx_screenheight()/2) * 2);
}
#endif
//
@@ -208,6 +217,15 @@ bool CONTROLS::on_mousemove(float x, float y)
mouse_pos = normalize(mouse_pos)*mouse_max;
l = mouse_max;
}
#ifdef ANDROID
if(l * 2.0f > mouse_max)
{
if(input_data.fire&1 != 1)
input_data.fire++;
input_data.fire &= INPUT_STATE_MASK;
}
#endif
//float offset_amount = max(l-deadzone, 0.0f) * follow_factor;
//if(l > 0.0001f) // make sure that this isn't 0