Skip to content

Commit

Permalink
Merge pull request #864 from dellis1972/develop3d
Browse files Browse the repository at this point in the history
Added code to fall back on the default graphics mode under android
  • Loading branch information
KonajuGames committed Oct 16, 2012
2 parents 98f8e0e + 11faac2 commit 8c53ca7
Show file tree
Hide file tree
Showing 11 changed files with 269 additions and 2 deletions.
13 changes: 11 additions & 2 deletions MonoGame.Framework/Android/AndroidGameWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,22 @@ protected override void CreateFrameBuffer()
try
{
GLContextVersion = GLContextVersion.Gles2_0;
base.CreateFrameBuffer();
try
{
base.CreateFrameBuffer();
}
catch(Exception)
{
// try again using a more basic mode which hopefully the device will support
GraphicsMode = new AndroidGraphicsMode(0, 0, 0, 0, 0, false);
base.CreateFrameBuffer();
}
All status = GL.CheckFramebufferStatus(All.Framebuffer);
Android.Util.Log.Debug("MonoGame", "Framebuffer Status: " + status.ToString());
}
catch (Exception)
{
throw new NotSupportedException("Could not create OpenGLES 2.0 frame buffer");
throw new NotSupportedException("Could not create OpenGLES 2.0 frame buffer");
}
if (_game.GraphicsDevice != null && _contextWasLost)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.ContentPipeline.targets" />
<PropertyGroup>
<ProjectGuid>$guid1$</ProjectGuid>
<ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>$safeprojectname$</RootNamespace>
<AssemblyName>$safeprojectname$</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
<XnaPlatform>Windows</XnaPlatform>
<XnaProfile>HiDef</XnaProfile>
<XnaCrossPlatformGroupID>3e373063-50e5-4165-8264-1f7139c86e71</XnaCrossPlatformGroupID>
<XnaOutputType>Game</XnaOutputType>
<MonoGamePlatform>Windows</MonoGamePlatform>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Windows' ">
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
<XnaCompressContent>true</XnaCompressContent>
<MonoGamePlatform>Windows</MonoGamePlatform>
<OutputPath>bin\Windows\Release</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Windows8' ">
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
<XnaCompressContent>true</XnaCompressContent>
<MonoGamePlatform>Windows8</MonoGamePlatform>
<OutputPath>bin\Windows8\Release</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Android' ">
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
<XnaCompressContent>true</XnaCompressContent>
<MonoGamePlatform>Android</MonoGamePlatform>
<OutputPath>bin\Android\Release</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'iOS' ">
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
<XnaCompressContent>true</XnaCompressContent>
<MonoGamePlatform>iOS</MonoGamePlatform>
<OutputPath>bin\iOS\Release</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Mac' ">
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
<XnaCompressContent>true</XnaCompressContent>
<MonoGamePlatform>Mac</MonoGamePlatform>
<OutputPath>bin\Mac\Release</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Linux' ">
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
<XnaCompressContent>true</XnaCompressContent>
<MonoGamePlatform>Linux</MonoGamePlatform>
<OutputPath>bin\Linux\Release</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.GamerServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Net" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Program.cs" />
<Compile Include="Game1.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<VSTemplate Version="3.0.0" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" Type="Project">
<TemplateData>
<Name>MonoGame Content Builder Project</Name>
<Description>A project for Compiling Content for MonoGame</Description>
<ProjectType>CSharp</ProjectType>
<ProjectSubType>
</ProjectSubType>
<SortOrder>1000</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<DefaultName>ContentBuilder</DefaultName>
<ProvideDefaultName>true</ProvideDefaultName>
<LocationField>Enabled</LocationField>
<EnableLocationBrowseButton>true</EnableLocationBrowseButton>
<Icon>__TemplateIcon.png</Icon>
<PreviewImage>__PreviewImage.png</PreviewImage>
</TemplateData>
<TemplateContent>
<Project TargetFileName="ContentBuilder1.csproj" File="ContentBuilder.csproj" ReplaceParameters="true">
<ProjectItem ReplaceParameters="true" TargetFileName="Program.cs">Program.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="Game1.cs">Game1.cs</ProjectItem>
<Folder Name="Properties" TargetFolderName="Properties">
<ProjectItem ReplaceParameters="true" TargetFileName="AssemblyInfo.cs">AssemblyInfo.cs</ProjectItem>
</Folder>
</Project>
</TemplateContent>
</VSTemplate>
Binary file not shown.
91 changes: 91 additions & 0 deletions projecttemplates/visualstudio2010/ContentBuilder/Game1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace $safeprojectname$
{
/// <summary>
/// This is the main type for your game
/// </summary>
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;

public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}

/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
// TODO: Add your initialization logic here

base.Initialize();
}

/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);

// TODO: use this.Content to load your game content here
}

/// <summary>
/// UnloadContent will be called once per game and is the place to unload
/// all content.
/// </summary>
protected override void UnloadContent()
{
// TODO: Unload any non ContentManager content here
}

/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();

// TODO: Add your update logic here

base.Update(gameTime);
}

/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);

// TODO: Add your drawing code here

base.Draw(gameTime);
}
}
}
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.
21 changes: 21 additions & 0 deletions projecttemplates/visualstudio2010/ContentBuilder/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;

namespace $safeprojectname$
{
#if WINDOWS || XBOX
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
using (Game1 game = new Game1())
{
game.Run();
}
}
}
#endif
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("$projectname$")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("$registeredorganization$")]
[assembly: AssemblyProduct("$projectname$")]
[assembly: AssemblyCopyright("Copyright © $registeredorganization$ $year$")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. Only Windows
// assemblies support COM.
[assembly: ComVisible(false)]

// On Windows, the following GUID is for the ID of the typelib if this
// project is exposed to COM. On other platforms, it unique identifies the
// title storage container when deploying this assembly to the device.
[assembly: Guid("$guid1$")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
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.

0 comments on commit 8c53ca7

Please sign in to comment.