Ejemplo n.º 1
0
        public override void Draw(ITextRenderer renderer)
        {
            if (SelectedIndex > _view + Width - 1)
                _view = SelectedIndex - (int)Width + 1;
            else if (SelectedIndex <= _view)
                _view = SelectedIndex - (int)Width - 1;
            if (_view < 0)
                _view = 0;
            if (_view > _value.Length)
                _view = _value.Length - 1;
            if (_value.Length < Width)
                _view = 0;

            var text = _value.Substring(_view);

            renderer.Clear(GuiSettings.TextBox);
            renderer.DrawText(0, 0, text, GuiSettings.TextBox);

            _frames++;
            if (_frames >= 30)
            {
                _caretVisible = !_caretVisible;
                _frames = 0;
            }

            if (Focussed && _caretVisible)
                renderer.Set(SelectedIndex - _view, 0, GuiSettings.TextBoxCaret);
        }
Ejemplo n.º 2
0
        public override void Draw(ITextRenderer renderer)
        {
            Width = Parent.SurfaceWidth;

            if (!_drop.Visible)
                _selected = null;

            renderer.Clear(GuiSettings.Menu);

            var x = 0;
            foreach (var i in Items)
            {
                var highlight = _selected != null && _selected == i;
                i.Draw(renderer.Region(x, 0, (uint)i.Caption.Length + 2, 1), highlight, false);
                x += i.Caption.Length + 2;
            }
        }
Ejemplo n.º 3
0
        public override void Draw(ITextRenderer renderer)
        {
            renderer.Clear(new Character(0, 0, 7), true);

            for (var i = 0; i < _lines.Count; i++)
            {
                var line = _lines[i];
                renderer.DrawBox(0, i, Width - 1, 1, GuiSettings.SolidBox, new Character(0, 0, line.Background));

                if (line.SourceLine != null)
                    renderer.DrawText((int)Width - 2 - line.SourceLine.Length, i, line.SourceLine, new Character(0, 25));

                renderer.DrawText(0, i, line.Address.ToString("X8"), new Character(0, 8));
                renderer.DrawText(9, i, line.Instruction, new Character(0, line.Foreground));
            }

            _scrollbar.Draw(renderer.Region(_scrollbar.Left, _scrollbar.Top, _scrollbar.Width, _scrollbar.Height));
        }
Ejemplo n.º 4
0
        public override void Draw(ITextRenderer renderer)
        {
            _offset = (int)(Math.Round(_scrollbar.Value) * _rowSize);

            renderer.Clear(new Character(0, 0, 7), true);

            if (_buffer != null)
            {
                var offset = _offset;

                for (var i = 0; i < Height; i++)
                {
                    renderer.DrawText(0, i, offset.ToString("X8"), new Character(0, 8, 7));
                    var x1 = 10;
                    var x2 = x1 + (_rowSize * 3) + 1;
                    for (var j = 0; j < _rowSize; j++, offset++, x1 += 3, x2++)
                    {
                        if (offset < 0 || offset > _buffer.Length)
                            continue;

                        var b = _buffer[offset];
                        renderer.DrawText(x1, i, b.ToString("X2"), new Character(0, 0, 7));
                        renderer.Set(x2, i, new Character(b, 0, 7));
                    }
                }
            }

            _frames++;
            if (_frames >= 30)
            {
                _caretVisible = !_caretVisible;
                _frames = 0;
            }

            if (Focussed && _caretVisible)
            {
                var offset = _selectedOffset - (_offset * 2);
                var y = (offset / 2) / _rowSize;
                var xN = offset % (_rowSize * 2);
                var x = 10 + xN + (xN / 2);
                renderer.Set(x, y, new Character(-1, 7, 0));
            }

            _scrollbar.Draw(renderer.Region(_scrollbar.Left, _scrollbar.Top, _scrollbar.Width, _scrollbar.Height));
        }
Ejemplo n.º 5
0
        public void Draw(ITextRenderer renderer, bool highlight, bool extended)
        {
            var col = highlight ? GuiSettings.MenuItemHighlight : GuiSettings.MenuItem;
            var caption = string.Format(" {0} ", Caption);

            renderer.Clear(col);
            renderer.DrawText(0, 0, caption, col);

            if (extended && Items.Count > 0)
                renderer.Set((int)renderer.Width - 1, 0, GuiSettings.MenuArrow);
        }
Ejemplo n.º 6
0
            public override void Draw(ITextRenderer renderer)
            {
                if (_playing)
                {
                    if (_player.Y >= Height - 1)
                        _playing = false;

                    if (_pipes.Any(p => p.Contains(_player.X, _player.Y)))
                        _playing = false;
                }

                if (_playing)
                {
                    var prevPipe = (int)_player.X / 32;

                    _player.VelY += 0.025f;
                    _player.X += _player.VelX;
                    _player.Y += _player.VelY;

                    if ((int)_player.X / 32 != prevPipe)
                        _pipes.Add(new Pipe(_camera + 100, _random.Next(2, (int)Height - 12)));

                    _pipes.RemoveAll(p => p.X < _camera - 10);
                }
                else
                {
                    _player.X = 10;
                    _player.Y = Height / 2f;
                    _player.VelX = 0;
                    _player.VelY = 0;

                    _pipes.Clear();
                }

                _camera = (int)_player.X - 15;

                renderer.Clear(new Character(0, 53, 53));

                Draw(renderer, _player.X, _player.Y, 3, 2, new Character(0, 43, 43));

                if (!_playing)
                    renderer.DrawText(_camera + 10, (int)Height / 2 + 5, "Press Space!", new Character(0, 0));

                foreach (var p in _pipes)
                {
                    Draw(renderer, p.X, 0, (uint)p.W, (uint)p.Y, new Character(0, 10, 10));
                    Draw(renderer, p.X, p.Y + p.H, (uint)p.W, 50, new Character(0, 10, 10));
                }

                Draw(renderer, _camera, Height - 1, Width, 2, new Character(0, 2, 2));
            }