示例#1
0
        public void RenderView(Matrix4 VP, Scene s)
        {
            if (PrevView != null)
            {
                PrevView.RenderView(VP, s);
            }
            OrthoRenderEngine.DrawColorOnEntireScreen(gradiantColor);
            OrthoRenderEngine.DrawColoredBox(Vector4.UnitW, barXPos, 0, barWidth, OrthoRenderEngine.GetCanvasHeight());
            float maxY = OrthoRenderEngine.GetCanvasHeight() * 0.55f;
            float x    = Input.OrthoMouseX - barXPos;
            float y    = maxY + optionHeight - Input.OrthoMouseY;

            if (x > 0 & x < barWidth & y > 0 & y < writers.Length * optionHeight)
            {
                hovering = (int)y / optionHeight;
            }
            else
            {
                hovering = -1;
            }
            for (int i = 0; i < writers.Length; i++)
            {
                OrthoRenderEngine.DrawColoredTexturedBox(hovering == i ? Util.White : Util.White60, writers[i].GetTextureID(), barXPos, maxY - optionHeight * i, writers[i].Width, writers[i].Height);
            }
        }
示例#2
0
        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;
            }
        }