protected override void Update(GameTime gameTime) { if (_pendingCoreGame != null && _coreGame == null) { _coreGame = _pendingCoreGame; _coreGame.AssignHost(this); if (_shouldLoadContentOnDelayedGame) { _coreGame.LoadContent(); } } if (_coreGame != null) { #if PLATFORM_WINDOWS if (Window != null) { if (_windowWidth != Window.ClientBounds.Width || _windowHeight != Window.ClientBounds.Height) { OnClientSizeChanged(this, EventArgs.Empty); } } #endif _coreGame.Update(gameTime); return; } }
public void Update(TimeSpan totalTimeSpan, TimeSpan elapsedTimeSpan) { if (!_hasLoadedContent) { _coreGame.AssignHost(this); _coreGame.LoadContent(); _hasLoadedContent = true; } _coreGame.Update(new GameTime(totalTimeSpan, elapsedTimeSpan)); }
public HostGame(ICoreGame preloadedCoreGame) #endif { #if !PLATFORM_ANDROID _coreGame = preloadedCoreGame; #endif _graphicsDeviceManager = new GraphicsDeviceManager(this); if (_coreGame != null) { _coreGame.AssignHost(this); _shouldHandleResize = true; _windowWidth = Window.ClientBounds.Width; _windowHeight = Window.ClientBounds.Height; _coreGame.PrepareGraphicsDeviceManager(_graphicsDeviceManager); _graphicsDeviceManager.PreparingDeviceSettings += (sender, e) => { _coreGame.PrepareDeviceSettings(e.GraphicsDeviceInformation); }; } else { _shouldLoadContentOnDelayedGame = false; _backgroundColor = Color.Black; #if PLATFORM_ANDROID _graphicsDeviceManager.IsFullScreen = true; _gameActivity = gameActivity; try { var layout = _gameActivity.Window.DecorView.FindViewById(Android.Resource.Id.Content); var colorId = _gameActivity.Resources.GetIdentifier("splash_background", "color", Android.App.Application.Context.PackageName); var androidColor = _gameActivity.Resources.GetColor(colorId); _backgroundColor = new Color(androidColor.R, androidColor.G, androidColor.B, (byte)255); } catch { // Setting background is optional. } #endif } }