Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GamePlatformAndroid.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 #if SILICONSTUDIO_PLATFORM_ANDROID
4 using System;
5 using System.Collections.Generic;
6 using System.IO;
7 using System.Reflection;
8 using SiliconStudio.Paradox.Graphics;
9 
10 namespace SiliconStudio.Paradox.Games
11 {
12  internal class GamePlatformAndroid : GamePlatform, IGraphicsDeviceFactory
13  {
14  public GamePlatformAndroid(GameBase game) : base(game)
15  {
16  }
17 
18  public override string DefaultAppDirectory
19  {
20  get
21  {
22  var assemblyUri = new Uri(Assembly.GetEntryAssembly().CodeBase);
23  return Path.GetDirectoryName(assemblyUri.LocalPath);
24  }
25  }
26 
27  internal override GameWindow[] GetSupportedGameWindows()
28  {
29  return new GameWindow[] { new GameWindowAndroid() };
30  }
31 
32  public override List<GraphicsDeviceInformation> FindBestDevices(GameGraphicsParameters preferredParameters)
33  {
34  var gameWindowAndroid = gameWindow as GameWindowAndroid;
35  if (gameWindowAndroid != null)
36  {
37  // Everything is already created at this point, just transmit what has been done
38  var deviceInfo = new GraphicsDeviceInformation
39  {
40  Adapter = GraphicsAdapterFactory.Default,
41  GraphicsProfile = GraphicsProfile.Level_9_3,
42  PresentationParameters = new PresentationParameters(gameWindowAndroid.ClientBounds.Width,
43  gameWindowAndroid.ClientBounds.Height,
44  gameWindowAndroid.NativeWindow)
45  {
46  // TODO: PDX-364: Transmit what was actually created
47  BackBufferFormat = preferredParameters.PreferredBackBufferFormat,
48  DepthStencilFormat = preferredParameters.PreferredDepthStencilFormat,
49  }
50  };
51 
52  return new List<GraphicsDeviceInformation>() { deviceInfo };
53  }
54  return base.FindBestDevices(preferredParameters);
55  }
56 
57  public override void DeviceChanged(GraphicsDevice currentDevice, GraphicsDeviceInformation deviceInformation)
58  {
59  // TODO: Check when it needs to be disabled on iOS (OpenGL)?
60  // Force to resize the gameWindow
61  //gameWindow.Resize(deviceInformation.PresentationParameters.BackBufferWidth, deviceInformation.PresentationParameters.BackBufferHeight);
62  }
63  }
64 }
65 #endif
Android.Net.Uri Uri
Definition: HtmlElement.cs:8
GraphicsProfile
Identifies the set of supported devices for the demo based on device capabilities.