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"); }
private void LoadDefaultStyle(AssetLoader loader, AssetLibrary library, Painter painter) { loader.ForceLoadAsset("images/button-ninepatches"); loader.ForceLoadAsset("images/window"); loader.ForceLoadAsset("fonts/DefaultFontSmall"); library.AddMachinaAsset("ui-button", new NinepatchSheet("button-ninepatches", new Rectangle(0, 0, 24, 24), new Rectangle(8, 8, 8, 8), painter)); library.AddMachinaAsset("ui-button-hover", new NinepatchSheet("button-ninepatches", new Rectangle(24, 0, 24, 24), new Rectangle(8 + 24, 8, 8, 8), painter)); library.AddMachinaAsset("ui-button-press", new NinepatchSheet("button-ninepatches", new Rectangle(48, 0, 24, 24), new Rectangle(8 + 48, 8, 8, 8), painter)); library.AddMachinaAsset("ui-slider-ninepatch", new NinepatchSheet("button-ninepatches", new Rectangle(0, 144, 24, 24), new Rectangle(8, 152, 8, 8), painter)); library.AddMachinaAsset("ui-checkbox-checkmark-image", new Image(new GridBasedSpriteSheet("button-ninepatches", new Point(24, 24)), 6)); library.AddMachinaAsset("ui-radio-fill-image", new Image(new GridBasedSpriteSheet("button-ninepatches", new Point(24, 24)), 7)); library.AddMachinaAsset("ui-checkbox-radio-spritesheet", new GridBasedSpriteSheet("button-ninepatches", new Point(24, 24))); library.AddMachinaAsset("ui-textbox-ninepatch", new NinepatchSheet("button-ninepatches", new Rectangle(0, 96, 24, 24), new Rectangle(8, 104, 8, 8), painter)); library.AddMachinaAsset("ui-window-ninepatch", new NinepatchSheet("window", new Rectangle(0, 0, 96, 96), new Rectangle(10, 34, 76, 52), painter)); MachinaClient.SetupDefaultStyle(); }
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"); }