コード例 #1
0
        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);
        }
コード例 #2
0
 public void UpdateCursorPosition()
 {
     Cursor.SetGranularPosition(
         Buffer.CursorX + (int)Window.LeftMargin,
         Buffer.CursorY + (int)Window.TopMargin
         );
 }
コード例 #3
0
        public void Draw(RenderContext context)
        {
            DrawBackdrop(context);
            TextRenderer.Draw(context);

            if (Options.HighlightCurrentLine)
            {
                DrawLineHighlight(context);
            }

            Cursor.Draw(context);
            ModeLine.Draw(context);
        }
コード例 #4
0
        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();
            }
        }
コード例 #5
0
        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;
        }