void DrawPosition() { int index = 0; Texture tex = posAtlas.tex; tex.X1 = 2; tex.Width = (ushort)posAtlas.offset; IGraphicsApi.Make2DQuad(ref tex, FastColour.WhitePacked, game.ModelCache.vertices, ref index); Vector3I pos = Vector3I.Floor(game.LocalPlayer.Position); posAtlas.curX = posAtlas.offset + 2; VertexP3fT2fC4b[] vertices = game.ModelCache.vertices; posAtlas.Add(13, vertices, ref index); posAtlas.AddInt(pos.X, vertices, ref index); posAtlas.Add(11, vertices, ref index); posAtlas.AddInt(pos.Y, vertices, ref index); posAtlas.Add(11, vertices, ref index); posAtlas.AddInt(pos.Z, vertices, ref index); posAtlas.Add(14, vertices, ref index); gfx.BindTexture(posAtlas.tex.ID); gfx.UpdateDynamicVb_IndexedTris(game.ModelCache.vb, game.ModelCache.vertices, index); }
void DrawCounts() { SurvivalGameMode surv = (SurvivalGameMode)game.Mode; VertexP3fT2fC4b[] vertices = game.ModelCache.vertices; int index = 0; posAtlas.tex.Y = (short)(game.Height - barHeight + 10 * (elemSize / 16)); int offset = game.Inventory.Offset; for (int i = 0; i < Inventory.BlocksPerRow; i++) { int x = (int)(X + (elemSize + borderSize) * i); if (survivalinventory.invCount[offset + i] > 9) { posAtlas.curX = (int)(x + 7 * (elemSize / 16)); } else { posAtlas.curX = (int)(x + 14 * (elemSize / 16)); } if (survivalinventory.invCount[offset + i] > 1) { posAtlas.AddInt(survivalinventory.invCount[offset + i], vertices, ref index); } } gfx.BindTexture(posAtlas.tex.ID); gfx.UpdateDynamicIndexedVb(DrawMode.Triangles, game.ModelCache.vb, game.ModelCache.vertices, index); }
void RenderTextOverlay() { int index = 0; idAtlas.tex.Y = (short)(yOffset + (tileSize - idAtlas.tex.Height)); for (int y = 1; y <= TerrainAtlas2D.RowsCount; y++) { for (int x = 0; x < TerrainAtlas2D.TilesPerRow; x++) { idAtlas.curX = xOffset + tileSize * x + textOffset; int id = x + ((y - 1) * TerrainAtlas2D.TilesPerRow); idAtlas.AddInt(id, vertices, ref index); } idAtlas.tex.Y += (short)tileSize; if ((y % 4) != 0) { continue; } gfx.BindTexture(idAtlas.tex.ID); gfx.UpdateDynamicVb_IndexedTris(dynamicVb, vertices, index); index = 0; } }
void RenderText() { int index = 0; idAtlas.tex.Y = (short)(yOffset + (tileSize - idAtlas.tex.Height)); for (int y = 0; y < Atlas2D.TilesPerRow; y++) { for (int x = 0; x < Atlas2D.TilesPerRow; x++) { idAtlas.curX = xOffset + tileSize * x + textOffset; int id = x + y * Atlas2D.TilesPerRow; idAtlas.AddInt(id + baseTexLoc, vertices, ref index); } idAtlas.tex.Y += (short)tileSize; if ((y % 4) != 3) { continue; } game.Graphics.BindTexture(idAtlas.tex.ID); game.Graphics.UpdateDynamicVb_IndexedTris(dynamicVb, vertices, index); index = 0; } }
void DrawCounts() { SurvivalGameMode surv = (SurvivalGameMode)game.Mode; VertexP3fT2fC4bN1v[] vertices = game.ModelCache.vertices; int index = 0; posAtlas.tex.Y = (short)(Y + (Height - (int)(12 * game.GuiHotbarScale))); int xAdj = (int)(14 * game.GuiHotbarScale); int xAdj2 = (int)(7 * game.GuiHotbarScale); int offset = 0; for (int i = 0; i < Inventory.BlocksPerRow; i++) { if (game.SurvInv.ItemList[i] == null) { continue; } int x = (int)(X + (elemSize + borderSize) * i + xAdj); int count = 0; if (game.SurvInv.ItemList[i] != null) { count = game.SurvInv.ItemList[i].Count; } int xAdj3 = (count.ToString().Length - 1) * xAdj2; if (xAdj3 < 0) { xAdj3 = 0; } x -= xAdj3; posAtlas.curX = x; if (count > 1) { posAtlas.AddInt(count, vertices, ref index); } } game.Graphics.BindTexture(posAtlas.tex.ID); game.Graphics.UpdateDynamicVb_IndexedTris(game.ModelCache.vb, game.ModelCache.vertices, index); }
void DrawCounts() { SurvivalGameMode surv = (SurvivalGameMode)game.Mode; VertexP3fT2fC4b[] vertices = game.ModelCache.vertices; int index = 0; posAtlas.tex.Y = (short)(Y + (Height - barHeight)); int offset = game.Inventory.Offset; for (int i = 0; i < Inventory.BlocksPerRow; i++) { int x = (int)(X + (elemSize + borderSize) * i); posAtlas.curX = x; if (surv.invCount[offset + i] > 1) { posAtlas.AddInt(surv.invCount[offset + i], vertices, ref index); } } game.Graphics.BindTexture(posAtlas.tex.ID); game.Graphics.UpdateDynamicVb_IndexedTris(game.ModelCache.vb, game.ModelCache.vertices, index); }
void DrawCounts() { VertexP3fT2fC4bN1v[] vertices = game.ModelCache.vertices; int index = 0; posAtlas.tex.Y = (short)(Y + ((int)(12 * game.GuiInventoryScale))); int xAdj = (int)(14 * game.GuiInventoryScale); int xAdj2 = (int)(7 * game.GuiInventoryScale); int yAdd = 0; for (int y = 0; y < totalRows; y++) { for (int i = 0; i < 9; i++) { int x = X + (i * blockSize); int count = 0; if (game.SurvInv.ItemList[i + yAdd] != null) { count = game.SurvInv.ItemList[i + yAdd].Count; } int xAdj3 = (count.ToString().Length - 1) * xAdj2; //if (xAdj3 < 0) xAdj3 = 0; //x -= xAdj3; posAtlas.curX = x; if (count > 1) { posAtlas.AddInt(count, vertices, ref index); } } game.Graphics.BindTexture(posAtlas.tex.ID); game.Graphics.UpdateDynamicVb_IndexedTris(game.ModelCache.vb, game.ModelCache.vertices, index); posAtlas.tex.Y += (short)blockSize; yAdd += 9; } int gridSize = (int)Math.Sqrt(CraftingItems.Length); for (int y = 0; y < gridSize; y++) { for (int i = 0; i < gridSize; i++) { int x = X + (i * blockSize); int count = 0; if (CraftingItems[i + (y * gridSize)] != null) { count = CraftingItems[i + (y * gridSize)].Count; } int xAdj3 = (count.ToString().Length - 1) * xAdj2; //if (xAdj3 < 0) xAdj3 = 0; //x -= xAdj3; posAtlas.curX = x; if (count > 1) { posAtlas.AddInt(count, vertices, ref index); } } game.Graphics.BindTexture(posAtlas.tex.ID); game.Graphics.UpdateDynamicVb_IndexedTris(game.ModelCache.vb, game.ModelCache.vertices, index); posAtlas.tex.Y += (short)blockSize; yAdd += gridSize; } posAtlas.tex.Y -= (short)((gridSize + 1) * blockSize); posAtlas.tex.Y += (short)(((gridSize + 1) * blockSize) / 2); for (int y = 0; y < 1; y++) { for (int i = 0; i < 1; i++) { int x = X + (8 * blockSize); int count = 0; if (CraftedItem != null) { count = CraftedItem.Count; } int xAdj3 = (count.ToString().Length - 1) * xAdj2; //if (xAdj3 < 0) xAdj3 = 0; //x -= xAdj3; posAtlas.curX = x; if (count > 1) { posAtlas.AddInt(count, vertices, ref index); } } game.Graphics.BindTexture(posAtlas.tex.ID); game.Graphics.UpdateDynamicVb_IndexedTris(game.ModelCache.vb, game.ModelCache.vertices, index); posAtlas.tex.Y += (short)blockSize; yAdd += gridSize; } }