Convert android project to example project
This commit is contained in:
parent
df2b089119
commit
d716a80775
9 changed files with 21 additions and 13 deletions
8
.github/workflows/build.yml
vendored
8
.github/workflows/build.yml
vendored
|
|
@ -254,15 +254,15 @@ jobs:
|
|||
- name: Build and run tests
|
||||
run: dotnet test Raylib-cs.Tests -c Release
|
||||
|
||||
- name: Build examples
|
||||
- name: Build examples desktop
|
||||
run: dotnet build Examples -c Release
|
||||
|
||||
- name: Build examples android
|
||||
run: dotnet build Examples.Android -c Release
|
||||
|
||||
- name: Create NuGet Package
|
||||
run: dotnet pack Raylib-cs -c Release --output nuget
|
||||
|
||||
- name: Create NuGet Package
|
||||
run: dotnet pack Raylib-cs.Android -c Release --output nuget
|
||||
|
||||
- name: Upload NuGet Package As Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
|
|
|||
25
Examples.Android/Examples.Android.csproj
Normal file
25
Examples.Android/Examples.Android.csproj
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net6.0-android;net7.0-android</TargetFrameworks>
|
||||
<RootNamespace>Examples.Android</RootNamespace>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
||||
<ApplicationId>com.raylibcs.android</ApplicationId>
|
||||
<ApplicationVersion>1</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Raylib-cs/Raylib-cs.csproj" />
|
||||
<ProjectReference Include="../Examples/Examples.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="../Raylib-cs/Build.props" />
|
||||
|
||||
</Project>
|
||||
17
Examples.Android/RaylibActivity.cs
Normal file
17
Examples.Android/RaylibActivity.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Examples.Android;
|
||||
|
||||
public abstract class RaylibActivity : NativeActivity
|
||||
{
|
||||
protected override void OnCreate(Bundle? savedInstanceState)
|
||||
{
|
||||
RaylibSetAndroidCallback(OnReady);
|
||||
base.OnCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
protected abstract void OnReady();
|
||||
|
||||
[DllImport(Raylib.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern void RaylibSetAndroidCallback(Action callback);
|
||||
}
|
||||
27
Examples.Android/android.patch
Normal file
27
Examples.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
Examples.Android/runtimes/android-arm/native/.keep
Normal file
0
Examples.Android/runtimes/android-arm/native/.keep
Normal file
0
Examples.Android/runtimes/android-arm64/native/.keep
Normal file
0
Examples.Android/runtimes/android-arm64/native/.keep
Normal file
0
Examples.Android/runtimes/android-x64/native/.keep
Normal file
0
Examples.Android/runtimes/android-x64/native/.keep
Normal file
0
Examples.Android/runtimes/android-x86/native/.keep
Normal file
0
Examples.Android/runtimes/android-x86/native/.keep
Normal file
|
|
@ -5,12 +5,12 @@ VisualStudioVersion = 17.0.31903.59
|
|||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raylib-cs", "Raylib-cs\Raylib-cs.csproj", "{236DB383-2FDC-4A77-8B33-22122D9B8950}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raylib-cs.Android", "Raylib-cs.Android\Raylib-cs.Android.csproj", "{F854D9EC-B7BE-47EE-B51B-3918E57973BC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raylib-cs.Tests", "Raylib-cs.Tests\Raylib-cs.Tests.csproj", "{1341D222-7E10-42C6-BC6E-4A46C934A843}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples", "Examples\Examples.csproj", "{1E2A5986-3F11-457F-AF97-D0C08D0060BA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Examples.Android", "Examples.Android\Examples.Android.csproj", "{EC189309-7F82-4029-93E4-BFA2793FD784}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
|
@ -24,10 +24,6 @@ Global
|
|||
{236DB383-2FDC-4A77-8B33-22122D9B8950}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{236DB383-2FDC-4A77-8B33-22122D9B8950}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{236DB383-2FDC-4A77-8B33-22122D9B8950}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F854D9EC-B7BE-47EE-B51B-3918E57973BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F854D9EC-B7BE-47EE-B51B-3918E57973BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F854D9EC-B7BE-47EE-B51B-3918E57973BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F854D9EC-B7BE-47EE-B51B-3918E57973BC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1341D222-7E10-42C6-BC6E-4A46C934A843}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1341D222-7E10-42C6-BC6E-4A46C934A843}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1341D222-7E10-42C6-BC6E-4A46C934A843}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
|
@ -36,5 +32,9 @@ Global
|
|||
{1E2A5986-3F11-457F-AF97-D0C08D0060BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1E2A5986-3F11-457F-AF97-D0C08D0060BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1E2A5986-3F11-457F-AF97-D0C08D0060BA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EC189309-7F82-4029-93E4-BFA2793FD784}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EC189309-7F82-4029-93E4-BFA2793FD784}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EC189309-7F82-4029-93E4-BFA2793FD784}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EC189309-7F82-4029-93E4-BFA2793FD784}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
Loading…
Reference in a new issue