turn Raylib-cs.Android
into android library
@@ -17,14 +17,9 @@ namespace Raylib_cs.Android;
|
||||
IntentFilter(new[] { Intent.ActionMain }),
|
||||
MetaData(NativeActivity.MetaDataLibName, Value = "raylib")
|
||||
]
|
||||
public class MainActivity : NativeActivity
|
||||
public class MainActivity : RaylibActivity
|
||||
{
|
||||
static MainActivity()
|
||||
{
|
||||
RaylibSetAndroidCallback(Main);
|
||||
}
|
||||
|
||||
private static void Main()
|
||||
protected override void OnReady()
|
||||
{
|
||||
Raylib.InitWindow(0, 0, "android_window");
|
||||
while (!Raylib.WindowShouldClose())
|
||||
@@ -36,7 +31,4 @@ public class MainActivity : NativeActivity
|
||||
Raylib.EndDrawing();
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("raylib")]
|
||||
private static extern void RaylibSetAndroidCallback(Action callback);
|
||||
}
|
18
Raylib-cs.Android.Sample/Raylib-cs.Android.Sample.csproj
Normal file
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0-android</TargetFramework>
|
||||
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
||||
<RootNamespace>Raylib_cs.Android.Sample</RootNamespace>
|
||||
<OutputType>Exe</OutputType>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ApplicationId>com.raylib.cs</ApplicationId>
|
||||
<ApplicationVersion>1</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||
<EmbedAssembliesIntoApk Condition="$(Configuration) == 'Debug'">true</EmbedAssembliesIntoApk>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Raylib-cs" Version="4.5.0.2" />
|
||||
<ProjectReference Include="../Raylib-cs.Android/Raylib-cs.Android.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
Before Width: | Height: | Size: 688 B After Width: | Height: | Size: 688 B |
Before Width: | Height: | Size: 97 B After Width: | Height: | Size: 97 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 604 B After Width: | Height: | Size: 604 B |
Before Width: | Height: | Size: 92 B After Width: | Height: | Size: 92 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 830 B After Width: | Height: | Size: 830 B |
Before Width: | Height: | Size: 100 B After Width: | Height: | Size: 100 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 978 B After Width: | Height: | Size: 978 B |
Before Width: | Height: | Size: 108 B After Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 117 B After Width: | Height: | Size: 117 B |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
@@ -1,16 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0-android</TargetFramework>
|
||||
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
||||
<RootNamespace>Raylib_cs.Android</RootNamespace>
|
||||
<OutputType>Exe</OutputType>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ApplicationId>com.companyname.Raylib_cs.Android</ApplicationId>
|
||||
<ApplicationVersion>1</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||
<AssemblyName>Raylibcs.Android</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Raylib-cs" Version="4.5.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
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")]
|
||||
private static extern void RaylibSetAndroidCallback(Action callback);
|
||||
}
|
@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Raylib-cs.Tests", "Raylib-c
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raylib-cs.Android", "Raylib-cs.Android\Raylib-cs.Android.csproj", "{FF57C585-9887-4DC1-A240-5B3D85E9C459}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Raylib-cs.Android.Sample", "Raylib-cs.Android.Sample\Raylib-cs.Android.Sample.csproj", "{83FB8D25-FD15-4893-9F57-1736D2C0F616}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -39,6 +41,18 @@ Global
|
||||
{FF57C585-9887-4DC1-A240-5B3D85E9C459}.Release|x64.Build.0 = Release|Any CPU
|
||||
{FF57C585-9887-4DC1-A240-5B3D85E9C459}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{FF57C585-9887-4DC1-A240-5B3D85E9C459}.Release|x86.Build.0 = Release|Any CPU
|
||||
{83FB8D25-FD15-4893-9F57-1736D2C0F616}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{83FB8D25-FD15-4893-9F57-1736D2C0F616}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{83FB8D25-FD15-4893-9F57-1736D2C0F616}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{83FB8D25-FD15-4893-9F57-1736D2C0F616}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{83FB8D25-FD15-4893-9F57-1736D2C0F616}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{83FB8D25-FD15-4893-9F57-1736D2C0F616}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{83FB8D25-FD15-4893-9F57-1736D2C0F616}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{83FB8D25-FD15-4893-9F57-1736D2C0F616}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{83FB8D25-FD15-4893-9F57-1736D2C0F616}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{83FB8D25-FD15-4893-9F57-1736D2C0F616}.Release|x64.Build.0 = Release|Any CPU
|
||||
{83FB8D25-FD15-4893-9F57-1736D2C0F616}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{83FB8D25-FD15-4893-9F57-1736D2C0F616}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|