diff options
Diffstat (limited to 'examples/web/core/core_input_gestures.c')
| -rw-r--r-- | examples/web/core/core_input_gestures.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/examples/web/core/core_input_gestures.c b/examples/web/core/core_input_gestures.c index 507fb3b..308f890 100644 --- a/examples/web/core/core_input_gestures.c +++ b/examples/web/core/core_input_gestures.c @@ -41,24 +41,24 @@ int lastGesture = GESTURE_NONE; void UpdateDrawFrame(void); // Update and Draw one frame //---------------------------------------------------------------------------------- -// Main Enry Point +// Program Main Entry Point //---------------------------------------------------------------------------------- -int main() +int main(void) { // Initialization //-------------------------------------------------------------------------------------- InitWindow(screenWidth, screenHeight, "raylib [core] example - input gestures"); - + touchArea = (Rectangle){ 220, 10, screenWidth - 230, screenHeight - 20 }; - + //SetGesturesEnabled(0b0000000000001001); // Enable only some gestures to be detected - + #if defined(PLATFORM_WEB) emscripten_set_main_loop(UpdateDrawFrame, 0, 1); #else SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- - + // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { @@ -67,7 +67,7 @@ int main() #endif // De-Initialization - //-------------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------------- CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- } @@ -102,14 +102,14 @@ void UpdateDrawFrame(void) case GESTURE_PINCH_OUT: strcpy(gestureStrings[gesturesCount], "GESTURE PINCH OUT"); break; default: break; } - + gesturesCount++; - + // Reset gestures strings if (gesturesCount >= MAX_GESTURE_STRINGS) { for (int i = 0; i < MAX_GESTURE_STRINGS; i++) strcpy(gestureStrings[i], "\0"); - + gesturesCount = 0; } } @@ -121,26 +121,26 @@ void UpdateDrawFrame(void) BeginDrawing(); ClearBackground(RAYWHITE); - + DrawRectangleRec(touchArea, GRAY); DrawRectangle(225, 15, screenWidth - 240, screenHeight - 30, RAYWHITE); - + DrawText("GESTURES TEST AREA", screenWidth - 270, screenHeight - 40, 20, Fade(GRAY, 0.5f)); - + for (int i = 0; i < gesturesCount; i++) { if (i%2 == 0) DrawRectangle(10, 30 + 20*i, 200, 20, Fade(LIGHTGRAY, 0.5f)); else DrawRectangle(10, 30 + 20*i, 200, 20, Fade(LIGHTGRAY, 0.3f)); - + if (i < gesturesCount - 1) DrawText(gestureStrings[i], 35, 36 + 20*i, 10, DARKGRAY); else DrawText(gestureStrings[i], 35, 36 + 20*i, 10, MAROON); } - + DrawRectangleLines(10, 29, 200, screenHeight - 50, GRAY); DrawText("DETECTED GESTURES", 50, 15, 10, GRAY); - + if (currentGesture != GESTURE_NONE) DrawCircleV(touchPosition, 30, MAROON); - + EndDrawing(); //---------------------------------------------------------------------------------- } |
