public void RenderNormalDialog(float x, float y, Vector4 color) { GL.DepthFunc(DepthFunction.Always); OrthoRenderEngine.DrawExtendedColoredTexturedBox(TextureCollection.DialogBG, color, x - 16, y - 16, Writer.Width + 32, Writer.Height + 32); OrthoRenderEngine.DrawTexturedBox(Writer.GetTextureID(), x, y, Writer.Width, Writer.Height); GL.DepthFunc(DepthFunction.Lequal); }
public void Render() { if (Time.CurrentTime() > time) { return; } GL.DepthFunc(DepthFunction.Always); OrthoRenderEngine.DrawExtendedColoredTexturedBox(TextureCollection.DialogBG, Util.LightRed60, x - 16, y - 16, Writer.Width + 32, Writer.Height + 32); OrthoRenderEngine.DrawTexturedBox(Writer.GetTextureID(), x, y, Writer.Width, Writer.Height); GL.DepthFunc(DepthFunction.Lequal); }
public void RenderView(Matrix4 VP, Scene s) { Inventory playerInv = game.GameStats.PlayerInventory; playerInv.Render(game); if (!transition.IsDone()) { return; } HatchInventory hatchInv = game.GameStats.HatchInv; float x = inventoryXPos; float y = inventoryYPos; OrthoRenderEngine.DrawTexturedBox(TextureCollection.Button, x, y, iconSize * iconsPerRow, iconSize * iconsPerRow, 0, 0, iconsPerRow, iconsPerRow); float itemX = 0; float itemY = 0; for (int i = 0; i < hatchInv.GetItemAmount(); i++) { Item item = hatchInv.GetItem(i); if (itemY + item.GetSize() > iconsPerRow) { itemY = 0; itemX++; if (itemX >= iconsPerRow) { } //TODO add multiple pages or something } item.RenderItem(x + itemX * iconSize, y + itemY * iconSize, iconSize, iconSize * item.GetSize()); itemY += item.GetSize(); } if (hoveredItem >= 0 & hoveredItem < hatchInv.GetItemAmount()) { Item item = hatchInv.GetItem(hoveredItem); game.TooltipHelper.ClaimIfPossible(this); if (game.TooltipHelper.GetOwner() == this) { game.TooltipHelper.RenderItemTooltip(item, Input.OrthoMouseX - 30, Input.OrthoMouseY); } } else if (game.TooltipHelper.GetOwner() == this) { game.TooltipHelper.UnClaim(); } }
public void Render(Smith2DGame game) { var cW = OrthoRenderEngine.GetCanvasWidth(); var cH = OrthoRenderEngine.GetCanvasHeight(); uint l = 0; for (int i = 0; i < GetItemAmount(); i++) { Item item = GetItem(i); Vector4 boxColor = i == selectedItem ? selected : Util.White; OrthoRenderEngine.DrawColoredTexturedBox(boxColor, TextureCollection.Button, cW - iconSize - overscan, cH - iconSize * (l + 0.5f) - overscan, iconSize, iconSize / 2, 0, 0, 1, 0.5f); OrthoRenderEngine.DrawColoredTexturedBox(boxColor, TextureCollection.Numbers, cW - iconSize - overscan + 2, cH - iconSize * l - overscan - 12, 10, 10, l / 4f, 0, 0.25f, 1); uint oldL = l; for (l++; l < oldL + item.GetSize(); l++) { OrthoRenderEngine.DrawColoredTexturedBox(boxColor, TextureCollection.Button, cW - iconSize - overscan, cH - iconSize * l - overscan, iconSize, iconSize / 2, 0, 0.25f, 1, 0.5f); OrthoRenderEngine.DrawColoredTexturedBox(boxColor, TextureCollection.Button, cW - iconSize - overscan, cH - iconSize * (l + 0.5f) - overscan, iconSize, iconSize / 2, 0, 0.25f, 1, 0.5f); } OrthoRenderEngine.DrawColoredTexturedBox(boxColor, TextureCollection.Button, cW - iconSize - overscan, cH - iconSize * l - overscan, iconSize, iconSize / 2, 0, 0.5f, 1, 0.5f); float bob = i == selectedItem ? (float)Math.Sin(Time.CurrentTime() * 5) * 4 + 2 : 0; item.RenderItem(cW - iconSize - overscan - bob, cH - iconSize * l - overscan - bob, iconSize + bob * 2, iconSize * item.GetSize() + bob * 2); } for (uint i = l; i < Inventory.SIZE; i++) { OrthoRenderEngine.DrawTexturedBox(TextureCollection.Button, cW - iconSize - 20, cH - iconSize * (i + 1) - 20, iconSize, iconSize, 0, 0, 1, 1); OrthoRenderEngine.DrawTexturedBox(TextureCollection.Numbers, cW - iconSize - 20 + 2, cH - iconSize * i - 20 - 12, 10, 10, i / 4f, 0, 0.25f, 1); } if (hoveredItem > -1 & hoveredItem < items.Count && items [hoveredItem] != null) { game.TooltipHelper.ClaimIfPossible(this); if (game.TooltipHelper.GetOwner() == this) { game.TooltipHelper.RenderItemTooltip(items [hoveredItem], OrthoRenderEngine.GetCanvasWidth() - overscan - iconSize - 32, Input.OrthoMouseY); } } else if (game.TooltipHelper.GetOwner() == this) { game.TooltipHelper.UnClaim(); } if (tooFull) { game.ErrortipHelper.ShowError(Localization.GetLocalization("ui.error.inventoryfull"), OrthoRenderEngine.GetCanvasWidth() - overscan, OrthoRenderEngine.GetCanvasHeight() - overscan - iconSize * SIZE - 32 - 30, 1.5f, true); tooFull = false; } }
public void RenderItemTooltip(Item i, float x, float y) { if (i != currentItem) { i.DrawTooltip(Writer); } x -= Writer.Width; y -= Writer.Height / 2; GL.DepthFunc(DepthFunction.Always); OrthoRenderEngine.DrawExtendedColoredTexturedBox(TextureCollection.DialogBG, Util.White60, x - 16, y - 16, Writer.Width + 32, Writer.Height + 32); OrthoRenderEngine.DrawTexturedBox(Writer.GetTextureID(), x, y, Writer.Width, Writer.Height); GL.DepthFunc(DepthFunction.Lequal); currentItem = i; }