Skip to content

Commit

Permalink
Uploaded ModelsAndVerts in MonoGame multiplatform.
Browse files Browse the repository at this point in the history
Fixed title for model-based drawing in MonoGame.
  • Loading branch information
vchelaru committed Jun 21, 2015
1 parent 8505d0e commit 547cbaf
Show file tree
Hide file tree
Showing 34 changed files with 765 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ModelRenderingMG/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MonoGame WalkingGame Project for iOS and Android
Drawing Models in MonoGame
====================================

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 article on adding 3D models to a MonoGame project.
Expand Down
39 changes: 39 additions & 0 deletions ModelsAndVertsMG/Android/Activity1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
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 MonoGame3D.Droid
{
[Activity (Label = "MonoGame3D.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);

// Create our OpenGL view, and display it
var g = new Game1 ();
SetContentView((View)g.Services.GetService(typeof(View)));
g.Run ();
}

}
}


19 changes: 19 additions & 0 deletions ModelsAndVertsMG/Android/Assets/AboutAssets.txt
Original file line number Diff line number Diff line change
@@ -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 ModelsAndVertsMG/Android/Assets/Content/Content.mgcb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#----------------------------- Global Properties ----------------------------#

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

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


#---------------------------------- Content ---------------------------------#
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
74 changes: 74 additions & 0 deletions ModelsAndVertsMG/Android/MonoGame3D.Droid.csproj
Original file line number Diff line number Diff line change
@@ -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>{318AE09B-B33D-453D-83FF-F96CEF81437D}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>MonoGame3D.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>False</AndroidUseLatestPlatformSdk>
<AssemblyName>MonoGame3D.Droid</AssemblyName>
<TargetFrameworkVersion>v5.0</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="Assets\Content\robot.xnb" />
<AndroidAsset Include="Assets\Content\robottexture_0.xnb" />
<AndroidAsset Include="Assets\Content\checkerboard.png" />
</ItemGroup>
<Import Project="..\MonoGame3D\MonoGame3D.projitems" Label="Shared" Condition="Exists('..\MonoGame3D\MonoGame3D.projitems')" />
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
</Project>
6 changes: 6 additions & 0 deletions ModelsAndVertsMG/Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -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="MonoGame3D.Droid">
<uses-sdk android:minSdkVersion="10" />
<application android:label="MonoGame3D.Droid">
</application>
</manifest>
31 changes: 31 additions & 0 deletions ModelsAndVertsMG/Android/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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 ("MonoGame3D.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 ModelsAndVertsMG/Android/Resources/AboutResources.txt
Original file line number Diff line number Diff line change
@@ -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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
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 ModelsAndVertsMG/Android/Resources/values/Styles.xml
Original file line number Diff line number Diff line change
@@ -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>
4 changes: 4 additions & 0 deletions ModelsAndVertsMG/Android/packages.config
Original file line number Diff line number Diff line change
@@ -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 ModelsAndVertsMG/Metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<SampleMetadata>
<ID>922f536c-6927-42fb-abe6-60ad0910a222</ID>
<IsFullApplication>false</IsFullApplication>
<Level>Beginning</Level>
<LicenseRequirement>Indie</LicenseRequirement>
<Tags>Getting Started, Games</Tags>
<Gallery>true</Gallery>
</SampleMetadata>
45 changes: 45 additions & 0 deletions ModelsAndVertsMG/MonoGame3D.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "MonoGame3D", "MonoGame3D\MonoGame3D.shproj", "{EB821538-5759-4582-AE8F-28F30E86887B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame3D.iOS", "iOS\MonoGame3D.iOS.csproj", "{3A7832FD-942F-47ED-A0E9-24811DABD167}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame3D.Droid", "Android\MonoGame3D.Droid.csproj", "{318AE09B-B33D-453D-83FF-F96CEF81437D}"
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
{318AE09B-B33D-453D-83FF-F96CEF81437D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{318AE09B-B33D-453D-83FF-F96CEF81437D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{318AE09B-B33D-453D-83FF-F96CEF81437D}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{318AE09B-B33D-453D-83FF-F96CEF81437D}.Debug|iPhone.Build.0 = Debug|Any CPU
{318AE09B-B33D-453D-83FF-F96CEF81437D}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{318AE09B-B33D-453D-83FF-F96CEF81437D}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{318AE09B-B33D-453D-83FF-F96CEF81437D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{318AE09B-B33D-453D-83FF-F96CEF81437D}.Release|Any CPU.Build.0 = Release|Any CPU
{318AE09B-B33D-453D-83FF-F96CEF81437D}.Release|iPhone.ActiveCfg = Release|Any CPU
{318AE09B-B33D-453D-83FF-F96CEF81437D}.Release|iPhone.Build.0 = Release|Any CPU
{318AE09B-B33D-453D-83FF-F96CEF81437D}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{318AE09B-B33D-453D-83FF-F96CEF81437D}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{3A7832FD-942F-47ED-A0E9-24811DABD167}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{3A7832FD-942F-47ED-A0E9-24811DABD167}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{3A7832FD-942F-47ED-A0E9-24811DABD167}.Debug|iPhone.ActiveCfg = Debug|iPhone
{3A7832FD-942F-47ED-A0E9-24811DABD167}.Debug|iPhone.Build.0 = Debug|iPhone
{3A7832FD-942F-47ED-A0E9-24811DABD167}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{3A7832FD-942F-47ED-A0E9-24811DABD167}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{3A7832FD-942F-47ED-A0E9-24811DABD167}.Release|Any CPU.ActiveCfg = Release|iPhone
{3A7832FD-942F-47ED-A0E9-24811DABD167}.Release|Any CPU.Build.0 = Release|iPhone
{3A7832FD-942F-47ED-A0E9-24811DABD167}.Release|iPhone.ActiveCfg = Release|iPhone
{3A7832FD-942F-47ED-A0E9-24811DABD167}.Release|iPhone.Build.0 = Release|iPhone
{3A7832FD-942F-47ED-A0E9-24811DABD167}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{3A7832FD-942F-47ED-A0E9-24811DABD167}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
EndGlobal
Loading

0 comments on commit 547cbaf

Please sign in to comment.