Ejemplo n.º 1
0
		public Game1 ()
		{
			graphics = new GraphicsDeviceManager (this);
			graphics.PreferredBackBufferWidth = 1280;  // set this value to the desired width of your window
			graphics.PreferredBackBufferHeight = 720;   // set this value to the desired height of your window
			graphics.ApplyChanges ();
			Content.RootDirectory = "Content";	            
			//graphics.IsFullScreen = true;
			_inputState = new InputState ();

		}
Ejemplo n.º 2
0
		public RoguelikeGame ()
		{
			graphics = new GraphicsDeviceManager (this);
			graphics.PreferredBackBufferWidth = 1280;  // set this value to the desired width of your window
			graphics.PreferredBackBufferHeight = 720;   // set this value to the desired height of your window
			graphics.ApplyChanges ();
			Content.RootDirectory = "Content";	            
			//graphics.IsFullScreen = true;
			_inputState = new InputState ();
            _testGO = new GameObject();
            //_testGO.AttachComponent(new SpatialComponent(Vector2.One));


            
		}
Ejemplo n.º 3
0
		// Move the camera's position based on input
		public void HandleInput( InputState inputState,
			PlayerIndex? controllingPlayer )
		{
			Vector2 cameraMovement = Vector2.Zero;

			if ( inputState.IsScrollLeft( controllingPlayer ) )
			{
				cameraMovement.X = -1;
			}
			else if ( inputState.IsScrollRight( controllingPlayer ) )
			{
				cameraMovement.X = 1;
			}
			if ( inputState.IsScrollUp( controllingPlayer ) )
			{
				cameraMovement.Y = -1;
			}
			else if ( inputState.IsScrollDown( controllingPlayer ) )
			{
				cameraMovement.Y = 1;
			}
			if ( inputState.IsZoomIn( controllingPlayer ) )
			{
				AdjustZoom( 0.25f );
			}
			else if ( inputState.IsZoomOut( controllingPlayer ) )
			{
				AdjustZoom( -0.25f );
			}

			// When using a controller, to match the thumbstick behavior,
			// we need to normalize non-zero vectors in case the user
			// is pressing a diagonal direction.
			if ( cameraMovement != Vector2.Zero )
			{
				cameraMovement.Normalize();
			}

			// scale our movement to move 25 pixels per second
			cameraMovement *= 25f;

			MoveCamera( cameraMovement, true );
		}