2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-09-09 03:01:41 -04:00

first working android build

This commit is contained in:
anggape
2023-07-22 18:24:03 +07:00
parent 49168d2f39
commit f964d72806
3 changed files with 40 additions and 8 deletions

View File

@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:label="@string/app_name" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true">
<application android:allowBackup="true" android:icon="@mipmap/appicon"
android:label="@string/app_name" android:roundIcon="@mipmap/appicon_round"
android:supportsRtl="true">
</application>
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

View File

@@ -0,0 +1 @@
[assembly: UsesFeature(GLESVersion = 0x00020000, Required = true)]

View File

@@ -1,13 +1,42 @@
using System.Runtime.InteropServices;
using Android.Content;
using Android.Content.PM;
namespace Raylib_cs.Android;
[Activity(Label = "@string/app_name", MainLauncher = true)]
public class MainActivity : Activity
[
Activity(
Label = "@string/app_name",
MainLauncher = true,
ConfigurationChanges = ConfigChanges.Orientation
| ConfigChanges.KeyboardHidden
| ConfigChanges.ScreenSize,
ScreenOrientation = ScreenOrientation.Landscape,
ClearTaskOnLaunch = true
),
IntentFilter(new[] { Intent.ActionMain }),
MetaData(NativeActivity.MetaDataLibName, Value = "raylib")
]
public class MainActivity : NativeActivity
{
protected override void OnCreate(Bundle? savedInstanceState)
static MainActivity()
{
base.OnCreate(savedInstanceState);
RaylibSetAndroidCallback(Main);
}
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.activity_main);
private static void Main()
{
Raylib.InitWindow(0, 0, "android_window");
while (!Raylib.WindowShouldClose())
{
Raylib.BeginDrawing();
Raylib.ClearBackground(Color.WHITE);
Raylib.DrawFPS(10, 10);
Raylib.DrawText("Hello Raylib-cs.Android", 20, 100, 100, Color.BLACK);
Raylib.EndDrawing();
}
}
[DllImport("raylib")]
private static extern void RaylibSetAndroidCallback(Action callback);
}