setup android project
6
Raylib-cs.Android/AndroidManifest.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?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>
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
</manifest>
|
13
Raylib-cs.Android/MainActivity.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
namespace Raylib_cs.Android;
|
||||||
|
|
||||||
|
[Activity(Label = "@string/app_name", MainLauncher = true)]
|
||||||
|
public class MainActivity : Activity
|
||||||
|
{
|
||||||
|
protected override void OnCreate(Bundle? savedInstanceState)
|
||||||
|
{
|
||||||
|
base.OnCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// Set our view from the "main" layout resource
|
||||||
|
SetContentView(Resource.Layout.activity_main);
|
||||||
|
}
|
||||||
|
}
|
16
Raylib-cs.Android/Raylib-cs.Android.csproj
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<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>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Raylib-cs" Version="4.5.0.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
44
Raylib-cs.Android/Resources/AboutResources.txt
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||||
|
in your application as resource files. Various Android APIs are designed to
|
||||||
|
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||||
|
directly.
|
||||||
|
|
||||||
|
For example, a sample Android app that contains a user interface layout (main.xml),
|
||||||
|
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||||
|
would keep its resources in the "Resources" directory of the application:
|
||||||
|
|
||||||
|
Resources/
|
||||||
|
drawable/
|
||||||
|
icon.png
|
||||||
|
|
||||||
|
layout/
|
||||||
|
main.xml
|
||||||
|
|
||||||
|
values/
|
||||||
|
strings.xml
|
||||||
|
|
||||||
|
In order to get the build system to recognize Android resources, set the build action to
|
||||||
|
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||||
|
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||||
|
the build system will package the resources for distribution and generate a class called "Resource"
|
||||||
|
(this is an Android convention) that contains the tokens for each one of the resources
|
||||||
|
included. For example, for the above Resources layout, this is what the Resource class would expose:
|
||||||
|
|
||||||
|
public class Resource {
|
||||||
|
public class Drawable {
|
||||||
|
public const int icon = 0x123;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Layout {
|
||||||
|
public const int main = 0x456;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Strings {
|
||||||
|
public const int first_string = 0xabc;
|
||||||
|
public const int second_string = 0xbcd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
You would then use Resource.Drawable.icon to reference the drawable/icon.png file, or
|
||||||
|
Resource.Layout.main to reference the layout/main.xml file, or Resource.Strings.first_string
|
||||||
|
to reference the first string in the dictionary file values/strings.xml.
|
13
Raylib-cs.Android/Resources/layout/activity_main.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:text="@string/app_text"
|
||||||
|
/>
|
||||||
|
</RelativeLayout>
|
@@ -0,0 +1,4 @@
|
|||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@mipmap/appicon_background" />
|
||||||
|
<foreground android:drawable="@mipmap/appicon_foreground" />
|
||||||
|
</adaptive-icon>
|
@@ -0,0 +1,4 @@
|
|||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@mipmap/appicon_background" />
|
||||||
|
<foreground android:drawable="@mipmap/appicon_foreground" />
|
||||||
|
</adaptive-icon>
|
BIN
Raylib-cs.Android/Resources/mipmap-hdpi/appicon.png
Normal file
After Width: | Height: | Size: 688 B |
BIN
Raylib-cs.Android/Resources/mipmap-hdpi/appicon_background.png
Normal file
After Width: | Height: | Size: 97 B |
BIN
Raylib-cs.Android/Resources/mipmap-hdpi/appicon_foreground.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
Raylib-cs.Android/Resources/mipmap-mdpi/appicon.png
Normal file
After Width: | Height: | Size: 604 B |
BIN
Raylib-cs.Android/Resources/mipmap-mdpi/appicon_background.png
Normal file
After Width: | Height: | Size: 92 B |
BIN
Raylib-cs.Android/Resources/mipmap-mdpi/appicon_foreground.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
Raylib-cs.Android/Resources/mipmap-xhdpi/appicon.png
Normal file
After Width: | Height: | Size: 830 B |
BIN
Raylib-cs.Android/Resources/mipmap-xhdpi/appicon_background.png
Normal file
After Width: | Height: | Size: 100 B |
BIN
Raylib-cs.Android/Resources/mipmap-xhdpi/appicon_foreground.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
Raylib-cs.Android/Resources/mipmap-xxhdpi/appicon.png
Normal file
After Width: | Height: | Size: 978 B |
BIN
Raylib-cs.Android/Resources/mipmap-xxhdpi/appicon_background.png
Normal file
After Width: | Height: | Size: 108 B |
BIN
Raylib-cs.Android/Resources/mipmap-xxhdpi/appicon_foreground.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
Raylib-cs.Android/Resources/mipmap-xxxhdpi/appicon.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 117 B |
After Width: | Height: | Size: 2.7 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ic_launcher_background">#2C3E50</color>
|
||||||
|
</resources>
|
4
Raylib-cs.Android/Resources/values/strings.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<resources>
|
||||||
|
<string name="app_name">Raylib_cs.Android</string>
|
||||||
|
<string name="app_text">Hello, Android!</string>
|
||||||
|
</resources>
|
@@ -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", "{FF57C585-9887-4DC1-A240-5B3D85E9C459}"
|
||||||
|
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
|
||||||
|
{FF57C585-9887-4DC1-A240-5B3D85E9C459}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{FF57C585-9887-4DC1-A240-5B3D85E9C459}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{FF57C585-9887-4DC1-A240-5B3D85E9C459}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{FF57C585-9887-4DC1-A240-5B3D85E9C459}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{FF57C585-9887-4DC1-A240-5B3D85E9C459}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{FF57C585-9887-4DC1-A240-5B3D85E9C459}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{FF57C585-9887-4DC1-A240-5B3D85E9C459}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{FF57C585-9887-4DC1-A240-5B3D85E9C459}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{FF57C585-9887-4DC1-A240-5B3D85E9C459}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{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
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|