public NotesRenderer(Sprite noteSprite, ITextRenderer textRenderer, int statusBarHeight) { this.noteSprite = noteSprite; this.textRenderer = textRenderer; this.statusBarHeight = statusBarHeight; lineHeight = textRenderer.RenderText("M", new SDL.SDL_Color()).Height + 5; }
public IntroScene(IGraphicsRenderer graphicsRenderer, ITextRenderer textRenderer, IContentProvider contentProvider, GameStateManager gameStateManager, InputManager inputManager) : base(graphicsRenderer, textRenderer) { this.contentProvider = contentProvider; this.gameStateManager = gameStateManager; this.inputManager = inputManager; }
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); }
protected override void Awake() { _sr = GetComponent <SpriteRenderer>(); _text = GetComponent <TextRenderer>(); _au = GetComponent <AudioSource>(); _animator = GetComponent <Animator>(); _queuedToLaunch = new List <Planet>(); _upgradeMenu = GetComponent <UpgradeMenu>(); // Add outline visual elements _planetOutline = Instantiate <SpriteRenderer>("HoverOutline", Transform.Position); _planetOutline.Sprite = GameController.OutlineSprite; _planetOutline.Layer = 0.6f; _planetOutline.GameObject.SetActive(false); _rangeOutline = Instantiate <SpriteRenderer>("RangeOutline", Transform.Position); _rangeOutline.Sprite = GameController.RangeSprite; _rangeOutline.Color = new Color(38, 38, 38, 25); _rangeOutline.Layer = 0.61f; UpdateAppearance(); OnPopulationChange += UpdatePopulationText; OnPopulationChange(); }
public override void Draw(ITextRenderer renderer) { var x = 0; var y = 0; foreach (var c in Caption) { if (c == '\n') { x = 0; y++; continue; } renderer.Set(x, y, new Character(c, GuiSettings.Label.Foreground, GuiSettings.Label.Background)); x++; if (x >= Width) { x = 0; y++; } if (y >= Height) break; } }
public StatusRenderer( Sprite barSprite, Sprite crossSprite, int statusBarHeight, ITextRenderer logTextRenderer, INotesRenderer notesRenderer, IMonologueRenderer monologueRenderer, Sprite bowSprite, Sprite swordSprite, Sprite frameSprite, ITextRenderer textRenderer, Sprite arrowSprite, Sprite fireBallSprite, Sprite shockBallSprite, Sprite faceSprite, Sprite faceHurtedSprite, Sprite faceBadSprite) { this.barSprite = barSprite; this.bowSprite = bowSprite; this.swordSprite = swordSprite; this.crossSprite = crossSprite; this.statusBarHeight = statusBarHeight; this.logTextRenderer = logTextRenderer; this.frameSprite = frameSprite; this.notesRenderer = notesRenderer; this.monologueRenderer = monologueRenderer; this.statusTextRenderer = textRenderer; this.arrowSprite = arrowSprite; this.fireBallSprite = fireBallSprite; this.shockBallSprite = shockBallSprite; this.faceSprite = faceSprite; this.faceHurtedSprite = faceHurtedSprite; this.faceBadSprite = faceBadSprite; }
public void TestInitialize() { _mockRenderer = new Mock <I2DRenderer>(MockBehavior.Strict); _mockFactory = new Mock <IFactory>(MockBehavior.Strict); _target = new TextRenderer(_mockRenderer.Object, _mockFactory.Object); }
/// <summary> /// Draw unformatted text. Will not handle control characters. /// </summary> public static void DrawText(this ITextRenderer renderer, int x, int y, string text, Character color) { foreach (var c in text) { renderer.Set(x, y, new Character(c, color.Foreground, color.Background)); x++; } }
public PlayerRenderer(IView view, ITextRenderer textRenderer) { this.textRenderer = textRenderer; this.view = view; GenBuffers(); BuildShader(); InitHealthBar(); }
// TODO: drawtext with formatting characters /// <summary> /// Draw a 9-patch box. /// /// Box indices: /// 012 /// 345 /// 678 /// </summary> public static void DrawBox(this ITextRenderer renderer, int x, int y, uint w, uint h, string box, Character color) { for (int putY = y, yy = 0; putY < y + h; putY++, yy++) { for (int putX = x, xx = 0; putX < x + w; putX++, xx++) { char c; if (yy == 0) { if (xx == 0) { c = box[0]; } else if (xx == w - 1) { c = box[2]; } else { c = box[1]; } } else if (yy == h - 1) { if (xx == 0) { c = box[6]; } else if (xx == w - 1) { c = box[8]; } else { c = box[7]; } } else { if (xx == 0) { c = box[3]; } else if (xx == w - 1) { c = box[5]; } else { c = box[4]; } } renderer.Set(putX, putY, new Character(c, color.Foreground, color.Background)); } } }
public WorldRenderer(World world, IView view, ITextRenderer textRenderer) { this.world = world; arenaRenderer = new ArenaRenderer(world.Arena, view); playerRenderer = new PlayerRenderer(view, textRenderer); shellRenderer = new ShellRenderer(view); shieldRenderer = new ShieldPickupRenderer(); this.textRenderer = textRenderer; }
private void DrawArrowsCount(IScreen screen, Scene scene, ITextRenderer textRenderer) { var arrowsCountY = screen.Height - statusBarHeight + 30; var arrowsCountX = 1000; var currentAmountOfArrows = scene.Player.CurrentAmountOfArrows; var maxAmountOfArrows = scene.Player.MaxAmountOfArrows; textRenderer.RenderText($"{currentAmountOfArrows} / {maxAmountOfArrows}", new SDL.SDL_Color(), screen, arrowsCountY, arrowsCountX); }
private void StartGame() { _renderer = Substitute.For <ITextRenderer>(); var dualGameResultsRepository = Substitute.For <IBoardGameResultsRepository>(); _game = new GomokuGame(dualGameResultsRepository); _game.TextRenderer = _renderer; _game.StartGame(); }
public override void Draw(ITextRenderer renderer) { renderer.DrawBox(0, 0, Width, Height, TextExtensions.DoubleBox, GuiSettings.Window); renderer.DrawText(2, 0, "[\xFE]", GuiSettings.Window); if (!string.IsNullOrEmpty(Caption)) renderer.DrawText(6, 0, string.Format(" {0} ", Caption), GuiSettings.WindowCaption); _children.Draw(renderer.Region(1, 1, Width - 2, Height - 2)); }
public override void Draw(ITextRenderer renderer) { renderer.Set(0, 0, new Character('[', 0)); renderer.Set(2, 0, new Character(']', 0)); if (Checked) renderer.Set(1, 0, new Character('X', 0)); renderer.DrawText(4, 0, Caption, new Character(0, 0)); }
public MenuRenderer(GameState gameState, IXleRenderer renderer, ITextRenderer textRenderer, IRectangleRenderer rects) { this.gameState = gameState; this.renderer = renderer; this.textRenderer = textRenderer; this.rects = rects; }
private void StartGame() { _renderer = Substitute.For <ITextRenderer>(); var dualGameResultsRepository = Substitute.For <IBoardGameResultsRepository>(); _game = new LittleFlowerBot.Models.Game.BoardGame.KiGames.TicTacToe.TicTacToeGame(dualGameResultsRepository); _game.TextRenderer = _renderer; _game.StartGame(); }
/// <summary> /// Clear this renderer to a character. /// </summary> public static void Clear(this ITextRenderer renderer, Character character, bool useBlending = false) { for (var y = 0; y < renderer.Height; y++) { for (var x = 0; x < renderer.Width; x++) { renderer.Set(x, y, character, useBlending); } } }
/// <summary> /// Renders shields as big 'O' /// </summary> public void Render(IEnumerable <Engine.ShieldPickup> pickups, ITextRenderer text) { foreach (var p in pickups) { if (p.Active) { text.DrawInWorld("O", p.pos - new Vector3(shieldDims / 2, shieldDims / 2, 0.0f), new Vector3(0.3f, 0.3f, 1.0f), shieldDims); } } }
public ImageSettings(Size imageSize, string imageName, string imageExtention, int minimalTextSize, string font, string colors, ITextRenderer textRenderer) { ImageSize = imageSize; ImageName = imageName; ImageExtention = imageExtention; MinimalTextSize = minimalTextSize; Font = font; TextRenderer = textRenderer; Colors = colors.Split().Select(Color.FromName).ToList(); }
public override void Draw(ITextRenderer renderer) { renderer.Set(0, 0, GuiSettings.ScrollbarUp); for (var y = 1; y < Height - 1; y++) { renderer.Set(0, y, GuiSettings.Scrollbar); } renderer.Set(0, (int)Height - 1, GuiSettings.ScrollbarDown); var x = 1 + (InternalValue * (Height - 3)); renderer.Set(0, (int)x, GuiSettings.ScrollbarThumb); }
public void Draw(IEnumerable <Player> players, ITextRenderer textRenderer) { float yPos = 3.0f; textRenderer.DrawInScreen($" Kills Deaths", new Vector3(-7.0f, yPos, 1.0f), new Vector3(1.0f, 10f, 0.0f), 0.5f); yPos -= 0.5f; foreach (var p in players) { textRenderer.DrawInScreen($"Player{p.ID} {p.KillCount} {p.DeathCount}", new Vector3(-7.0f, yPos, 1.0f), new Vector3(1.0f, 1.0f, 0.0f), 0.5f); yPos -= 0.5f; } }
private static void Initialize() { graphicsDevice = CreateGraphicsDevice(); factory = graphicsDevice.ResourceFactory; commandList = factory.CreateCommandList(); infoFont = new Font(fonts[0], 13); infoTextRenderer = new VeldridTextRenderer(graphicsDevice, commandList, infoFont); demoFont = new Font(fonts[currentFontIndex], fontSize); demoTextRenderer = new VeldridTextRenderer(graphicsDevice, commandList, demoFont); }
internal TextRegion(ITextRenderer renderer, int x, int y, uint w, uint h) { if (renderer == null) throw new ArgumentNullException("renderer"); _renderer = renderer; _startX = x; _startY = y; Width = w; Height = h; }
/// <summary> /// Draw a renderer to this renderer. /// </summary> public static void DrawImage(this ITextRenderer renderer, int x, int y, ITextRenderer image) { if (x < -image.Width || x > renderer.Width || y < -image.Height || y > renderer.Height) return; for (var yy = 0; yy < image.Height; yy++) { for (var xx = 0; xx < image.Width; xx++) { renderer.Set(x + xx, y + yy, image.Get(xx, yy)); } } }
private void StartGameWith(int target) { _renderer = Substitute.For <ITextRenderer>(); var random = Substitute.For <Random>(); random.Next(0).ReturnsForAnyArgs(target); _guessNumberGame = new GuessNumberGame() { Random = random }; _guessNumberGame.TextRenderer = _renderer; _guessNumberGame.StartGame(); }
// public RenderTarget RenderTarget { get { return GameWindow.RenderTarget2D; } } public GameScene(IGraphicsRenderer graphicsRenderer, ITextRenderer textRenderer, LevelProvider levelProvider, Player player, GameStateManager gameStateManager, World world) : base(graphicsRenderer, textRenderer) { kernel = NinjectFactory.Kernel; this.levelProvider = levelProvider; this.player = player; this.GameStateManager = gameStateManager; World = world; GameStateManager.StateChanged += GameStateManager_StateChanged; Console.WriteLine("GameScene constructed."); }
public ImageSettings(Size imageSize, string imageName, string imageExtention, int minimalTextSize, string font, string colors, ITextRenderer textRenderer) { ImageSize = imageSize; ImageName = imageName; ImageExtention = imageExtention; MinimalTextSize = minimalTextSize; Font = font; TextRenderer = textRenderer; Colors = GetColors(colors.Split()); Colors = Colors.Count == 0 ? new List <Color> { Color.Black } : Colors; }
public ChildTeachingTool() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; menu = new TopMenu(Services); IsMouseVisible = true; textRenderer = new TextRenderer(); textureRenderer = new TextureRenderer(); // Services.AddService(typeof(GraphicsDevice), GraphicsDevice); Services.AddService(typeof(ITextRenderer), textRenderer); Services.AddService(typeof(ITextureRenderer), textureRenderer); }
internal TextRegion(ITextRenderer renderer, int x, int y, uint w, uint h) { if (renderer == null) { throw new ArgumentNullException("renderer"); } _renderer = renderer; _startX = x; _startY = y; Width = w; Height = h; }
internal TextEffect(ITextRenderer renderer, Func effect) { if (renderer == null) throw new ArgumentNullException("renderer"); if (effect == null) throw new ArgumentNullException("effect"); _renderer = renderer; _effect = effect; Width = _renderer.Width; Height = _renderer.Height; }
public ImageSettings CreateImageSettings(string[] args, ITextRenderer textRenderer) { var arguments = new Docopt().Apply(usage, args, exit: true); var width = int.Parse(arguments["--image_width"].Value.ToString()); var height = int.Parse(arguments["--image_height"].Value.ToString()); var size = new Size(width, height); var imageName = arguments["--image_name"].Value.ToString(); var extention = arguments["--extention"].Value.ToString(); var textSize = int.Parse(arguments["--text_size"].Value.ToString()); var font = arguments["--font"].Value.ToString(); var colors = arguments["--colors"].Value.ToString(); return(new ImageSettings(size, imageName, extention, textSize, font, colors, textRenderer)); }
/// <summary> /// Draw part of a renderer to this renderer. /// </summary> public static void DrawImagePartial(this ITextRenderer renderer, int x, int y, ITextRenderer image, uint startX, uint startY, uint width, uint height) { if (x < -width || x > renderer.Width || y < -height || y > renderer.Height) { return; } for (var yy = 0; yy < height; yy++) { for (var xx = 0; xx < width; xx++) { renderer.Set(x + xx, y + yy, image.Get((int)startX + xx, (int)startY + yy)); } } }
/// <summary> /// Draw a renderer to this renderer. /// </summary> public static void DrawImage(this ITextRenderer renderer, int x, int y, ITextRenderer image) { if (x < -image.Width || x > renderer.Width || y < -image.Height || y > renderer.Height) { return; } for (var yy = 0; yy < image.Height; yy++) { for (var xx = 0; xx < image.Width; xx++) { renderer.Set(x + xx, y + yy, image.Get(xx, yy)); } } }
protected override void Awake() { Planets = new List <Planet>(); Ships = new List <Ship>(); PlayerPopulations = new Dictionary <Player, int>(); _gameOverText = Instantiate <TextRenderer>("GameOverText", new Vector2(Screen.Width / 2f, 50)); _gameOverText.Font = PlanetPopulationFont; _gameOverText.Size = 0.5f; OnPopulationChange += CheckForGameOver; foreach (var player in Players.Where(p => !p.IsNeutral)) { PlayerPopulations.Add(player, 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; } }
public override void Draw(ITextRenderer renderer) { var node = _children.Last; while (node != null) { var widget = node.Value; var next = node.Previous; if (widget.Visible) { var region = renderer.Region(widget.Left, widget.Top, widget.Width, widget.Height); node.Value.Draw(region); } node = next; } }
internal TextEffect(ITextRenderer renderer, Func effect) { if (renderer == null) { throw new ArgumentNullException("renderer"); } if (effect == null) { throw new ArgumentNullException("effect"); } _renderer = renderer; _effect = effect; Width = _renderer.Width; Height = _renderer.Height; }
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)); }
public ImageSettings CreateImageSettings(string[] args, ITextRenderer textRenderer) { var arguments = new Docopt().Apply(usage, args, exit: true); var widthResult = IntParser(arguments["--image_width"].Value); var heightResult = IntParser(arguments["--image_height"].Value); var textSizeResult = IntParser(arguments["--text_size"].Value); if (!widthResult.IsSuccess || !heightResult.IsSuccess || !textSizeResult.IsSuccess) { Environment.Exit((int)ErrorsCodes.IncorrectInput); } var font = arguments["--font"].Value.ToString(); var colors = arguments["--colors"].Value.ToString(); var size = new Size(widthResult.Value, heightResult.Value); var imageName = arguments["--image_name"].Value.ToString(); var extention = arguments["--extention"].Value.ToString(); return(new ImageSettings(size, imageName, extention, textSizeResult.Value, font, colors, textRenderer)); }
protected override void LoadContent() { _theEntireWorld.CreateCubeWorld(_graphicsDeviceManager, 40, 40, 40); _renderer = new TriangleRaytraceRenderer(_graphicsDeviceManager, _theEntireWorld, _screenWidth, _screenHeight, //new SkyHemisphereTexture(_graphicsDeviceManager, @"Content\skymap_photo8.jpg", HemisphereTextureType.Panorama, false, false, 0.1) //new SkyHemisphereTexture(_graphicsDeviceManager, @"Content\mosriver_fisheye220_4k.jpg", HemisphereTextureType.FisheyeVertical,false,false,0.18) //new SkySphereTexture(_graphicsDeviceManager, @"Content\mountain.jpg", SphereTextureType.Photo360) //new SkySphereTexture(_graphicsDeviceManager, @"Content\lobby.jpg", SphereTextureType.Photo360) //new SkySphereTexture(_graphicsDeviceManager, @"Content\angmap23.jpg", SphereTextureType.FisheyeHorizontal) //new SkyBoxTexture(_graphicsDeviceManager, @"Content\grimmnight_large.jpg") new SkyBoxTexture(_graphicsDeviceManager, @"Content\negz.jpg", @"Content\posz.jpg", @"Content\posy.jpg", @"Content\negy.jpg", @"Content\negx.jpg", @"Content\posx.jpg") ); _textRenderer = new TrueTypeSharpTextRenderer(_graphicsDeviceManager, @"Content\Anonymous Pro.ttf", _screenHeight / 15); //Not sure if this is wise, but a lot of objects was created when building the scene GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); }
public override void Draw(ITextRenderer renderer) { var captionX = (int)(Width - 1) / 2 - Caption.Length / 2; if (!_holding) { renderer.DrawBox(0, 0, Width - 1, 1, GuiSettings.SolidBox, GuiSettings.Button); renderer.Set((int)Width - 1, 0, GuiSettings.ButtonShadowR); for (var i = 0; i < Width; i++) { renderer.Set(1 + i, 1, GuiSettings.ButtonShadowB); } renderer.DrawText(captionX, 0, Caption, GuiSettings.Button); } else { renderer.DrawBox(1, 0, Width, 1, GuiSettings.SolidBox, GuiSettings.Button); renderer.DrawText(captionX + 1, 0, Caption, GuiSettings.Button); } }
public override void Draw(ITextRenderer renderer) { renderer.DrawBox(0, 0, Width, Height, TextExtensions.SingleBox, GuiSettings.ListBox); _scrollbar.Maximum = Math.Max(Items.Count - (Height - 2), 0); var startIndex = (int)_scrollbar.Value; for (var i = 0; i < Height - 2; i++) { var index = startIndex + i; if (index >= Items.Count) break; var reg = renderer.Region(1, i + 1, Width - 2, 1); var col = (SelectEnabled && Selected == index) ? GuiSettings.ListBoxItemSelected : GuiSettings.ListBoxItem; reg.Clear(col, true); reg.DrawText(0, 0, Items[index].Text, col); } _scrollbar.Draw(renderer.Region(_scrollbar.Left, _scrollbar.Top, _scrollbar.Width, _scrollbar.Height)); }
private Engine( IScreen screen, IController controller, IEventsCycle eventsCycle, ISceneRenderer sceneRenderer, IMiniMapRenderer miniMapRenderer, IStatusBarRenderer statusBarRenderer, ITextRenderer textRenderer) { Screen = screen; Controller = controller; EventsCycle = eventsCycle; this.sceneRenderer = sceneRenderer; this.miniMapRenderer = miniMapRenderer; this.statusBarRenderer = statusBarRenderer; this.textRenderer = textRenderer; previousTime = SDL_GetPerformanceCounter(); counterFrequency = SDL_GetPerformanceFrequency() / 1000.0f; eventsCycle.AddListener(controller); }
public virtual void Draw(ITextRenderer renderer) { }
private void Draw(ITextRenderer renderer, float x, float y, uint w, uint h, Character color) { renderer.DrawBox((int)x - _camera, (int)y, w, h, GuiSettings.SolidBox, color); }
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)); }
public virtual void Initialize() { if (!initialized) { this.textRenderer = (ITextRenderer)services.GetService(typeof(ITextRenderer)); LoadContent(); initialized = !initialized; } }
public override void Draw(ITextRenderer renderer, float originX, float originY, bool isSideways, bool isRtl, ClientDrawingEffect clientDrawingEffect) { SizeF size = this._bitmap.Size; this._renderer.DrawBitmap(this._bitmap, new RectF(originX, originY, size.Width, size.Height), 1, BitmapInterpolationMode.Linear); }
/// <summary> /// Draw part of a renderer to this renderer. /// </summary> public static void DrawImagePartial(this ITextRenderer renderer, int x, int y, ITextRenderer image, uint startX, uint startY, uint width, uint height) { if (x < -width || x > renderer.Width || y < -height || y > renderer.Height) return; for (var yy = 0; yy < height; yy++) { for (var xx = 0; xx < width; xx++) { renderer.Set(x + xx, y + yy, image.Get((int)startX + xx, (int)startY + yy)); } } }
public override void Draw(ITextRenderer renderer) { if (_drop == null || !_drop.Visible) _selected = null; if (!Focussed && _selected == null) Visible = false; renderer.DrawBox(0, 0, Width, Height, TextExtensions.SingleBox, GuiSettings.MenuOutline); var y = 1; foreach (var i in _items) { var highlight = _selected != null && _selected == i; i.Draw(renderer.Region(1, y, Width - 2, 1), highlight, true); y++; } }
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)); }
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); }