Take @miterosan's suggestions, fix SampleGame.Android
@@ -3,28 +3,18 @@
|
||||
|
||||
using Android.App;
|
||||
using Android.OS;
|
||||
using Android.Widget;
|
||||
using osu.Framework.Android;
|
||||
using System;
|
||||
using Android.Content.PM;
|
||||
|
||||
namespace SampleGame.Android
|
||||
{
|
||||
[Activity(Label = "SampleGame", MainLauncher = true, Icon = "@mipmap/icon")]
|
||||
[Activity(Label = "SampleGame", MainLauncher = true, ScreenOrientation = ScreenOrientation.Landscape)]
|
||||
public class MainActivity : Activity
|
||||
{
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
SetContentView(Resource.Layout.Main);
|
||||
|
||||
//Button button = FindViewById<Button>(Resource.Id.button1);
|
||||
//button.Click += OnClick;
|
||||
SetContentView(new SampleGameView(this));
|
||||
}
|
||||
/*private void OnClick(object sender, EventArgs e)
|
||||
{
|
||||
SampleGameView view = new SampleGameView(this);
|
||||
SetContentView(view);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="ppy.SampleGame" android:installLocation="auto">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="26" />
|
||||
<application android:allowBackup="true" android:label="@string/app_name"></application>
|
||||
<application android:allowBackup="true" android:label="@string/app_name" />
|
||||
</manifest>
|
||||
43
SampleGame.Android/Resources/Resource.designer.cs
generated
@@ -41,34 +41,27 @@ namespace SampleGame.Android
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Id
|
||||
public partial class Color
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f050000
|
||||
public const int sampleGameView1 = 2131034112;
|
||||
|
||||
static Id()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Id()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Layout
|
||||
{
|
||||
// aapt resource value: 0x7f030002
|
||||
public const int colorAccent = 2130903042;
|
||||
|
||||
// aapt resource value: 0x7f030000
|
||||
public const int Main = 2130903040;
|
||||
public const int colorPrimary = 2130903040;
|
||||
|
||||
static Layout()
|
||||
// aapt resource value: 0x7f030001
|
||||
public const int colorPrimaryDark = 2130903041;
|
||||
|
||||
// aapt resource value: 0x7f030003
|
||||
public const int ic_launcher_background = 2130903043;
|
||||
|
||||
static Color()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Layout()
|
||||
private Color()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -77,7 +70,13 @@ namespace SampleGame.Android
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f020000
|
||||
public const int Icon = 2130837504;
|
||||
public const int ic_launcher = 2130837504;
|
||||
|
||||
// aapt resource value: 0x7f020001
|
||||
public const int ic_launcher_foreground = 2130837505;
|
||||
|
||||
// aapt resource value: 0x7f020002
|
||||
public const int ic_launcher_round = 2130837506;
|
||||
|
||||
static Mipmap()
|
||||
{
|
||||
@@ -93,10 +92,10 @@ namespace SampleGame.Android
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f040001
|
||||
public const int app_name = 2130968577;
|
||||
public const int action_settings = 2130968577;
|
||||
|
||||
// aapt resource value: 0x7f040000
|
||||
public const int hello = 2130968576;
|
||||
public const int app_name = 2130968576;
|
||||
|
||||
static String()
|
||||
{
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="25px"
|
||||
android:minHeight="25px">
|
||||
<!--<TextView
|
||||
android:text="By pressing this button, you accept the fact that osu!lazer is completely unstable and will crash randomly."
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textView1"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginLeft="10px"
|
||||
android:layout_marginRight="10px"
|
||||
android:textSize="16dp" />-->
|
||||
<SampleGame.Android.SampleGameView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/sampleGameView1" />
|
||||
<!--<Button
|
||||
android:text="Button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/button1" />-->
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
BIN
SampleGame.Android/Resources/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
BIN
SampleGame.Android/Resources/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
SampleGame.Android/Resources/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 958 B |
BIN
SampleGame.Android/Resources/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
SampleGame.Android/Resources/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
BIN
SampleGame.Android/Resources/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 4.7 KiB |
BIN
SampleGame.Android/Resources/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
BIN
SampleGame.Android/Resources/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
SampleGame.Android/Resources/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 11 KiB |
4
SampleGame.Android/Resources/values/Strings.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<resources>
|
||||
<string name="app_name">SampleGame.Android</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
</resources>
|
||||
6
SampleGame.Android/Resources/values/colors.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#2c3e50</color>
|
||||
<color name="colorPrimaryDark">#1B3147</color>
|
||||
<color name="colorAccent">#3498db</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#2C3E50</color>
|
||||
</resources>
|
||||
@@ -83,8 +83,6 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="SampleGameView.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -105,23 +103,10 @@
|
||||
</None>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Main.axml" />
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\Icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\drawable\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidAsset Include="Assets\AboutAssets.txt" />
|
||||
<Folder Include="Assets\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\osu.Framework.Android\osu.Framework.Android.csproj">
|
||||
@@ -140,5 +125,65 @@
|
||||
<ItemGroup>
|
||||
<None Include="bass.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\values\colors.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\values\ic_launcher_background.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-anydpi-v26\ic_launcher.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-anydpi-v26\ic_launcher_round.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher_foreground.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher_round.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher_foreground.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher_round.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher_foreground.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher_round.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher_foreground.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher_round.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher_foreground.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher_round.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -24,13 +24,6 @@ namespace osu.Framework.Android
|
||||
this.gameView = gameView;
|
||||
AndroidGameWindow.view = gameView;
|
||||
Window = new AndroidGameWindow();
|
||||
/*Window.WindowStateChanged += (sender, e) =>
|
||||
{
|
||||
if (Window.WindowState != WindowState.Minimized)
|
||||
OnActivated();
|
||||
else
|
||||
OnDeactivated();
|
||||
};*/
|
||||
}
|
||||
|
||||
public override ITextInputSource GetTextInput() => new AndroidTextInput(gameView);
|
||||
@@ -45,5 +38,10 @@ namespace osu.Framework.Android
|
||||
public override void OpenUrlExternally(string url) => throw new NotImplementedException();
|
||||
|
||||
public override IResourceStore<TextureUpload> CreateTextureLoaderStore(IResourceStore<byte[]> underlyingStore) => new AndroidTextureLoaderStore(underlyingStore);
|
||||
|
||||
protected override void PerformExit(bool immediately)
|
||||
{
|
||||
// Do not exit on Android, Window.Run() does not block
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ using System;
|
||||
using Android.Content;
|
||||
using Android.Runtime;
|
||||
using Android.Util;
|
||||
using osu.Framework.Graphics.OpenGL;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Framework.Android
|
||||
@@ -13,11 +12,8 @@ namespace osu.Framework.Android
|
||||
public abstract class AndroidGameView : osuTK.Android.AndroidGameView
|
||||
{
|
||||
int viewportWidth, viewportHeight;
|
||||
int program;
|
||||
|
||||
int Framebuffer;
|
||||
|
||||
private AndroidGameHost host;
|
||||
|
||||
public abstract Game CreateGame();
|
||||
|
||||
public AndroidGameView(Context context) : base(context)
|
||||
@@ -41,12 +37,8 @@ namespace osu.Framework.Android
|
||||
{
|
||||
try
|
||||
{
|
||||
//GraphicsMode = new GraphicsMode();
|
||||
base.CreateFrameBuffer();
|
||||
Log.Verbose("AndroidGameView", "Successfully loaded");
|
||||
|
||||
// Perhaps I should modify osuTK again before I do this.
|
||||
//GLWrapper.DefaultFrameBuffer = Framebuffer;
|
||||
return;
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -56,10 +48,6 @@ namespace osu.Framework.Android
|
||||
throw new Exception("Can't load egl, aborting");
|
||||
}
|
||||
|
||||
// Perhaps I should modify osuTK again before I do this.
|
||||
/*private bool needsResizeFrameBuffer;
|
||||
public void RequestResizeFrameBuffer() => needsResizeFrameBuffer = true;*/
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
@@ -23,7 +23,6 @@ namespace osu.Framework.Android
|
||||
|
||||
public override void SetupWindow(FrameworkConfigManager config)
|
||||
{
|
||||
//throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void Run()
|
||||
|
||||
@@ -15,68 +15,17 @@ namespace osu.Framework.Android
|
||||
public AndroidStorage(string baseName, GameHost host)
|
||||
: base(baseName, host)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//Dopilnuj, aby zamieniać ścieżki względne na bezwzględne
|
||||
|
||||
protected override string LocateBasePath()
|
||||
{
|
||||
return Application.Context.GetExternalFilesDir("").ToString();
|
||||
}
|
||||
|
||||
/*public override IEnumerable<string> GetFiles(string path) => (string[])Directory.EnumerateFiles(GetFullPath(path));
|
||||
public override IEnumerable<string> GetDirectories(string path) => Directory.GetDirectories(GetFullPath(path));
|
||||
public override void Delete(string path)
|
||||
{
|
||||
FileSafety.FileDelete(GetFullPath(path));
|
||||
}
|
||||
public override bool Exists(string path)
|
||||
{
|
||||
return File.Exists(GetFullPath(path));
|
||||
}
|
||||
public override void DeleteDirectory(string path)
|
||||
{
|
||||
path = GetFullPath(path);
|
||||
// handles the case where the directory doesn't exist, which will throw a DirectoryNotFoundException.
|
||||
if (Directory.Exists(path))
|
||||
Directory.Delete(path, true);
|
||||
}
|
||||
public override bool ExistsDirectory(string path) => Directory.Exists(GetUsablePathFor(path));
|
||||
public override Stream GetStream(string path, FileAccess access = FileAccess.Read, FileMode mode = FileMode.OpenOrCreate)
|
||||
{
|
||||
path = GetUsablePathFor(path, access != FileAccess.Read);
|
||||
if (string.IsNullOrEmpty(path))
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
switch (access)
|
||||
{
|
||||
case FileAccess.Read:
|
||||
if (!File.Exists(path)) return null;
|
||||
return File.Open(path, FileMode.Open, access, FileShare.Read);
|
||||
default:
|
||||
return File.Open(path, mode, access);
|
||||
}
|
||||
}
|
||||
public override string GetDatabaseConnectionString(string name)
|
||||
{
|
||||
return string.Concat("Data Source=", GetUsablePathFor($@"{name}.db", true));
|
||||
}
|
||||
public override void DeleteDatabase(string name) => Delete($@"{name}.db");*/
|
||||
|
||||
public override void OpenInNativeExplorer()
|
||||
{
|
||||
//Not needed now.
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/*public override string GetFullPath(string path, bool createIfNotExisting = false)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override Stream GetStream(string path, FileAccess access = FileAccess.Read, FileMode mode = FileMode.OpenOrCreate)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,7 @@ using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.IO.Stores;
|
||||
using SixLabors.ImageSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Framework.Android.Graphics.Textures
|
||||
{
|
||||
@@ -23,19 +18,30 @@ namespace osu.Framework.Android.Graphics.Textures
|
||||
|
||||
protected override Image<TPixel> ImageFromStream<TPixel>(Stream stream)
|
||||
{
|
||||
var uiImage = BitmapFactory.DecodeStream(stream);
|
||||
/*var uiImage = BitmapFactory.DecodeStream(stream);
|
||||
int[] bytes = new int[uiImage.Width * uiImage.Height];
|
||||
uiImage.GetPixels(bytes, 0, uiImage.RowBytes, 0, 0, uiImage.Width, uiImage.Height);
|
||||
int width = uiImage.Width;
|
||||
int height = uiImage.Height;
|
||||
IntPtr data = Marshal.AllocHGlobal(width * height * 4);
|
||||
|
||||
using (Canvas canvas = new Canvas(uiImage))
|
||||
canvas.DrawBitmap(uiImage, new Rect(0, 0, width, height), new RectF(0, 0, width, height), new Paint());
|
||||
canvas.DrawBitmap(uiImage, new Matrix(), new Paint());
|
||||
|
||||
var pixels = new byte[width * height * 4];
|
||||
Marshal.Copy(data, pixels, 0, pixels.Length);
|
||||
byte[] pixels = new byte[width * height * 4];
|
||||
|
||||
Marshal.Copy(data, bytes, 0, pixels.Length);
|
||||
Marshal.FreeHGlobal(data);
|
||||
|
||||
return Image.LoadPixelData<TPixel>(pixels, width, height);
|
||||
return Image.LoadPixelData<TPixel>(pixels, width, height);*/
|
||||
using (var bitmap = BitmapFactory.DecodeStream(stream))
|
||||
{
|
||||
var pixels = new int[bitmap.Width * bitmap.Height];
|
||||
bitmap.GetPixels(pixels, 0, bitmap.Width, 0, 0, bitmap.Width, bitmap.Height);
|
||||
byte[] result = new byte[pixels.Length * sizeof(int)];
|
||||
Buffer.BlockCopy(pixels, 0, result, 0, result.Length);
|
||||
return Image.LoadPixelData<TPixel>(result, bitmap.Width, bitmap.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
Any raw assets you want to be deployed with your application can be placed in
|
||||
this directory (and child directories) and given a Build Action of "AndroidAsset".
|
||||
|
||||
These files will be deployed with you package and will be accessible using Android's
|
||||
AssetManager, like this:
|
||||
|
||||
public class ReadAsset : Activity
|
||||
{
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
||||
InputStream input = Assets.Open ("my_asset.txt");
|
||||
}
|
||||
}
|
||||
|
||||
Additionally, some Android functions will automatically load asset files:
|
||||
|
||||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
|
||||
@@ -5,8 +5,6 @@ using Android.App;
|
||||
using Android.Content.PM;
|
||||
using Android.OS;
|
||||
using Android.Support.V7.App;
|
||||
using Android.Runtime;
|
||||
using Android.Widget;
|
||||
|
||||
namespace osu.Framework.Tests.Android
|
||||
{
|
||||
|
||||
@@ -4,6 +4,5 @@
|
||||
android:versionName="1.0"
|
||||
package="osu.Framework.Tests.Android.osu.Framework.Tests.Android">
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="27" />
|
||||
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme">
|
||||
</application>
|
||||
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" />
|
||||
</manifest>
|
||||
|
||||
@@ -10,24 +10,6 @@ using Android.App;
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("osu.Framework.Tests.Android")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("osu.Framework.Tests.Android")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
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.axml),
|
||||
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.axml
|
||||
|
||||
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 "R"
|
||||
(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 R class would expose:
|
||||
|
||||
public class R {
|
||||
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 R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
|
||||
to reference the layout/main.axml file, or R.strings.first_string to reference the first
|
||||
string in the dictionary file values/strings.xml.
|
||||
@@ -62,7 +62,18 @@
|
||||
<Compile Include="TestGameView.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<AndroidNativeLibrary Include="lib\arm64-v8a\libbass.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</AndroidNativeLibrary>
|
||||
<AndroidNativeLibrary Include="lib\arm64-v8a\libbass_fx.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</AndroidNativeLibrary>
|
||||
<AndroidNativeLibrary Include="lib\armeabi-v7a\libbass.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</AndroidNativeLibrary>
|
||||
<AndroidNativeLibrary Include="lib\armeabi-v7a\libbass_fx.so">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</AndroidNativeLibrary>
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
<None Include="Assets\AboutAssets.txt" />
|
||||
</ItemGroup>
|
||||
@@ -126,6 +137,7 @@
|
||||
<Compile Include="..\osu.Framework.Tests\*.cs" Exclude="**\Program.cs">
|
||||
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
|
||||
</Compile>
|
||||
<None Include="bass.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Android.Support.Design" Version="27.0.2.1" />
|
||||
@@ -141,11 +153,4 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||