Example #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;
        }
Example #2
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;
 }
Example #3
0
 void drawCurrentItemBeingCreatedIfNeeded(UserActionInEditor userActionInEditor, EntityCreation entityCreation)
 {
     if (userActionInEditor == UserActionInEditor.AddingAnItem && entityCreation.StartedCreating)
     {
         entityCreation.CurrentEditor.DrawInEditor(_game.SpriteBatch);
     }
 }
Example #4
0
 void drawCurrentItemBeingCreatedIfNeeded( UserActionInEditor userActionInEditor, EntityCreation entityCreation )
 {
     if( userActionInEditor == UserActionInEditor.AddingAnItem && entityCreation.StartedCreating )
     {
         entityCreation.CurrentEditor.DrawInEditor( _game.SpriteBatch ) ;
     }
 }
 public void WhenEnteringEditor( ICanvas canvas, DraggingContext context)
 {
     _temporaryEntityOnCanvas = canvas.StartCreatingEntityNow(_entityCreationProperties);
 }
Example #6
0
        public Canvas( IMainForm mainForm, IModel model )
        {
            _inputHandlerForWhenEditorIdle = new InputHandlerForWhenEditorIdle( this );
            _inputHandlerForWhenMovingOrCopyingItems = new InputHandlerForWhenMovingOrCopyingItems( this );
            _inputHandlerWhenRotatingItems = new InputHandlerWhenRotatingItems( this );
            _inputHandlerWhenScalingItems = new InputHandlerWhenScalingItems( this );
            _inputHandlerWhenCreatingTheSelectionRectangle = new InputHandlerWhenCreatingTheSelectionRectangle( this );

            _mainForm = mainForm ;

            _model = model ;

            _model.NewModelLoaded += newModelLoaded ;

            _entityCreation = new EntityCreation( whenEntityReadyToBeAdded: ( ) =>
                    {
                        addTheEntityCurrentlyBeingCreated( ) ;
                        _entityCreation.ClearCurrentEditor( ) ;
                        _entityCreation.StartedCreating = false ;
                    } ) ;

            _inputActionLookup = new Dictionary<UserActionInEditor, Action>
                {
                    {
                        UserActionInEditor.Idle, _inputHandlerForWhenEditorIdle.Update
                        },
                    {
                        UserActionInEditor.MovingItems, _inputHandlerForWhenMovingOrCopyingItems.Update
                        },
                    {
                        UserActionInEditor.CopyingItems, _inputHandlerForWhenMovingOrCopyingItems.Update
                        },
                    {
                        UserActionInEditor.RotatingItems, _inputHandlerWhenRotatingItems.Update
                        },
                    {
                        UserActionInEditor.ScalingItems, _inputHandlerWhenScalingItems.Update
                        },
                    {
                        UserActionInEditor.MovingTheCamera, handleUpdateWhenMovingTheCamera
                        },
                    {
                        UserActionInEditor.CreatingSelectionBoxByDragging, _inputHandlerWhenCreatingTheSelectionRectangle.Update
                        },
                    {
                        UserActionInEditor.AddingAnItem, handleInputWhenAddingAnEntity
                        },
                } ;

            _userActionInEditor = UserActionInEditor.Idle ;

            _positionsBeforeUserInteraction = new List<Vector2>( ) ;

            _rotationsBeforeUserInteraction = new List<float>( ) ;

            _scalesBeforeUserInteraction = new List<Vector2>( ) ;

            Stream stream = safeGetManifestResourceStream( @"GLEED2D.Resources.cursors.dragcopy.cur" ) ;

            new Cursor( stream ) ;

            stream = safeGetManifestResourceStream( @"GLEED2D.Resources.cursors.rotate.cur" ) ;
            _cursorRotate = new Cursor( stream ) ;

            stream = safeGetManifestResourceStream( @"GLEED2D.Resources.cursors.scale.cur" ) ;
            _cursorScale = new Cursor( stream ) ;

            Constants.TryToLoadOtherwiseSetDefaults( @"settings.xml" ) ;
        }
 public void WhenEnteringEditor(ICanvas canvas, DraggingContext context)
 {
     _temporaryEntityOnCanvas = canvas.StartCreatingEntityNow(_entityCreationProperties);
 }