Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding new cross-platform walking game to replace the platform-specif…
…ic projects.
  • Loading branch information
vchelaru committed Jun 9, 2015
1 parent d604023 commit ea762a1
Show file tree
Hide file tree
Showing 30 changed files with 974 additions and 0 deletions.
38 changes: 38 additions & 0 deletions WalkingGameMG/Android/Activity1.cs
@@ -0,0 +1,38 @@
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 WalkingGame.Droid
{
[Activity (Label = "WalkingGame.Droid",
MainLauncher = true,
Icon = "@drawable/icon",
Theme = "@style/Theme.Splash",
AlwaysRetainTaskState = true,
LaunchMode = LaunchMode.SingleInstance,
ConfigurationChanges = ConfigChanges.Orientation |
ConfigChanges.KeyboardHidden |
ConfigChanges.Keyboard)]
public class Activity1 : AndroidGameActivity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);

var g = new Game1();
SetContentView((View)g.Services.GetService(typeof(View)));
g.Run();
}

}
}


19 changes: 19 additions & 0 deletions WalkingGameMG/Android/Assets/AboutAssets.txt
@@ -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");
13 changes: 13 additions & 0 deletions WalkingGameMG/Android/Assets/Content/Content.mgcb
@@ -0,0 +1,13 @@
#----------------------------- Global Properties ----------------------------#

/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:Windows
/config:
/profile:Reach
/compress:False

#-------------------------------- References --------------------------------#


#---------------------------------- Content ---------------------------------#
6 changes: 6 additions & 0 deletions WalkingGameMG/Android/Properties/AndroidManifest.xml
@@ -0,0 +1,6 @@
<?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="WalkingGame.Droid">
<uses-sdk android:minSdkVersion="10" />
<application android:label="WalkingGame.Droid">
</application>
</manifest>
31 changes: 31 additions & 0 deletions WalkingGameMG/Android/Properties/AssemblyInfo.cs
@@ -0,0 +1,31 @@
using System.Reflection;
using System.Runtime.CompilerServices;

#if __ANDROID__
using Android.App;
#endif

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle ("WalkingGame.Droid")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("vchelaru")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion ("1.0.0")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

44 changes: 44 additions & 0 deletions WalkingGameMG/Android/Resources/AboutResources.txt
@@ -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.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions WalkingGameMG/Android/Resources/values/Styles.xml
@@ -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>
74 changes: 74 additions & 0 deletions WalkingGameMG/Android/WalkingGame.Droid.csproj
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{0A2B68ED-3550-4894-958D-8643609E3085}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>WalkingGame.Droid</RootNamespace>
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
<AndroidResgenClass>Resource</AndroidResgenClass>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidApplication>True</AndroidApplication>
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
<AssemblyName>WalkingGame.Droid</AssemblyName>
<TargetFrameworkVersion>v4.4.87</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Mono.Android" />
<Reference Include="OpenTK" />
<Reference Include="MonoGame.Framework">
<HintPath>..\packages\MonoGame.Framework.Android.3.3.0.0\lib\MonoAndroid\MonoGame.Framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Activity1.cs" />
<Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
<None Include="Properties\AndroidManifest.xml" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\Icon.png" />
<AndroidResource Include="Resources\drawable\Splash.png" />
<AndroidResource Include="Resources\values\Styles.xml" />
</ItemGroup>
<ItemGroup>
<AndroidAsset Include="Assets\AboutAssets.txt" />
<AndroidAsset Include="Assets\Content\Content.mgcb" />
<AndroidAsset Include="..\iOS\Content\charactersheet.png">
<Link>Assets\Content\charactersheet.png</Link>
</AndroidAsset>
</ItemGroup>
<Import Project="..\WalkingGame\WalkingGame.projitems" Label="Shared" Condition="Exists('..\WalkingGame\WalkingGame.projitems')" />
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
</Project>
4 changes: 4 additions & 0 deletions WalkingGameMG/Android/packages.config
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MonoGame.Framework.Android" version="3.3.0.0" targetFramework="MonoAndroid50" />
</packages>
9 changes: 9 additions & 0 deletions WalkingGameMG/Metadata.xml
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<SampleMetadata>
<ID>29cc8613-fdb7-4fe2-82b4-9921eafd4e58</ID>
<IsFullApplication>false</IsFullApplication>
<Level>Beginning</Level>
<LicenseRequirement>Indie</LicenseRequirement>
<Tags>Getting Started, Games</Tags>
<Gallery>true</Gallery>
</SampleMetadata>
13 changes: 13 additions & 0 deletions WalkingGameMG/README.md
@@ -0,0 +1,13 @@
MonoGame WalkingGame Project for iOS and Android
====================================

This is a small demo game using MonoGame for iOS and Android, using a shared code project. It is the result of working through the the entire Introduction to Monogame walkthrough.

The demo can be played by touching the screen to move the character around the screen.

It is built against MonoGame 3.3.

Author
------

Victor Chelaru
Binary file added WalkingGameMG/Screenshots/Screenshot1.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions WalkingGameMG/WalkingGame.sln
@@ -0,0 +1,45 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "WalkingGame", "WalkingGame\WalkingGame.shproj", "{DC1CF201-F64E-420F-BEEA-849CFF7F9122}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WalkingGame.iOS", "iOS\WalkingGame.iOS.csproj", "{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WalkingGame.Droid", "Android\WalkingGame.Droid.csproj", "{0A2B68ED-3550-4894-958D-8643609E3085}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhone = Release|iPhone
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0A2B68ED-3550-4894-958D-8643609E3085}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A2B68ED-3550-4894-958D-8643609E3085}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A2B68ED-3550-4894-958D-8643609E3085}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{0A2B68ED-3550-4894-958D-8643609E3085}.Debug|iPhone.Build.0 = Debug|Any CPU
{0A2B68ED-3550-4894-958D-8643609E3085}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{0A2B68ED-3550-4894-958D-8643609E3085}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{0A2B68ED-3550-4894-958D-8643609E3085}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A2B68ED-3550-4894-958D-8643609E3085}.Release|Any CPU.Build.0 = Release|Any CPU
{0A2B68ED-3550-4894-958D-8643609E3085}.Release|iPhone.ActiveCfg = Release|Any CPU
{0A2B68ED-3550-4894-958D-8643609E3085}.Release|iPhone.Build.0 = Release|Any CPU
{0A2B68ED-3550-4894-958D-8643609E3085}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0A2B68ED-3550-4894-958D-8643609E3085}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}.Debug|iPhone.ActiveCfg = Debug|iPhone
{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}.Debug|iPhone.Build.0 = Debug|iPhone
{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}.Release|Any CPU.ActiveCfg = Release|iPhone
{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}.Release|Any CPU.Build.0 = Release|iPhone
{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}.Release|iPhone.ActiveCfg = Release|iPhone
{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}.Release|iPhone.Build.0 = Release|iPhone
{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{A91BC717-9CD2-4CC8-BF12-3AA87256F81A}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
EndGlobal

0 comments on commit ea762a1

Please sign in to comment.