public override void OnStart(Dictionary <string, object> args) { BackgroundColor = Color.FromArgb(255, 32, 32, 32); TextElement titleText; Root.AddRange( titleText = new TextElement("DotFeather", DFFont.GetDefault(56), Color.White) { Location = (24, 24) },
internal DFConsole() { text = new TextElement("", DFFont.GetDefault(), Color.White); FontSize = 16; DF.Window.Render += () => { text.Render(); }; DF.Window.PostUpdate += UpdateConsole; }
public override void OnStart(Dictionary <string, object> args) { Print("DotFeather Text Editor"); Print("Press [ESC] to exit"); editorView = new TextElement("", DFFont.GetDefault(16), Color.White) { Location = (8, 64) }; Root.Add(editorView); // flush text buffer DFKeyboard.GetString(); }
private void UpdateConsole() { var f = text.Font; var w = DF.Window; if (f.Size != FontSize || prevFont != FontPath) { text.Font = FontPath == null?DFFont.GetDefault(FontSize) : new DFFont(FontPath, FontSize); } var maxLine = Math.Max(0, w.Height - 1) / FontSize; var buf = consoleBuffer.Count > maxLine?consoleBuffer.Skip(consoleBuffer.Count - maxLine) : consoleBuffer; text.Color = TextColor; text.Text = string.Join('\n', buf); prevFont = FontPath; }
public override void OnUpdate() { time += Time.DeltaTime; if (time > 0.0625f) { Root.Add( new TextElement($"Test {count}", DFFont.GetDefault(random.Next(8, 48)), random.NextColor()) { Location = random.NextVector(Window.Width, Window.Height) } ); time = 0; count++; } if (DFKeyboard.Escape.IsKeyUp) { Router.ChangeScene <LauncherScene>(); } }
public override void OnStart(Dictionary <string, object> args) { game = new Reversi(); if (args.ContainsKey("mode") && args["mode"] is string mode) { switch (mode) { case "Multiplayer": Mode = GameMode.MultiPlayer; break; case "SimpleAI": ai = new SimpleAi(game); Mode = GameMode.VsCpu; break; case "DynamicAI": Mode = GameMode.VsCpu; break; case "RandomAI": ai = new RandomAi(game); Mode = GameMode.VsCpu; break; default: break; } } boardView = new Container(); boardView.Scale *= 2; Root.Add(boardView); var title = new TextElement("リバーシするヤーツ", DFFont.GetDefault(32), Color.White) { Location = (32, 32) }; Root.Add(title); turn = new TextElement("のターン", DFFont.GetDefault(16), Color.White); Root.Add(turn); score = new TextElement("黒 / 白", DFFont.GetDefault(16), Color.White); Root.Add(score); tileStoneBlack = Tile.LoadFrom("resources/textures/stone-black.png"); tileStoneWhite = Tile.LoadFrom("resources/textures/stone-white.png"); tilePrompt = Tile.LoadFrom("resources/textures/prompt.png"); var backdrop = new Sprite("resources/textures/board.png"); boardView.Add(backdrop); stones = new Tilemap((16, 16)); boardView.Add(stones); aud.Play(bgmMain, 0); boardView.Location = (DF.Window.Size.X / 2 - 128, 96); Render(); }