add Raylib-cs.Android project
This commit is contained in:
parent
23ed54cc24
commit
570ccef6af
8 changed files with 73 additions and 0 deletions
15
Raylib-cs.Android/Raylib-cs.Android.csproj
Normal file
15
Raylib-cs.Android/Raylib-cs.Android.csproj
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>net6.0-android;net7.0-android</TargetFrameworks>
|
||||||
|
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
||||||
|
<RootNamespace>Raylib_cs</RootNamespace>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="../Raylib-cs/Raylib-cs.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
17
Raylib-cs.Android/RaylibActivity.cs
Normal file
17
Raylib-cs.Android/RaylibActivity.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Raylib_cs;
|
||||||
|
|
||||||
|
public abstract class RaylibActivity : NativeActivity
|
||||||
|
{
|
||||||
|
protected override void OnCreate(Bundle? savedInstanceState)
|
||||||
|
{
|
||||||
|
base.OnCreate(savedInstanceState);
|
||||||
|
RaylibSetAndroidCallback(OnReady);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void OnReady();
|
||||||
|
|
||||||
|
[DllImport(Raylib.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
private static extern void RaylibSetAndroidCallback(Action callback);
|
||||||
|
}
|
||||||
27
Raylib-cs.Android/android.patch
Normal file
27
Raylib-cs.Android/android.patch
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
diff --git a/src/rcore.c b/src/rcore.c
|
||||||
|
index eae4951..4400b22 100644
|
||||||
|
--- a/src/rcore.c
|
||||||
|
+++ b/src/rcore.c
|
||||||
|
@@ -1,3 +1,22 @@
|
||||||
|
+#if defined (PLATFORM_ANDROID)
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+
|
||||||
|
+typedef void (*RaylibAndroidCallback)();
|
||||||
|
+static RaylibAndroidCallback _androidCallback = NULL;
|
||||||
|
+
|
||||||
|
+void RaylibSetAndroidCallback(RaylibAndroidCallback callback) {
|
||||||
|
+ _androidCallback = callback;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int main(int argc, char *argv[]) {
|
||||||
|
+ (void)argc;
|
||||||
|
+ (void)argv;
|
||||||
|
+ while (_androidCallback == NULL) {
|
||||||
|
+ }
|
||||||
|
+ _androidCallback();
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/**********************************************************************************************
|
||||||
|
*
|
||||||
|
* rcore - Basic functions to manage windows, OpenGL context and input on multiple platforms
|
||||||
0
Raylib-cs.Android/runtimes/android-arm/native/.keep
Normal file
0
Raylib-cs.Android/runtimes/android-arm/native/.keep
Normal file
0
Raylib-cs.Android/runtimes/android-arm64/native/.keep
Normal file
0
Raylib-cs.Android/runtimes/android-arm64/native/.keep
Normal file
0
Raylib-cs.Android/runtimes/android-x64/native/.keep
Normal file
0
Raylib-cs.Android/runtimes/android-x64/native/.keep
Normal file
0
Raylib-cs.Android/runtimes/android-x86/native/.keep
Normal file
0
Raylib-cs.Android/runtimes/android-x86/native/.keep
Normal file
|
|
@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raylib-cs", "Raylib-cs\Rayl
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Raylib-cs.Tests", "Raylib-cs.Tests\Raylib-cs.Tests.csproj", "{523DEE6A-20CD-47AB-94A6-8D3C3CF9ADAD}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Raylib-cs.Tests", "Raylib-cs.Tests\Raylib-cs.Tests.csproj", "{523DEE6A-20CD-47AB-94A6-8D3C3CF9ADAD}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raylib-cs.Android", "Raylib-cs.Android\Raylib-cs.Android.csproj", "{8C2B9C24-3926-4B3A-902C-6429CF4864AA}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -25,6 +27,18 @@ Global
|
||||||
{523DEE6A-20CD-47AB-94A6-8D3C3CF9ADAD}.Release|Any CPU.Build.0 = Release|Any CPU
|
{523DEE6A-20CD-47AB-94A6-8D3C3CF9ADAD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{523DEE6A-20CD-47AB-94A6-8D3C3CF9ADAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{523DEE6A-20CD-47AB-94A6-8D3C3CF9ADAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{523DEE6A-20CD-47AB-94A6-8D3C3CF9ADAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{523DEE6A-20CD-47AB-94A6-8D3C3CF9ADAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8C2B9C24-3926-4B3A-902C-6429CF4864AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{8C2B9C24-3926-4B3A-902C-6429CF4864AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{8C2B9C24-3926-4B3A-902C-6429CF4864AA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{8C2B9C24-3926-4B3A-902C-6429CF4864AA}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{8C2B9C24-3926-4B3A-902C-6429CF4864AA}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{8C2B9C24-3926-4B3A-902C-6429CF4864AA}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{8C2B9C24-3926-4B3A-902C-6429CF4864AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{8C2B9C24-3926-4B3A-902C-6429CF4864AA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{8C2B9C24-3926-4B3A-902C-6429CF4864AA}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{8C2B9C24-3926-4B3A-902C-6429CF4864AA}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{8C2B9C24-3926-4B3A-902C-6429CF4864AA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{8C2B9C24-3926-4B3A-902C-6429CF4864AA}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue