public Editor(TrueTypeFont font) { Font = font; Buffer = new EditorBuffer(); Options = new EditorOptions { HighlightCurrentLine = true, TabSize = 2 }; Hotkeys = new List <Hotkey>(); TextRenderer = new TextRenderer(this); Window = new Window(this); ModeLine = new ModeLine(Font); Cursor = new Cursor { ForceVisible = true }; _ = new FileSystem(this); _ = new Modification(this); _ = new Navigation(this); _ = new StatusControl(this); }
public void UpdateCursorPosition() { Cursor.SetGranularPosition( Buffer.CursorX + (int)Window.LeftMargin, Buffer.CursorY + (int)Window.TopMargin ); }
public void Draw(RenderContext context) { DrawBackdrop(context); TextRenderer.Draw(context); if (Options.HighlightCurrentLine) { DrawLineHighlight(context); } Cursor.Draw(context); ModeLine.Draw(context); }
public void Update(float deltaTime) { Cursor.ColorMask = EditorColors.EditorCursorColor; Cursor.Update(deltaTime); ModeLine.Update(deltaTime); UpdateCursorPosition(); TextRenderer.PushLines(Buffer.Lines); if (!ModeLine.IsTakingInput && !ModeLine.PauseDynamicUpdates) { UpdateModeLineStatusText(); } }
public ModeLine(TrueTypeFont font) { _font = font; GranularHeight = 1; Granularity = _font.Size; ActualHeight = GranularHeight * Granularity; StatusText = string.Empty; InputCursor = new Cursor { ColorMask = EditorColors.ModeLineForeground, ForceVisible = true }; InputText = string.Empty; }