Do not ratelimit touch events on Froyo/Gingerbread, they are already ratelimited by OS
This commit is contained in:
@@ -14,13 +14,13 @@ SwVideoMode=y
|
||||
SdlVideoResize=y
|
||||
SdlVideoResizeKeepAspect=n
|
||||
CompatibilityHacks=n
|
||||
AppUsesMouse=y
|
||||
AppNeedsTwoButtonMouse=y
|
||||
AppUsesMouse=n
|
||||
AppNeedsTwoButtonMouse=n
|
||||
AppNeedsArrowKeys=n
|
||||
AppNeedsTextInput=y
|
||||
AppUsesJoystick=n
|
||||
AppHandlesJoystickSensitivity=n
|
||||
AppUsesMultitouch=n
|
||||
AppUsesMultitouch=y
|
||||
NonBlockingSwapBuffers=y
|
||||
RedefinedKeys="SPACE"
|
||||
AppTouchscreenKeyboardKeysAmount=0
|
||||
@@ -29,7 +29,7 @@ RedefinedKeysScreenKb="1 2 3 4 5 6 1 2 3 4"
|
||||
StartupMenuButtonTimeout=3000
|
||||
HiddenMenuOptions=''
|
||||
FirstStartMenuOptions=''
|
||||
MultiABI=y
|
||||
MultiABI=n
|
||||
AppVersionCode=101
|
||||
AppVersionName="1.01"
|
||||
CompiledLibraries="sdl_mixer sdl_image"
|
||||
|
||||
@@ -361,7 +361,7 @@ int main(int argc, char* argv[])
|
||||
int fps_start = 0;
|
||||
float x_speed, y_speed, z_speed;
|
||||
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
|
||||
|
||||
atexit(SDL_Quit);
|
||||
|
||||
@@ -453,6 +453,15 @@ int main(int argc, char* argv[])
|
||||
SDL_FreeSurface(temp_image);
|
||||
|
||||
last_avg_tick = last_tick = SDL_GetTicks();
|
||||
|
||||
enum { MAX_POINTERS = 16, PTR_PRESSED = 4 };
|
||||
int touchPointers[MAX_POINTERS][5];
|
||||
|
||||
memset(touchPointers, 0, sizeof(touchPointers));
|
||||
SDL_Joystick * joysticks[MAX_POINTERS+1];
|
||||
for(i=0; i<MAX_POINTERS; i++)
|
||||
joysticks[i] = SDL_JoystickOpen(i);
|
||||
|
||||
while(1)
|
||||
{
|
||||
SDL_Rect r;
|
||||
@@ -486,26 +495,21 @@ int main(int argc, char* argv[])
|
||||
print_num(screen, font, screen->w-37, screen->h-12, fps);
|
||||
++fps_count;
|
||||
|
||||
int mouseX, mouseY;
|
||||
int mouseB = SDL_GetMouseState(&mouseX, &mouseY);
|
||||
r.x = mouseX;
|
||||
r.y = mouseY;
|
||||
r.w = 10;
|
||||
r.h = 1;
|
||||
SDL_FillRect(screen, &r, 0xeeeeeeee);
|
||||
|
||||
if( mouseB & SDL_BUTTON_LMASK )
|
||||
for(i=0; i<MAX_POINTERS; i++)
|
||||
{
|
||||
r.w = 20;
|
||||
r.h = 5;
|
||||
SDL_FillRect(screen, &r, 0xabcdaabb);
|
||||
}
|
||||
|
||||
if( mouseB & SDL_BUTTON_RMASK )
|
||||
{
|
||||
r.w = 5;
|
||||
r.h = 20;
|
||||
SDL_FillRect(screen, &r, 0x67895566);
|
||||
if( !touchPointers[i][PTR_PRESSED] )
|
||||
continue;
|
||||
r.x = touchPointers[i][0];
|
||||
r.y = touchPointers[i][1];
|
||||
r.w = 50 + touchPointers[i][3] / 10;
|
||||
r.h = 50 + touchPointers[i][3] / 10;
|
||||
r.x -= r.w/2;
|
||||
r.y -= r.h/2;
|
||||
Uint32 color = touchPointers[i][3] / 5 + 0x7f;
|
||||
if( color > 0xff )
|
||||
color = 0xff;
|
||||
color = color + color * 0x100 + color * 0x10000;
|
||||
SDL_FillRect(screen, &r, color);
|
||||
}
|
||||
|
||||
SDL_Flip(SDL_GetVideoSurface());
|
||||
@@ -543,6 +547,20 @@ int main(int argc, char* argv[])
|
||||
__android_log_print(ANDROID_LOG_INFO, "Ballfield", "Waiting");
|
||||
}
|
||||
}
|
||||
if( evt.type == SDL_JOYAXISMOTION )
|
||||
{
|
||||
if( evt.jaxis.which == 0 )
|
||||
continue;
|
||||
int joyid = evt.jaxis.which - 1;
|
||||
touchPointers[joyid][evt.jaxis.axis] = evt.jaxis.value;
|
||||
}
|
||||
if( evt.type == SDL_JOYBUTTONDOWN || evt.type == SDL_JOYBUTTONUP )
|
||||
{
|
||||
if( evt.jbutton.which == 0 )
|
||||
continue;
|
||||
int joyid = evt.jbutton.which - 1;
|
||||
touchPointers[joyid][PTR_PRESSED] = (evt.jbutton.state == SDL_PRESSED);
|
||||
}
|
||||
}
|
||||
|
||||
/* Animate */
|
||||
|
||||
@@ -5,7 +5,7 @@ AppName="Commander Genius"
|
||||
AppFullName=net.sourceforge.clonekeenplus
|
||||
ScreenOrientation=h
|
||||
InhibitSuspend=n
|
||||
AppDataDownloadUrl="!Data files|data.zip^High-quality GFX and music - 40 Mb|https://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-hqp-1.8.zip/download"
|
||||
AppDataDownloadUrl="!Data files|data.zip^High-quality GFX and music - 40 Mb|http://sourceforge.net/projects/libsdl-android/files/CommanderGenius/commandergenius-hqp-1.8.zip/download"
|
||||
VideoDepthBpp=16
|
||||
NeedDepthBuffer=n
|
||||
NeedStencilBuffer=n
|
||||
|
||||
@@ -1 +1 @@
|
||||
hello-gl2
|
||||
ballfield
|
||||
Reference in New Issue
Block a user