diff options
| author | ruki <[email protected]> | 2025-12-16 17:57:11 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-16 17:57:11 +0800 |
| commit | d1485fa867ebb3b661a16ec043f33537a7f9f0cd (patch) | |
| tree | 351a965dfb03438caf4a5a55620a11108ffabcac /tests/projects/android/native_app/raylib_basic/src | |
| parent | d3acb6ca0d74d506d4a7da0fb7c055344591cb7a (diff) | |
| parent | 7b542ebe22e833bd56dd1eb0271aa5aa7c0b45a8 (diff) | |
Merge pull request #7139 from xmake-io/android
Add android native app support
Diffstat (limited to 'tests/projects/android/native_app/raylib_basic/src')
| -rw-r--r-- | tests/projects/android/native_app/raylib_basic/src/main.cpp | 32 |
1 files changed, 32 insertions, 0 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 new file mode 100644 index 000000000..0094d9e3c --- /dev/null +++ b/tests/projects/android/native_app/raylib_basic/src/main.cpp @@ -0,0 +1,32 @@ +#include <raylib.h> +#include <android/log.h> + +#define LOG_TAG "raydemo_basic" +#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) + +int main(int argc, char** argv) { + InitWindow(0, 0, "Hello, xmake for raylib android!"); + SetTargetFPS(60); + LOGI("raylib application is running!"); + + while (!WindowShouldClose()) { + BeginDrawing(); + ClearBackground(BLACK); + + // 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(); + } + + CloseWindow(); + return 0; +} |
