protected virtual void ServiceDeviceCreated(object sender, EventArgs e) { try { Game.Services.AddService(typeof(IGraphicsDeviceService), m_graphicsService); } catch (ArgumentException) { // Already contains the graphics device service. } CCDrawManager.Init(m_graphicsService.GraphicsDevice); }
public CCApplication(Game game, IGraphicsDeviceService service) : base(game) { if (Game.Services.GetService(typeof(IGraphicsDeviceService)) == null) { Game.Services.AddService(typeof(IGraphicsDeviceService), service); } CCDrawManager.Init(service); Content = game.Content; HandleMediaStateAutomatically = true; game.IsFixedTimeStep = true; TouchPanel.EnabledGestures = GestureType.Tap; game.Activated += GameActivated; game.Deactivated += GameDeactivated; game.Exiting += GameExiting; }
public CCApplication(Game game, IGraphicsDeviceService service) : base(game) { m_graphicsService = service; PresentationParameters pp = new PresentationParameters(); pp.BackBufferWidth = ((GraphicsDeviceManager)service).PreferredBackBufferWidth; pp.BackBufferHeight = ((GraphicsDeviceManager)service).PreferredBackBufferHeight; pp.BackBufferFormat = ((GraphicsDeviceManager)service).PreferredBackBufferFormat; pp.DepthStencilFormat = ((GraphicsDeviceManager)service).PreferredDepthStencilFormat; pp.RenderTargetUsage = RenderTargetUsage.PreserveContents; WindowSetup = pp; Content = game.Content; if (m_graphicsService.GraphicsDevice != null) { try { Game.Services.AddService(typeof(IGraphicsDeviceService), m_graphicsService); } catch (ArgumentException) { // Already contains the graphics device service. } CCDrawManager.Init(m_graphicsService.GraphicsDevice); } else { service.DeviceCreated += ServiceDeviceCreated; } if (service is GraphicsDeviceManager) { ((GraphicsDeviceManager)service).PreparingDeviceSettings += GraphicsPreparingDeviceSettings; } game.IsFixedTimeStep = true; TouchPanel.EnabledGestures = GestureType.Tap; game.Activated += GameActivated; game.Deactivated += GameDeactivated; game.Exiting += GameExiting; #if IOS || WINDOWS_PHONE8 // Please read the following discussions for the reasons of this. // http://monogame.codeplex.com/discussions/393775 // http://monogame.codeplex.com/discussions/396792 // // https://github.com/mono/MonoGame/pull/726 // // Also search Google for -> ContentTypeReaderManager.AddTypeCreator // .FNT Reader ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.DictionaryReader`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Cocos2D.CCBMFontConfiguration+CCBMFontDef, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new DictionaryReader <Int32, CCBMFontConfiguration.CCBMFontDef> () ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.DictionaryReader`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Cocos2D.CCBMFontConfiguration+CCKerningHashElement, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new DictionaryReader <Int32, CCBMFontConfiguration.CCKerningHashElement> () ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[Cocos2D.CCRect, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new CCRectReader() ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[Cocos2D.CCPoint, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new CCPointReader() ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[Cocos2D.CCSize, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new CCSizeReader() ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[Cocos2D.CCBMFontConfiguration+CCKerningHashElement, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new KerningHashElementReader() ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[Cocos2D.CCBMFontConfiguration+CCBMFontPadding, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new CCBMFontPaddingtReader() ); #endif }
public CCApplication(Game game, IGraphicsDeviceService service) : base(game) { if (Game.Services.GetService(typeof(IGraphicsDeviceService)) == null) { Game.Services.AddService(typeof(IGraphicsDeviceService), service); } CCDrawManager.Init(service); Content = game.Content; HandleMediaStateAutomatically = true; game.IsFixedTimeStep = true; TouchPanel.EnabledGestures = GestureType.Tap; game.Activated += GameActivated; game.Deactivated += GameDeactivated; game.Exiting += GameExiting; //TODO: Move to CCContentManager #if IOS || WINDOWS_PHONE8 // Please read the following discussions for the reasons of this. // http://monogame.codeplex.com/discussions/393775 // http://monogame.codeplex.com/discussions/396792 // // https://github.com/mono/MonoGame/pull/726 // // Also search Google for -> ContentTypeReaderManager.AddTypeCreator // .FNT Reader ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.DictionaryReader`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Cocos2D.CCBMFontConfiguration+CCBMFontDef, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new DictionaryReader <Int32, CCBMFontConfiguration.CCBMFontDef> () ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.DictionaryReader`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Cocos2D.CCBMFontConfiguration+CCKerningHashElement, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new DictionaryReader <Int32, CCBMFontConfiguration.CCKerningHashElement> () ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[Cocos2D.CCRect, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new CCRectReader() ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[Cocos2D.CCPoint, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new CCPointReader() ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[Cocos2D.CCSize, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new CCSizeReader() ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[Cocos2D.CCBMFontConfiguration+CCKerningHashElement, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new KerningHashElementReader() ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[Cocos2D.CCBMFontConfiguration+CCBMFontPadding, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new CCBMFontPaddingtReader() ); #endif }
protected virtual void ServiceDeviceCreated(object sender, EventArgs e) { CCDrawManager.Init(m_graphicsService.GraphicsDevice); }
public CCApplication(Game game, IGraphicsDeviceService service) : base(game) { m_graphicsService = service; Content = game.Content; if (m_graphicsService.GraphicsDevice != null) { Game.Services.AddService(typeof(IGraphicsDeviceService), m_graphicsService); CCDrawManager.Init(m_graphicsService.GraphicsDevice); } else { service.DeviceCreated += ServiceDeviceCreated; } if (service is GraphicsDeviceManager) { ((GraphicsDeviceManager)service).PreparingDeviceSettings += GraphicsPreparingDeviceSettings; } game.IsFixedTimeStep = true; TouchPanel.EnabledGestures = GestureType.Tap; game.Activated += new EventHandler <EventArgs>(game_Activated); game.Deactivated += new EventHandler <EventArgs>(game_Deactivated); #if IOS // Please read the following discussions for the reasons of this. // http://monogame.codeplex.com/discussions/393775 // http://monogame.codeplex.com/discussions/396792 // // https://github.com/mono/MonoGame/pull/726 // // Also search Google for -> ContentTypeReaderManager.AddTypeCreator // .FNT Reader ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.DictionaryReader`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[cocos2d.CCBMFontConfiguration+ccBMFontDef, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new DictionaryReader <Int32, CCBMFontConfiguration.ccBMFontDef> () ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.DictionaryReader`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[cocos2d.CCBMFontConfiguration+tKerningHashElement, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new DictionaryReader <Int32, CCBMFontConfiguration.tKerningHashElement> () ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[cocos2d.CCRect, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new CCRectReader() ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[cocos2d.CCPoint, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new CCPointReader() ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[cocos2d.CCSize, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new CCSizeReader() ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[cocos2d.CCBMFontConfiguration+tKerningHashElement, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new KerningHashElementReader() ); ContentTypeReaderManager.AddTypeCreator( "Microsoft.Xna.Framework.Content.ReflectiveReader`1[[cocos2d.CCBMFontConfiguration+ccBMFontPadding, cocos2d-xna, Version=2.0.3.0, Culture=neutral, PublicKeyToken=null]]", () => new CCBMFontPaddingtReader() ); #endif }