public Windowing( Game g ) { game = g as SPW ; this.input = new InputEvents( game ); game.Components.Add( this.input ); this.gui = new GUIManager( game ); game.Components.Add( this.gui ); this.gui.Initialize(); }
private List<PlayerIndex> pis; // connected controllers. #endregion Fields #region Constructors // call base class ctor /// <summary> /// Constructor /// </summary> public Controller( Game g ) : base(g) { // save reference to the main game itself game = this.Game as SPW; netConn = new NetworkListener(); //find number of controllers attached. int nConn = 0; Array players = Enum.GetValues( typeof( PlayerIndex ) ); pis = new List<PlayerIndex>(); gpPrevStates = new Dictionary<PlayerIndex, GamePadState>(); gpCurrStates = new Dictionary<PlayerIndex, GamePadState>(); // Prepare to track states // for player controllers // that are connected. foreach( PlayerIndex pi in players ) { if( GamePad.GetState( pi ).IsConnected ) { nConn++; pis.Add( pi ); gpPrevStates.Add( pi, new GamePadState() ); gpCurrStates.Add( pi, new GamePadState() ); } } }
// Application starting point. static void Main( string[] args ) { // Create an instance of the SPW class SPW game = new SPW(); // Launch the game. game.Run(); }