private void GenerateHealthBuffer() { if (lastHealth == player.Health) { return; } VertexBuffer.Dispose(ref healthBuffer); float pixel = 1f / 256f; float texX = 16f * pixel; float texY = 0; t.StartDrawingAlphaTexturedQuads("icons"); Vector4 color = new Vector4(1, 1, 1, 1); float posx = 0; for (int i = 0; i < 10; i++) { t.SetTextureQuad(new Vector2(texX, texY), 9f * pixel, 9f * pixel); t.AddVertexWithColor(new Vector4(posx + 0f, 0f, 0f, 1.0f), color); t.AddVertexWithColor(new Vector4(posx + 0f, 9f, 0f, 1.0f), color); t.AddVertexWithColor(new Vector4(posx + 9f, 9f, 0f, 1.0f), color); t.AddVertexWithColor(new Vector4(posx + 9f, 0f, 0f, 1.0f), color); if (i < (int)(player.Health / 10f)) { t.SetTextureQuad(new Vector2(texX + pixel * 4f * 9f, texY), 9f * pixel, 9f * pixel); t.AddVertexWithColor(new Vector4(posx + 0f, 0f, 0f, 1.0f), color); t.AddVertexWithColor(new Vector4(posx + 0f, 9f, 0f, 1.0f), color); t.AddVertexWithColor(new Vector4(posx + 9f, 9f, 0f, 1.0f), color); t.AddVertexWithColor(new Vector4(posx + 9f, 0f, 0f, 1.0f), color); } posx += 9f; } healthBuffer = t.GetVertexBuffer(); lastHealth = player.Health; }
internal void RenderProfiler() { if (profileVertexBuffer == null) { return; } t.ResetTransformation(); t.StartDrawingAlphaTexturedQuads("ascii"); t.Draw(profileVertexBuffer); }
internal void BeginBatch() { t.StartDrawingAlphaTexturedQuads("ascii"); renderBatch = true; }