(ded4a3e0a) v0.9.0.7
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
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");
|
||||
+44
@@ -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.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.
|
||||
+44
@@ -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.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.
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Runtime;
|
||||
using Android.Content.PM;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Android.OS;
|
||||
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace ${Namespace}
|
||||
{
|
||||
[Activity (Label = "${ProjectName}",
|
||||
MainLauncher = true,
|
||||
Icon = "@drawable/icon",
|
||||
Theme = "@style/Theme.Splash",
|
||||
AlwaysRetainTaskState=true,
|
||||
LaunchMode=LaunchMode.SingleInstance,
|
||||
ScreenOrientation = ScreenOrientation.FullUser,
|
||||
ConfigurationChanges = ConfigChanges.Orientation |
|
||||
ConfigChanges.KeyboardHidden |
|
||||
ConfigChanges.Keyboard |
|
||||
ConfigChanges.ScreenSize |
|
||||
ConfigChanges.ScreenLayout)]
|
||||
public class Activity1 : AndroidGameActivity
|
||||
{
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
||||
var g = new Game1 ();
|
||||
SetContentView (g.Services.GetService<View>());
|
||||
g.Run ();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?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="${ProjectName}">
|
||||
<uses-sdk android:minSdkVersion="10" />
|
||||
<application android:label="${ProjectName}">
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
#pragma warning disable 1591
|
||||
// ------------------------------------------------------------------------------
|
||||
// <autogenerated>
|
||||
// This code was generated by a tool.
|
||||
// Mono Runtime Version: 4.0.30319.17020
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </autogenerated>
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
[assembly: Android.Runtime.ResourceDesignerAttribute("OpenGLApplication1.Resource", IsApplication=true)]
|
||||
|
||||
namespace ${Namespace}
|
||||
{
|
||||
|
||||
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")]
|
||||
public partial class Resource
|
||||
{
|
||||
|
||||
static Resource()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
public static void UpdateIdValues()
|
||||
{
|
||||
}
|
||||
|
||||
public partial class Attribute
|
||||
{
|
||||
|
||||
static Attribute()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Attribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Drawable
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f020000
|
||||
public const int Icon = 2130837504;
|
||||
|
||||
static Drawable()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Drawable()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Id
|
||||
{
|
||||
|
||||
static Id()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Id()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class Layout
|
||||
{
|
||||
|
||||
static Layout()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private Layout()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class String
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f040001
|
||||
public const int ApplicationName = 2130968577;
|
||||
|
||||
static String()
|
||||
{
|
||||
global::Android.Runtime.ResourceIdManager.UpdateIdValues();
|
||||
}
|
||||
|
||||
private String()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore 1591
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.Splash" parent="android:Theme">
|
||||
<item name="android:windowBackground">@drawable/splash</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0"?>
|
||||
<Template>
|
||||
<TemplateConfiguration>
|
||||
<_Name>MonoGame for Android Application</_Name>
|
||||
<Category>monogame/app/games</Category>
|
||||
<Icon>monogame-project</Icon>
|
||||
<LanguageName>C#</LanguageName>
|
||||
<_Description>Creates an MonoGame for Android Project </_Description>
|
||||
</TemplateConfiguration>
|
||||
|
||||
<Actions>
|
||||
<Open filename = "Game1.cs"/>
|
||||
</Actions>
|
||||
|
||||
<Combine name = "${ProjectName}" directory = ".">
|
||||
<Options>
|
||||
<StartupProject>${ProjectName}</StartupProject>
|
||||
</Options>
|
||||
|
||||
<Project name = "${ProjectName}" directory = "." type = "MonoDroid">
|
||||
<Options
|
||||
AndroidApplication="true"
|
||||
AndroidResgenFile="Resources/Resource.designer.cs"
|
||||
AndroidResgenClass="Resource"
|
||||
TargetFrameworkVersion="MonoAndroid,Version=v5.0" />
|
||||
<References>
|
||||
<Reference type="Gac" refto="System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" />
|
||||
<Reference type="Gac" refto="System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" />
|
||||
<Reference type="Gac" refto="System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" />
|
||||
<Reference type="Gac" refto="Mono.Android" />
|
||||
<Reference type="Gac" refto="OpenTK-1.0" />
|
||||
<Reference type="Package" refto="MonoGame.Framework" />
|
||||
</References>
|
||||
<Files>
|
||||
<File name="Activity1.cs" src="Android/Activity1.cs" />
|
||||
<File name="Game1.cs" src="Common/Game1.cs" />
|
||||
<Directory name="Resources">
|
||||
<File name="Resource.designer.cs" src="Android/Resource.cs" />
|
||||
<RawFile name="AboutResources.txt" src="Android/AboutResources.txt" />
|
||||
<Directory name="drawable">
|
||||
<RawFile name="Icon.png" src="Common/Icon-md.png" />
|
||||
<RawFile name="Splash.png" src="Android/Splash.png" />
|
||||
</Directory>
|
||||
<Directory name="values">
|
||||
<RawFile name="Styles.xml" src="Android/Styles.xml" />
|
||||
</Directory>
|
||||
</Directory>
|
||||
<Directory name="Properties">
|
||||
<File name="AssemblyInfo.cs" src="Common/AssemblyInfo.cs" />
|
||||
<File name="AndroidManifest.xml" src="Android/AndroidManifest.xml" />
|
||||
</Directory>
|
||||
<Directory name="Content">
|
||||
<File name="Content.mgcb" src="Common/Content.mgcb" BuildAction="MonoGameContentReference"/>
|
||||
</Directory>
|
||||
<Directory name="Assets">
|
||||
<RawFile name="AboutAssets.txt" src="Android/AboutAssets.txt" />
|
||||
<Directory name="Content">
|
||||
</Directory>
|
||||
</Directory>
|
||||
</Files>
|
||||
</Project>
|
||||
</Combine>
|
||||
</Template>
|
||||
Reference in New Issue
Block a user