diff options
| author | Yi Jianlong <[email protected]> | 2025-12-12 15:00:44 +0800 |
|---|---|---|
| committer | Yi Jianlong <[email protected]> | 2025-12-13 00:45:05 +0800 |
| commit | 7298699afb4e2baf50978cda9b2cc8822170301b (patch) | |
| tree | 0d467fb4fa2b17d2b4c956ec2b4144c544b0d0e1 /tests/projects/c++ | |
| parent | 711feadb87c1224de4fa81745d7a13565aeda10d (diff) | |
refactor the android native app rule and add a simple test project
Diffstat (limited to 'tests/projects/c++')
| -rw-r--r-- | tests/projects/c++/ndk_raylib/android/AndroidManifest.xml | 31 | ||||
| -rw-r--r-- | tests/projects/c++/ndk_raylib/android/debug.jks | bin | 0 -> 2487 bytes | |||
| -rw-r--r-- | tests/projects/c++/ndk_raylib/android/res/mipmap-mdpi/icon.png | bin | 0 -> 2643 bytes | |||
| -rw-r--r-- | tests/projects/c++/ndk_raylib/android/res/mipmap/icon.png | bin | 0 -> 2643 bytes | |||
| -rw-r--r-- | tests/projects/c++/ndk_raylib/android/res/values/strings.xml | 4 | ||||
| -rw-r--r-- | tests/projects/c++/ndk_raylib/android/res/values/styles.xml | 9 | ||||
| -rw-r--r-- | tests/projects/c++/ndk_raylib/src/main.cpp | 21 | ||||
| -rw-r--r-- | tests/projects/c++/ndk_raylib/xmake.lua | 22 |
8 files changed, 87 insertions, 0 deletions
diff --git a/tests/projects/c++/ndk_raylib/android/AndroidManifest.xml b/tests/projects/c++/ndk_raylib/android/AndroidManifest.xml new file mode 100644 index 000000000..40cfd7066 --- /dev/null +++ b/tests/projects/c++/ndk_raylib/android/AndroidManifest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + package="com.raylib.demo" + + android:versionCode="15" + android:versionName="1.5"> + + <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" /> + + <uses-permission android:name="android.permission.SET_RELEASE_APP"/> + + <application + android:label="Fighter" android:debuggable="true" android:hasCode="false" + tools:replace="android:icon,android:theme,android:allowBackup,label" + android:icon="@mipmap/icon"> + + <activity android:name="android.app.NativeActivity" + android:label="Fighter" + android:configChanges="orientation|keyboardHidden|screenSize|screenLayout" + android:screenOrientation="portrait" + android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> + <meta-data android:name="android.app.lib_name" + android:value="main" /> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> +</manifest>
\ No newline at end of file diff --git a/tests/projects/c++/ndk_raylib/android/debug.jks b/tests/projects/c++/ndk_raylib/android/debug.jks Binary files differnew file mode 100644 index 000000000..b4eb4f9f2 --- /dev/null +++ b/tests/projects/c++/ndk_raylib/android/debug.jks diff --git a/tests/projects/c++/ndk_raylib/android/res/mipmap-mdpi/icon.png b/tests/projects/c++/ndk_raylib/android/res/mipmap-mdpi/icon.png Binary files differnew file mode 100644 index 000000000..743413831 --- /dev/null +++ b/tests/projects/c++/ndk_raylib/android/res/mipmap-mdpi/icon.png diff --git a/tests/projects/c++/ndk_raylib/android/res/mipmap/icon.png b/tests/projects/c++/ndk_raylib/android/res/mipmap/icon.png Binary files differnew file mode 100644 index 000000000..743413831 --- /dev/null +++ b/tests/projects/c++/ndk_raylib/android/res/mipmap/icon.png diff --git a/tests/projects/c++/ndk_raylib/android/res/values/strings.xml b/tests/projects/c++/ndk_raylib/android/res/values/strings.xml new file mode 100644 index 000000000..e98a18284 --- /dev/null +++ b/tests/projects/c++/ndk_raylib/android/res/values/strings.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <string name="app_name">Space Defender</string> +</resources>
\ No newline at end of file diff --git a/tests/projects/c++/ndk_raylib/android/res/values/styles.xml b/tests/projects/c++/ndk_raylib/android/res/values/styles.xml new file mode 100644 index 000000000..621547380 --- /dev/null +++ b/tests/projects/c++/ndk_raylib/android/res/values/styles.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <style name="AppTheme" parent="android:Theme.NoTitleBar.Fullscreen"> + <item name="android:windowBackground">@android:color/black</item> + <item name="android:colorPrimary">#FF6200EE</item> + <item name="android:colorPrimaryDark">#FF3700B3</item> + <item name="android:colorAccent">#FF03DAC5</item> + </style> +</resources>
\ No newline at end of file diff --git a/tests/projects/c++/ndk_raylib/src/main.cpp b/tests/projects/c++/ndk_raylib/src/main.cpp new file mode 100644 index 000000000..4c8253ead --- /dev/null +++ b/tests/projects/c++/ndk_raylib/src/main.cpp @@ -0,0 +1,21 @@ +#include <raylib.h> + +int main() { + InitWindow(0, 0, "Hello, xmake for raylib android!"); + + SetTargetFPS(60); + + while (!WindowShouldClose()) { // Main game loop + BeginDrawing(); + + ClearBackground(BLACK); + + DrawText("Hello, xmake for raylib android!", 250, 250, 25, BLUE); + + EndDrawing(); + } + + CloseWindow(); + + return 0; +}
\ No newline at end of file diff --git a/tests/projects/c++/ndk_raylib/xmake.lua b/tests/projects/c++/ndk_raylib/xmake.lua new file mode 100644 index 000000000..08a102d9d --- /dev/null +++ b/tests/projects/c++/ndk_raylib/xmake.lua @@ -0,0 +1,22 @@ +add_rules("mode.debug", "mode.release") + + +add_requires("raylib 5.5.0") + +target("raydemo_android") + set_kind("binary") + set_languages("c++17") + add_files("src/main.cpp") + add_packages("raylib") + + if is_plat("android") then + + add_rules("android.native_app", { + android_sdk_version = "35", + android_manifest = "android/AndroidManifest.xml", + android_res = "android/res", + keystore = "android/debug.jks", + keystore_pass = "123456", + package_name = "com.raylib.demo" + }) + end |
