aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvictorfisac <victorfisac@gmail.com>2015-12-30 04:43:24 +0100
committervictorfisac <victorfisac@gmail.com>2015-12-30 04:43:24 +0100
commit8e30bd1f697b793babd183b6d172cdbd7b679d80 (patch)
tree375f520f353a523742e40efe5a11b7a1a8201de2
parent6e5ceaa30d577dd2e2e8b03c3d9eb16680d6834e (diff)
downloadraylib-8e30bd1f697b793babd183b6d172cdbd7b679d80.tar.gz
raylib-8e30bd1f697b793babd183b6d172cdbd7b679d80.zip
Fixed and improved android template
- Added gestures module functions. - Fixed screen tap detection.
-rw-r--r--templates/android_project/jni/basic_game.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/templates/android_project/jni/basic_game.c b/templates/android_project/jni/basic_game.c
index bf2d5d02..482011a0 100644
--- a/templates/android_project/jni/basic_game.c
+++ b/templates/android_project/jni/basic_game.c
@@ -30,8 +30,9 @@ void android_main(struct android_app *app)
const int screenHeight = 450;
GameScreen currentScreen = LOGO;
-
+
InitWindow(screenWidth, screenHeight, app);
+ InitGesturesSystem(app);
// TODO: Initialize all required variables and load all required data here!
@@ -50,7 +51,7 @@ void android_main(struct android_app *app)
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
- //----------------------------------------------------------------------------------
+ //----------------------------------------------------------------------------------
switch(currentScreen)
{
case LOGO:
@@ -70,7 +71,7 @@ void android_main(struct android_app *app)
// TODO: Update TITLE screen variables here!
// Press enter to change to GAMEPLAY screen
- if (IsGestureDetected())
+ if (GetGestureType() == GESTURE_TAP)
{
PlaySound(fx);
currentScreen = GAMEPLAY;
@@ -81,8 +82,8 @@ void android_main(struct android_app *app)
// TODO: Update GAMEPLAY screen variables here!
// Press enter to change to ENDING screen
- if (IsGestureDetected())
- {
+ if (GetGestureType() == GESTURE_TAP)
+ {
PlaySound(fx);
currentScreen = ENDING;
}
@@ -92,7 +93,7 @@ void android_main(struct android_app *app)
// TODO: Update ENDING screen variables here!
// Press enter to return to TITLE screen
- if (IsGestureDetected())
+ if (GetGestureType() == GESTURE_TAP)
{
PlaySound(fx);
currentScreen = TITLE;
@@ -100,6 +101,8 @@ void android_main(struct android_app *app)
} break;
default: break;
}
+
+ UpdateGestures();
//----------------------------------------------------------------------------------
// Draw