public override void Render() { base.Render(); _hudCamera.Apply(); _tessellator.Begin(PrimitiveType.Quads); _tessellator.LoadIdentity(); _tessellator.Translate(0, 0, 10); var scale = new Vector2(_ascii.Width, _ascii.Height) * 2; _tessellator.Scale(scale.X, scale.Y); var alpha = 255; _tessellator.Translate(_hudCamera.Projection.Left, _hudCamera.Projection.Bottom - scale.Y); foreach (var message in _progressMessages) { _tessellator.BindColor(Color.FromArgb(alpha, Color.White)); _ascii.RenderText(_tessellator, message); _tessellator.Translate(0, -scale.Y); alpha = MathHelper.Clamp(alpha - 8, 0, 255); } _tessellator.End(); }
public override void Render() { base.Render(); _hudCamera.Apply(); _tessellator.Begin(PrimitiveType.Quads); _tessellator.LoadIdentity(); _tessellator.Translate(0, 0, -10); _tessellator.BindTexture(null); _tessellator.BindColor(Color.FromArgb(64, Color.Black)); _tessellator.AddPoint(_hudCamera.Projection.Left, _hudCamera.Projection.Top); _tessellator.AddPoint(_hudCamera.Projection.Left, _hudCamera.Projection.Bottom); _tessellator.AddPoint(_hudCamera.Projection.Right, _hudCamera.Projection.Bottom); _tessellator.AddPoint(_hudCamera.Projection.Right, _hudCamera.Projection.Top); _tessellator.BindColor(Color.White); var scale = new Vector2(_ascii.Width, _ascii.Height) * 4; _tessellator.Scale(scale.X, scale.Y); _tessellator.Translate(-scale.X * PAUSE_MESSAGE.Length / 2, -scale.Y / 2); _ascii.RenderText(_tessellator, PAUSE_MESSAGE); _tessellator.End(); //_writer.Write(PAUSE_MESSAGE); }
/// <summary> /// Calculate a scale according to the current position. /// </summary> /// <remarks> /// This assumes you are inside of RenderContent, and handles pushing and popping the current transformation accordingly. /// </remarks> protected void Scale(ITessellator tessellator, float scale) { var position = tessellator.Transform(Vector2.Zero); tessellator.PopTransform(); tessellator.PushTransform(); tessellator.Scale(scale, scale); tessellator.Translate(position); }
public void Apply(ITessellator tessellator) { var position = tessellator.Transform(Vector2.Zero); tessellator.Translate(-position); tessellator.Scale(Scale.X, Scale.Y); tessellator.Rotate(Rotation, 0, 0, 1); tessellator.Translate(Translation); tessellator.Translate(position); }
private void Render(ITessellator tessellator, PlayerEntity entity) { tessellator.PushTransform(); var origin = tessellator.Transform(Vector3.Zero); tessellator.LoadIdentity(); tessellator.Scale(entity.Size, entity.Size); tessellator.Translate(origin); //tessellator.Translate(0.1f, 0.1f); // center on the current tile position tessellator.Translate(entity.Position); // move to the entity's position _playerTile.Render(tessellator); tessellator.PopTransform(); }
private void Render(ITessellator tessellator, BlockEntity entity) { var color = tessellator.CurrentColor; tessellator.BindColor(Color.FromArgb(196, entity.IsSelected ? Color.Red : Color.White)); tessellator.PushTransform(); var origin = tessellator.Transform(Vector3.Zero); tessellator.LoadIdentity(); tessellator.Scale(entity.Size, entity.Size); tessellator.Translate(-entity.Size / 2, -entity.Size / 2); // center the rotation tessellator.Rotate(entity.Rotation, 0, 0, 1); tessellator.Translate(entity.Size, entity.Size); tessellator.Translate(origin); //tessellator.Translate(entity.Size, entity.Size); // center on the current tile position tessellator.Translate(entity.Position); // move to the entity's position BlockRegistry.Instance.GetById(entity.BlockID).Renderer.Render(tessellator); tessellator.PopTransform(); tessellator.BindColor(color); // TODO: Is this still needed? }