public WindowedConsoleRenderer(Actor actor, Scrollbar scrollbar) : base(actor) { this.font = MachinaClient.Assets.GetSpriteFont("DefaultFontSmall"); this.scrollbar = scrollbar; Runtime.CurrentCartridge.PushLogger(this); MachinaClient.Print("Logger pushed"); }
public void LoadSavedSettingsIfExist(MachinaFileSystem fileSystem, WindowInterface window) { try { var json = fileSystem.ReadTextAppDataThenLocal("settings.json").Result; var data = JsonConvert.DeserializeObject <GameSettings>(json); LoadFromData(data); Apply(window); } catch (Exception e) { MachinaClient.Print("Failed to load settings", e.Message); } }
public void SaveSnapshotAndDisposeTexture(SpriteBatch spriteBatch) { var texture = Runtime.CurrentCartridge.SceneLayers.RenderToTexture(spriteBatch); var currentTime = DateTime.Now; Directory.CreateDirectory(this.screenshotPath); using (var destStream = File.Create(Path.Combine(this.screenshotPath, currentTime.ToFileTimeUtc() + ".png"))) { texture.SaveAsPng(destStream, texture.Width, texture.Height); MachinaClient.Print("Snapshot taken", this.screenshotPath); } texture.Dispose(); }
public override void OnKey(Keys key, ButtonState buttonState, ModifierKeys modifiers) { if (this.keyCombo.key == key && this.keyCombo.modifiers == modifiers && buttonState == ButtonState.Pressed) { if (Runtime.DebugLevel == DebugLevel.Passive) { Runtime.DebugLevel = DebugLevel.Active; } else { Runtime.DebugLevel = DebugLevel.Passive; } MachinaClient.Print("DebugLevel set to ", Runtime.DebugLevel); } }
public override void OnDeleteFinished() { Runtime.CurrentCartridge.PopLogger(); MachinaClient.Print("Logger popped"); }