public void Redraw( IDrawer2D drawer ) { drawer.DrawRect( FastColour.Black, X, Y, Width, Height ); if( Value ) { DrawTextArgs args = new DrawTextArgs( "X", font, false ); Size size = drawer.MeasureSize( ref args ); args.SkipPartsCheck = true; drawer.DrawText( ref args, X + (Width - size.Width) / 2, Y + (Height - size.Height) / 2 ); } drawer.DrawRectBounds( FastColour.White, 2, X, Y, Width, Height ); }
public override void Redraw( IDrawer2D drawer ) { if( Window.Minimised ) return; drawer.DrawRect( FastColour.Black, X, Y, Width, Height ); if( Value ) { DrawTextArgs args = new DrawTextArgs( "X", font, false ); Size size = drawer.MeasureSize( ref args ); args.SkipPartsCheck = true; drawer.DrawText( ref args, X + (Width + 2 - size.Width) / 2, // account for border Y + (Height - size.Height) / 2 ); } drawer.DrawRectBounds( FastColour.White, 2, X, Y, Width, Height ); }
public override void Init() { graphicsApi.Fog = false; SetTitle(serverName); SetMessage(serverMotd); progX = game.Width / 2f - progWidth / 2f; Size size = new Size(progWidth, progHeight); using (Bitmap bmp = IDrawer2D.CreatePow2Bitmap(size)) { using (IDrawer2D drawer = game.Drawer2D) { drawer.SetBitmap(bmp); drawer.DrawRectBounds(FastColour.White, 3f, 0, 0, progWidth, progHeight); progressBoxTexture = drawer.Make2DTexture(bmp, size, (int)progX, (int)progY); } } game.MapEvents.MapLoading += MapLoading; }
public void Redraw( IDrawer2D drawer, string text, Font font ) { Text = text; if( Password ) text = new String( '*', text.Length ); DrawTextArgs args = new DrawTextArgs( text, font, true ); Size size = drawer.MeasureSize( ref args ); Width = Math.Max( ButtonWidth, size.Width + 7 ); FastColour col = Active ? FastColour.White : new FastColour( 160, 160, 160 ); drawer.DrawRectBounds( col, 2, X, Y, Width, Height ); drawer.DrawRect( FastColour.Black, X + 2, Y + 2, Width - 4, Height - 4 ); args.SkipPartsCheck = true; drawer.DrawText( ref args, X + 7, Y + 2 ); }