コード例 #1
0
    public void Render(IGameViewport viewport, LocAndOffsets location, ITexture texture)
    {
        var screenPos = viewport.WorldToScreen(location.ToInches3D());

        var contentRect = texture.GetContentRect();
        var renderArgs  = new Render2dArgs
        {
            srcRect  = contentRect,
            flags    = Render2dFlag.BUFFERTEXTURE,
            destRect = new Rectangle(
                (int)(screenPos.X - contentRect.Width / 2),
                (int)(screenPos.Y - contentRect.Height / 2),
                contentRect.Width,
                contentRect.Height
                ),
            customTexture = texture
        };

        Tig.ShapeRenderer2d.DrawRectangle(ref renderArgs);
    }