private PlayerInventory(int x, int y) : base(x, y) { //inventory Pos = new Vector2(((2 - x * SizeX) / 2) - 1, -0.5); HotbarPos = new Vector2(Pos.x, -1); TextPosOffset = new Vector2(0.115, 0.03); textStyle = TextStyle.LucidaConsole_SingleLine_Small; textStyle.alignment = TextAlignment.BottomRight; ItemCountText = new Text[x, y - 1]; for (int i = 0; i < ItemCountText.GetLength(0); i++) { for (int j = 0; j < ItemCountText.GetLength(1); j++) { ItemCountText[i, j] = new Text("", textStyle, new Vector2(i * SizeX, 2 * j * (SizeY - ItemTextureOffset))); } } HotbarItemCountText = new Text[x]; for (int i = 0; i < ItemCountText.GetLength(0); i++) { HotbarItemCountText[i] = new Text("", textStyle, new Vector2(i * SizeX, 0)); } Frame = new GuiModel(Generate_FrameVao(), TextureUtil.CreateTexture(new Vector3(0, 0, 0.1)), BeginMode.Lines, new Vector2(1, 1)); { Vector2[] vertices; int[] elements; Vector2[] uvs; Generate_ItemDisplayData(out vertices, out elements, out uvs); GuiVAO vao = new GuiVAO(vertices, elements, uvs); ItemDisplay = new GuiModel(vao, Textures.ItemTexture, BeginMode.Triangles, new Vector2(1, 1)); } SelectedDisplay = GuiModel.CreateWireRectangleTopLeft(new Vector2(SizeX, SizeY), Color.Blue); Background = GuiModel.CreateRectangleTopLeft(new Vector2(x * SizeX, (y - 1) * SizeY), TextureUtil.CreateTexture(new Vector4(0.3, 0.3, 0.3, 0.8))); HotbarBackground = GuiModel.CreateRectangleTopLeft(new Vector2(x * SizeX, SizeY), TextureUtil.CreateTexture(new Vector4(0.3, 0.3, 0.3, 0.8))); TextStyle style = new TextStyle(TextAlignment.TopLeft, TextFont.LucidaConsole, 0.8f, 1f, 1, 1f, new Vector3(1, 1, 1)); InvText = new Text("Inventory", style, new Vector2(0.015 + Pos.x, Pos.y + 2 * (y - 0.5) * SizeY)); InvTextBackground = GuiModel.CreateRectangleTopLeft(new Vector2(x * SizeX, SizeY), TextureUtil.CreateTexture(new Vector4(0.3, 0.3, 0.3, 0.8))); InvTextLine = GuiModel.CreateLine(new Vector2(x * SizeX, 0), TextureUtil.CreateTexture(new Vector4(0.05, 0.05, 0.1, 0.9))); var itemnamestyle = TextStyle.LucidaConsole_SingleLine_Small; itemnamestyle.alignment = TextAlignment.Bottom; ItemNameText = new Text("", itemnamestyle, HotbarPos + new Vector2(0, SizeY)); //hotbar CurSelectedSlot = 0; HotbarFrame = new GuiModel(Generate_HotbarFrameVao(), TextureUtil.CreateTexture(new Vector3(0, 0, 0.1)), BeginMode.Lines, new Vector2(1, 1)); HotbarItemDisplay = new GuiModel(Generate_HotbarItemDisplayVao(), Textures.ItemTexture, BeginMode.Triangles, new Vector2(1, 1)); HotbarSelectedDisplay = GuiModel.CreateWireRectangleTopLeft(new Vector2(SizeX, SizeY), Color.Blue); }
private void InitModel() { Vector2[] vertices; int[] elements; Vector2[] uvs; SetTextHelper(style.font.fontTexture.Size.Width, style.size, style.font.fontTexture.Size.Height, out vertices, out elements, out uvs); GuiVAO vao = new GuiVAO(vertices, elements, uvs); model = new GuiModel(vao, style.font.fontTexture, BeginMode.Triangles, new Vector2(style.size, style.size)); }