Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
GamePlatformiOS.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_IOS
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 GamePlatformiOS : GamePlatform, IGraphicsDeviceFactory
13  {
14  public GamePlatformiOS(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 GameWindowiOS() };
30  }
31 
32  public override List<GraphicsDeviceInformation> FindBestDevices(GameGraphicsParameters preferredParameters)
33  {
34  var gameWindowiOS = gameWindow as GameWindowiOS;
35  if (gameWindowiOS != null)
36  {
37  // Unlike Desktop and WinRT, the list of best devices are completely fixed in WP8 XAML
38  // So we return a single element
39  var deviceInfo = new GraphicsDeviceInformation
40  {
41  Adapter = GraphicsAdapterFactory.Default,
42  GraphicsProfile = GraphicsProfile.Level_9_3,
43  PresentationParameters = new PresentationParameters(gameWindowiOS.ClientBounds.Width,
44  gameWindowiOS.ClientBounds.Height,
45  gameWindowiOS.NativeWindow)
46  {
47  DepthStencilFormat = PixelFormat.D16_UNorm,
48  }
49  };
50 
51  return new List<GraphicsDeviceInformation>() { deviceInfo };
52  }
53  return base.FindBestDevices(preferredParameters);
54  }
55 
56  public override void DeviceChanged(GraphicsDevice currentDevice, GraphicsDeviceInformation deviceInformation)
57  {
58  // TODO: Check when it needs to be disabled on iOS (OpenGL)?
59  // Force to resize the gameWindow
60  //gameWindow.Resize(deviceInformation.PresentationParameters.BackBufferWidth, deviceInformation.PresentationParameters.BackBufferHeight);
61  }
62  }
63 }
64 #endif
Android.Net.Uri Uri
Definition: HtmlElement.cs:8
GraphicsProfile
Identifies the set of supported devices for the demo based on device capabilities.