public override void Render(double delta) { IGraphicsApi gfx = game.Graphics; int x = X, width = Width; gfx.Draw2DQuad(x, Y, width, Height, scrollBackCol); int y, height; GetScrollbarCoords(out y, out height); x += scrollBorder; width -= scrollBorder * 2; y += Y; bool hovered = game.Mouse.Y >= y && game.Mouse.Y < (y + height) && game.Mouse.X >= x && game.Mouse.X < (x + width); FastColour barCol = hovered ? scrollHoverCol : scrollBarCol; gfx.Draw2DQuad(x, y, width, height, barCol); if (height < 20) { return; } x += nubsWidth; width -= nubsWidth * 2; y += (height / 2); gfx.Draw2DQuad(x, y - 1 - 4, width, scrollBorder, scrollBackCol); gfx.Draw2DQuad(x, y - 1, width, scrollBorder, scrollBackCol); gfx.Draw2DQuad(x, y - 1 + 4, width, scrollBorder, scrollBackCol); }
public override void Render(double delta) { IGraphicsApi gfx = game.Graphics; gfx.Draw2DQuad(TableX, TableY, TableWidth, TableHeight, topBackCol, bottomBackCol); if (totalRows > MaxRowsDisplayed) { scroll.Render(delta); } if (SelectedIndex != -1 && game.ClassicMode) { int x, y; GetCoords(SelectedIndex, out x, out y); float off = blockSize * 0.1f; int size = (int)(blockSize + off * 2); gfx.Draw2DQuad((int)(x - off), (int)(y - off), size, size, topSelCol, bottomSelCol); } gfx.Texturing = true; gfx.SetBatchFormat(VertexFormat.P3fT2fC4b); drawer.BeginBatch(game, vertices, vb); for (int i = 0; i < Elements.Length; i++) { int x, y; if (!GetCoords(i, out x, out y)) { continue; } // We want to always draw the selected block on top of others if (i == SelectedIndex) { continue; } drawer.DrawBatch(Elements[i], blockSize * 0.7f / 2f, x + blockSize / 2, y + blockSize / 2); } if (SelectedIndex != -1) { int x, y; GetCoords(SelectedIndex, out x, out y); drawer.DrawBatch(Elements[SelectedIndex], (blockSize + selBlockExpand) * 0.7f / 2, x + blockSize / 2, y + blockSize / 2); } drawer.EndBatch(); if (descTex.IsValid) { descTex.Render(gfx); } gfx.Texturing = false; }
public override void Render(double delta) { IGraphicsApi gfx = game.Graphics; gfx.Texturing = true; DrawBackground(); titleWidget.Render(delta); messageWidget.Render(delta); gfx.Texturing = false; int progX = game.Width / 2 - progWidth / 2; int progY = game.Height / 2 - progHeight / 2; gfx.Draw2DQuad(progX, progY, progWidth, progHeight, backCol); gfx.Draw2DQuad(progX, progY, (int)(progWidth * progress), progHeight, progressCol); }
public override void Render(double delta) { IGraphicsApi gfx = game.Graphics; gfx.Texturing = true; DrawBackground(); titleWidget.Render(delta); messageWidget.Render(delta); gfx.Texturing = false; int x = CalcPos(Anchor.Centre, 0, progWidth, game.Width); int y = CalcPos(Anchor.Centre, 34, progHeight, game.Height); gfx.Draw2DQuad(x, y, progWidth, progHeight, backCol); gfx.Draw2DQuad(x, y, (int)(progWidth * progress), progHeight, progressCol); }
public override void Render(double delta) { IGraphicsApi gfx = game.Graphics; gfx.Draw2DQuad(TableX, TableY, TableWidth, TableHeight, topBackCol, bottomBackCol); if (totalRows > MaxRowsDisplayed) { scroll.Render(delta); } if (SelectedIndex != -1 && !CraftingSelected && !CraftedSelected) { int x, y; GetCoords(SelectedIndex, out x, out y); float off = blockSize * 0.1f; int size = (int)(blockSize + off * 2); gfx.Draw2DQuad((int)(x - off), (int)(y - off), size, size, topSelCol, bottomSelCol); } else if (SelectedIndex != -1 && CraftingSelected) { int x, y; GetCoords2(SelectedIndex, out x, out y); float off = blockSize * 0.1f; int size = (int)(blockSize + off * 2); gfx.Draw2DQuad((int)(x - off), (int)(y - off), size, size, topSelCol, bottomSelCol); } else if (SelectedIndex != -1 && CraftedSelected) { int x, y; GetCoords3(SelectedIndex, out x, out y); float off = blockSize * 0.1f; int size = (int)(blockSize + off * 2); gfx.Draw2DQuad((int)(x - off), (int)(y - off), size, size, topSelCol, bottomSelCol); } gfx.Texturing = true; gfx.SetBatchFormat(VertexFormat.P3fT2fC4bN1v); drawer.BeginBatch(game, vertices, vb); for (int i = 0; i < game.SurvInv.ItemList.Length; i++) { int x, y; if (!GetCoords(i, out x, out y)) { continue; } // We want to always draw the selected block on top of others if (i == SelectedIndex && !CraftingSelected && !CraftedSelected) { continue; } BlockID block; if (game.SurvInv.ItemList[i] != null) { block = (BlockID)game.SurvInv.ItemList[i].id; } else { block = Block.Air; } drawer.DrawBatch(block, blockSize * 0.7f / 2f, x + blockSize / 2, y + blockSize / 2); } for (int i = 0; i < CraftingItems.Length; i++) { int x, y; if (!GetCoords2(i, out x, out y)) { continue; } // We want to always draw the selected block on top of others if (i == SelectedIndex && CraftingSelected) { continue; } BlockID block; if (CraftingItems[i] != null) { block = (BlockID)CraftingItems[i].id; } else { block = Block.Air; } drawer.DrawBatch(block, blockSize * 0.7f / 2f, x + blockSize / 2, y + blockSize / 2); } for (int i = 0; i == 0; i++) { int x, y; if (!GetCoords3(i, out x, out y)) { continue; } // We want to always draw the selected block on top of others if (i == SelectedIndex && CraftedSelected) { continue; } BlockID block; if (CraftedItem != null) { block = (BlockID)CraftedItem.id; } else { block = Block.Air; } drawer.DrawBatch(block, blockSize * 0.7f / 2f, x + blockSize / 2, y + blockSize / 2); } if (SelectedIndex != -1 && !CraftingSelected && !CraftedSelected) { int x, y; GetCoords(SelectedIndex, out x, out y); BlockID block; if (game.SurvInv.ItemList[SelectedIndex] != null) { block = (BlockID)game.SurvInv.ItemList[SelectedIndex].id; } else { block = Block.Air; } drawer.DrawBatch(block, (blockSize + selBlockExpand) * 0.7f / 2, x + blockSize / 2, y + blockSize / 2); } else if (SelectedIndex != -1 && CraftingSelected) { int x, y; GetCoords2(SelectedIndex, out x, out y); BlockID block; if (CraftingItems[SelectedIndex] != null) { block = (BlockID)CraftingItems[SelectedIndex].id; } else { block = Block.Air; } drawer.DrawBatch(block, (blockSize + selBlockExpand) * 0.7f / 2, x + blockSize / 2, y + blockSize / 2); } else if (SelectedIndex != -1 && CraftedSelected) { int x, y; GetCoords3(SelectedIndex, out x, out y); BlockID block; if (CraftedItem != null) { block = (BlockID)CraftedItem.id; } else { block = Block.Air; } drawer.DrawBatch(block, (blockSize + selBlockExpand) * 0.7f / 2, x + blockSize / 2, y + blockSize / 2); } drawer.EndBatch(); DrawCounts(); drawer.BeginBatch(game, vertices, vb); if (cursorItem != null) { Point cursorPos = game.DesktopCursorPos; Point topLeft = game.PointToScreen(Point.Empty); cursorPos.X -= topLeft.X; cursorPos.Y -= topLeft.Y; drawer.DrawBatch(cursorItem.id, (blockSize + selBlockExpand) * 0.7f / 2, cursorPos.X, cursorPos.Y); } drawer.EndBatch(); DrawHeldCount(); if (descTex.IsValid) { descTex.Render(gfx); } gfx.Texturing = false; }