public override void Render(double delta)
        {
            IGraphicsApi gfx = game.Graphics;

            if (!texture.IsValid)
            {
                return;
            }
            Texture back = Active ? selectedTex : shadowTex;

            if (Disabled)
            {
                back = disabledTex;
            }

            back.ID    = game.UseClassicGui ? game.Gui.GuiClassicTex : game.Gui.GuiTex;
            back.X1    = X; back.Y1 = Y;
            back.Width = (ushort)Width; back.Height = (ushort)Height;

            if (Width == 400)
            {
                // Button can be drawn normally
                back.U1 = 0; back.U2 = uWidth;
                back.Render(gfx);
            }
            else
            {
                // Split button down the middle
                float scale = (Width / 400f) * 0.5f;
                gfx.BindTexture(back.ID);                 // avoid bind twice

                back.Width = (ushort)(Width / 2);
                back.U1    = 0; back.U2 = uWidth * scale;
                gfx.Draw2DTexture(ref back, FastColour.White);

                back.X1 += (short)(Width / 2);
                back.U1  = uWidth - uWidth * scale; back.U2 = uWidth;
                gfx.Draw2DTexture(ref back, FastColour.White);
            }

            FastColour col = Disabled ? disabledCol : (Active ? activeCol : normCol);

            texture.Render(gfx, col);
        }
 public void Render( IGraphicsApi graphics, FastColour colour )
 {
     graphics.BindTexture( ID );
     graphics.Draw2DTexture( ref this, colour );
 }
Exemple #3
0
 public void Render(IGraphicsApi gfx)
 {
     gfx.BindTexture(ID);
     gfx.Draw2DTexture(ref this, PackedCol.White);
 }
Exemple #4
0
 public void Render(IGraphicsApi gfx, PackedCol col)
 {
     gfx.BindTexture(ID);
     gfx.Draw2DTexture(ref this, col);
 }
Exemple #5
0
 public void Render(IGraphicsApi gfx, FastColour colour)
 {
     gfx.BindTexture(ID);
     gfx.Draw2DTexture(ref this, colour);
 }
Exemple #6
0
 public void Render(IGraphicsApi gfx)
 {
     gfx.BindTexture(ID);
     gfx.Draw2DTexture(ref this, FastColour.White);
 }
Exemple #7
0
 public void RenderNoBind( IGraphicsApi graphics )
 {
     graphics.Draw2DTexture( ref this );
 }
Exemple #8
0
 public void Render( IGraphicsApi graphics )
 {
     graphics.BindTexture( ID );
     graphics.Draw2DTexture( ref this );
 }
Exemple #9
0
 public void Render(IGraphicsApi graphics)
 {
     graphics.BindTexture(ID);
     graphics.Draw2DTexture(ref this);
 }