31 using System.Collections.Generic;
44 private Color _actColor =
new Color( 255, 255, 255, 200 );
45 private Color _inactColor =
new Color( 50, 50, 50, 50 );
46 private Color _actTitle =
new Color( 255, 255, 255, 100 );
47 private Color _inactTitle =
new Color( 128, 128, 128, 50 );
49 private bool moving =
false;
51 private bool prevMouseVisible =
true;
73 public Color ActiveColor
75 get {
return _actColor; }
76 set { _actColor = value; }
82 public Color InactiveColor
84 get {
return _inactColor; }
85 set { _inactColor = value; }
91 public delegate
void WindowHandler(
Window sender );
98 private void OnClosed()
100 if ( Closed != null )
118 public Window(
double width,
double height )
121 SizingByLayout =
false;
132 return new Vector( screen.Width * ( 7.0 / 8.0 ), screen.Height * ( 7.0 / 8.0 ) );
135 private void initialize()
137 AddedToGame += ShowMouse;
138 Removed += RestoreMouse;
141 ControlContext.Activated += Window_Activated;
142 ControlContext.Deactivated += Window_Deactivated;
145 AddedToGame += AddControls;
153 private void ShowMouse()
162 private void RestoreMouse()
175 void StartMoveWindow()
177 if (
Game == null )
return;
178 movementCenter = this.Position -
Game.
Mouse.PositionOnScreen;
184 if ( !moving )
return;
185 this.Position = movementCenter +
Game.
Mouse.PositionOnScreen;
193 void Window_Activated()
195 base.Color = ActiveColor;
198 void Window_Deactivated()
200 base.Color = InactiveColor;
208 if ( Parent != null )
209 Parent.Remove(
this );
static Color Darker(Color c, int howMuch)
Antaa tummemman värin. Vähentaa jokaista kolmea osaväriä arvon howMuch verran.
ButtonState
Napin (minkä tahansa) asento.
static readonly Vector Zero
Nollavektori.
static ScreenView Screen
Näytön dimensiot, eli koko ja reunat.
Peliluokka reaaliaikaisille peleille.
Asettelee widgetit päällekäin, järjestyksessä ylhäältä alas.
void Remove(IGameObject o)
Poistaa olion pelistä. Jos haluat tuhota olion, kutsu mielummin olion Destroy-metodia.
static void AssertInitialized(Action actionMethod)
Suorittaa aliohjelman kun peli on varmasti alustettu.