diff options
| author | ruki <[email protected]> | 2025-12-16 23:40:36 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-12-16 23:40:36 +0800 |
| commit | 427f50fa45d7015bd443fa2c0d059593c826d43f (patch) | |
| tree | 4cbc3d7ad666c4515f31c3379e682f2176248624 /tests/projects/android | |
| parent | 3e7d8b94f1a1349ccbae107b5a2aeac9fb77e6e2 (diff) | |
improve tests
Diffstat (limited to 'tests/projects/android')
| -rw-r--r-- | tests/projects/android/native_app/raylib_basic/src/main.cpp | 13 | ||||
| -rw-r--r-- | tests/projects/android/native_app/raylib_particles/src/main.cpp | 12 |
2 files changed, 22 insertions, 3 deletions
diff --git a/tests/projects/android/native_app/raylib_basic/src/main.cpp b/tests/projects/android/native_app/raylib_basic/src/main.cpp index b160499b7..0094d9e3c 100644 --- a/tests/projects/android/native_app/raylib_basic/src/main.cpp +++ b/tests/projects/android/native_app/raylib_basic/src/main.cpp @@ -12,7 +12,18 @@ int main(int argc, char** argv) { while (!WindowShouldClose()) { BeginDrawing(); ClearBackground(BLACK); - DrawText("Hello, xmake for raylib android!", 250, 250, 25, BLUE); + + // Draw FPS + const char* fpsText = TextFormat("%2i FPS", GetFPS()); + int fpsWidth = MeasureText(fpsText, 40); + DrawText(fpsText, GetScreenWidth() / 2 - fpsWidth / 2, 30, 40, GREEN); + + // Draw centered text + int fontSize = 50; + const char* text = "Hello, xmake for raylib android!"; + int textWidth = MeasureText(text, fontSize); + DrawText(text, GetScreenWidth() / 2 - textWidth / 2, 100, fontSize, BLUE); + EndDrawing(); } diff --git a/tests/projects/android/native_app/raylib_particles/src/main.cpp b/tests/projects/android/native_app/raylib_particles/src/main.cpp index 41dd8bd4a..5bbfc90e8 100644 --- a/tests/projects/android/native_app/raylib_particles/src/main.cpp +++ b/tests/projects/android/native_app/raylib_particles/src/main.cpp @@ -70,8 +70,16 @@ int main(int argc, char** argv) { DrawCircleV(p.position, p.size, Fade(p.color, p.life)); } - DrawText("Touch to create particles!", 10, 40, 20, WHITE); - DrawFPS(10, 10); + // Draw FPS + const char* fpsText = TextFormat("%2i FPS", GetFPS()); + int fpsWidth = MeasureText(fpsText, 40); + DrawText(fpsText, GetScreenWidth() / 2 - fpsWidth / 2, 30, 40, GREEN); + + // Draw centered instructions + int fontSize = 40; + const char* text = "Touch to create particles!"; + int textWidth = MeasureText(text, fontSize); + DrawText(text, GetScreenWidth() / 2 - textWidth / 2, 80, fontSize, WHITE); EndDrawing(); } |
