示例#1
0
        public override void Render(double delta)
        {
            graphicsApi.Texturing = true;
            RenderHotbar();
            IsometricBlockDrawer.lastTexId = -1;

            for (int i = 0; i < hotbarCount; i++)
            {
                byte block = (byte)game.Inventory.Hotbar[i];
                int  x     = (int)(X + barXOffset + (elemSize + borderSize) * i + elemSize / 2);
                int  y     = (int)(game.Height - barHeight / 2);

                float scale = (elemSize * 13.5f / 16f) / 2f;
                IsometricBlockDrawer.Draw(game, block, scale, x, y);
            }
            graphicsApi.Texturing = false;
        }
示例#2
0
        public override void Render(double delta)
        {
            graphicsApi.Draw2DQuad(TableX, TableY, TableWidth, TableHeight, backCol);
            if (rows > maxRows)
            {
                DrawScrollbar();
            }
            graphicsApi.Texturing = true;
            graphicsApi.SetBatchFormat(VertexFormat.Pos3fTex2fCol4b);

            IsometricBlockDrawer.lastTexId = -1;
            for (int i = 0; i < blocksTable.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 == selIndex)
                {
                    continue;
                }
                IsometricBlockDrawer.Draw(game, (byte)blocksTable[i], blockSize * 0.7f / 2f,
                                          x + blockSize / 2, y + blockSize / 2);
            }

            if (selIndex != -1)
            {
                int x, y;
                GetCoords(selIndex, out x, out y);
                IsometricBlockDrawer.lastTexId = -1;
                IsometricBlockDrawer.Draw(game, (byte)blocksTable[selIndex], (blockSize + selBlockExpand) * 0.7f / 2,
                                          x + blockSize / 2, y + blockSize / 2);
            }

            if (blockInfoTexture.IsValid)
            {
                blockInfoTexture.Render(graphicsApi);
            }
            game.hudScreen.RenderHotbar(delta);
            graphicsApi.Texturing = false;
        }