protected override void Initialize() { #if IOS var bounds = UIKit.UIScreen.MainScreen.Bounds; var nativeScale = UIKit.UIScreen.MainScreen.Scale; var screenWidth = (int)(bounds.Width * nativeScale); var screenHeight = (int)(bounds.Height * nativeScale); graphics.PreferredBackBufferWidth = screenWidth; graphics.PreferredBackBufferHeight = screenHeight; #endif FlatRedBallServices.InitializeFlatRedBall(this, graphics); GlobalContent.Initialize(); CameraSetup.SetupCamera(SpriteManager.Camera, graphics); Type startScreenType = typeof(Soccer.Screens.Test2); var commandLineArgs = Environment.GetCommandLineArgs(); if (commandLineArgs.Length > 0) { var thisAssembly = this.GetType().Assembly; // see if any of these are screens: foreach (var item in commandLineArgs) { var type = thisAssembly.GetType(item); if (type != null) { startScreenType = type; break; } } } if (startScreenType != null) { FlatRedBall.Screens.ScreenManager.Start(startScreenType); } GeneratedInitialize(); FlatRedBallServices.GraphicsOptions.TextureFilter = TextureFilter.Point; base.Initialize(); }
private string ProcessMessage(string message) { var screen = FlatRedBall.Screens.ScreenManager.CurrentScreen; bool handledImmediately = false; string data = null; if (message.Contains(":")) { data = message.Substring(message.IndexOf(":") + 1); message = message.Substring(0, message.IndexOf(":")); } switch (message) { case "GetCurrentScreen": handledImmediately = true; return(screen.GetType().FullName); } if (!handledImmediately) { FlatRedBall.Instructions.InstructionManager.AddSafe(() => { switch (message) { case "RestartScreen": screen.RestartScreen(true); break; case "ReloadGlobal": GlobalContent.Reload(GlobalContent.GetFile(data)); break; case "TogglePause": if (screen.IsPaused) { screen.UnpauseThisScreen(); } else { screen.PauseThisScreen(); } break; case "AdvanceOneFrame": screen.UnpauseThisScreen(); var delegateInstruction = new FlatRedBall.Instructions.DelegateInstruction(() => { screen.PauseThisScreen(); }); delegateInstruction.TimeToExecute = FlatRedBall.TimeManager.CurrentTime + .001; FlatRedBall.Instructions.InstructionManager.Instructions.Add(delegateInstruction); break; case "SetSpeed": var timeFactor = int.Parse(data); FlatRedBall.TimeManager.TimeFactor = timeFactor / 100.0f; break; } }); } return("true"); }