예제 #1
0
        public RendererParams( Camera camera, 
			UserActionInEditor userActionInEditor, 
			Rectangle selectionRectangle, 
			EntityCreation entityCreation, 
			SnapPoint snapPoint )
        {
            Camera = camera ;
            UserActionInEditor = userActionInEditor ;
            SelectionRectangle = selectionRectangle ;
            EntityCreation = entityCreation ;
            SnapPoint = snapPoint ;
            ItemsToRender=ItemsToRender.Everything;
        }
예제 #2
0
        void drawWorldOrigin( Camera camera )
        {
            _game.SpriteBatch.Begin( ) ;

            Vector2 worldOrigin = Vector2.Transform( Vector2.Zero, camera.Matrix ) ;

            _drawing.DrawLine(
                _game.SpriteBatch,
                worldOrigin + new Vector2( -20, 0 ),
                worldOrigin + new Vector2( +20, 0 ),
                Constants.Instance.WorldOriginColor,
                Constants.Instance.WorldOriginLineThickness ) ;

            _drawing.DrawLine(
                _game.SpriteBatch,
                worldOrigin + new Vector2( 0, -20 ),
                worldOrigin + new Vector2( 0, 20 ),
                Constants.Instance.WorldOriginColor,
                Constants.Instance.WorldOriginLineThickness ) ;

            _game.SpriteBatch.End( ) ;
        }
예제 #3
0
        void drawGrid( Camera camera )
        {
            _game.SpriteBatch.Begin( ) ;

            int max = Constants.Instance.GridNumberOfGridLines / 2 ;

            Color gridColor = Constants.Instance.GridColor ;

            int thickness = Constants.Instance.GridLineThickness ;

            for( int x = 0; x <= max; x++ )
            {
                float gridSpacingX = Constants.Instance.GridSpacing.X ;
                Vector2 start = Vector2.Transform( new Vector2( x, -max ) * gridSpacingX, camera.Matrix ) ;
                Vector2 end = Vector2.Transform( new Vector2( x, max ) * gridSpacingX, camera.Matrix ) ;
                _drawing.DrawLine( _game.SpriteBatch, start, end, gridColor, thickness ) ;
                start = Vector2.Transform( new Vector2( -x, -max ) * gridSpacingX, camera.Matrix ) ;
                end = Vector2.Transform( new Vector2( -x, max ) * gridSpacingX, camera.Matrix ) ;
                _drawing.DrawLine( _game.SpriteBatch, start, end, gridColor, thickness ) ;
            }

            for( int y = 0; y <= max; y++ )
            {
                float gridSpacingY = Constants.Instance.GridSpacing.Y ;

                Vector2 start = Vector2.Transform( new Vector2( -max, y ) * gridSpacingY, camera.Matrix ) ;
                Vector2 end = Vector2.Transform( new Vector2( max, y ) * gridSpacingY, camera.Matrix ) ;
                _drawing.DrawLine( _game.SpriteBatch, start, end, gridColor, thickness ) ;
                start = Vector2.Transform( new Vector2( -max, -y ) * gridSpacingY, camera.Matrix ) ;
                end = Vector2.Transform( new Vector2( max, -y ) * gridSpacingY, camera.Matrix ) ;
                _drawing.DrawLine( _game.SpriteBatch, start, end, gridColor, thickness ) ;
            }

            _game.SpriteBatch.End( ) ;
        }
예제 #4
0
        public static void Update( MouseState mouseState, Camera camera )
        {
            _oldState = _currentState ;
            _currentState = mouseState ;

            adjustWorldPosition( camera ) ;
        }
예제 #5
0
 static void adjustWorldPosition( Camera camera )
 {
     _mouseWorldPos = Vector2.Transform( ScreenPosition, Matrix.Invert( camera.Matrix ) ) ;
     _mouseWorldPos = _mouseWorldPos.Round( ) ;
 }
예제 #6
0
 public static void UpdateCamera( Camera camera )
 {
     adjustWorldPosition( camera );
 }