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:
@@ -1,6 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<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>
|
</application>
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
</manifest>
|
</manifest>
|
1
Raylib-cs.Android/Assembly.cs
Normal file
1
Raylib-cs.Android/Assembly.cs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[assembly: UsesFeature(GLESVersion = 0x00020000, Required = true)]
|
@@ -1,13 +1,42 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Android.Content;
|
||||||
|
using Android.Content.PM;
|
||||||
|
|
||||||
namespace Raylib_cs.Android;
|
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
|
private static void Main()
|
||||||
SetContentView(Resource.Layout.activity_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);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user