示例#1
0
 protected override void Initialize()
 {
     _spriteBatch    = new SpriteBatch(GraphicsDevice);
     _checkerTexture = Texture2D.FromStream(GraphicsDevice, System.IO.File.OpenRead(Application.StartupPath + "\\Resources\\checker.png"));
     _crossTexture   = Texture2D.FromStream(GraphicsDevice, System.IO.File.OpenRead(Application.StartupPath + "\\Resources\\cross.png"));
     _zoom           = 1;
     _alphaCounter   = 0;
     _alphaGoingUp   = true;
     _selectionMode  = SpriteEditorSelectionMode.Normal;
     this.AutoScroll = true;
 }
 protected override void Initialize()
 {
     _spriteBatch    = new SpriteBatch(GraphicsDevice);
     _checkerTexture = Texture2D.FromFile(GraphicsDevice, Application.StartupPath + "\\Resources\\checker.png");
     _crossTexture   = Texture2D.FromFile(GraphicsDevice, Application.StartupPath + "\\Resources\\cross.png");
     _zoom           = 1;
     _alphaCounter   = 0;
     _alphaGoingUp   = true;
     _selectionMode  = SpriteEditorSelectionMode.Normal;
     this.AutoScroll = true;
     // Hook the idle event to constantly redraw our animation.
     Application.Idle += delegate { Invalidate(); };
 }
 public void MouseClicked(Point mousePos)
 {
     if (_selectionMode == SpriteEditorSelectionMode.SelectingTile)
     {
         Vector2 translatedPos = ParentEditor.ZoomBox.Camera
                                 .ConvertToWorldPos(new Vector2(mousePos.X, mousePos.Y));
         if (SquidMath.IsPointInsideRectangle(new Point((int)translatedPos.X, (int)translatedPos.Y)
                                              , _spriteRectangles[_selectedRectangle]))
         {
             _selectionMode = SpriteEditorSelectionMode.Tiled;
             Rectangle spriteRect = _spriteRectangles[_selectedRectangle];
             Sprite.MaterialArea = _selectedRectangle;
             this.ParentEditor.RefreshAreaCombo();
         }
     }
 }
 protected override void Initialize()
 {            
     _spriteBatch = new SpriteBatch(GraphicsDevice);                       
     _checkerTexture = Texture2D.FromFile(GraphicsDevice, Application.StartupPath + "\\Resources\\checker.png");
     _crossTexture = Texture2D.FromFile(GraphicsDevice, Application.StartupPath + "\\Resources\\cross.png");
     _zoom = 1;
     _alphaCounter = 0;
     _alphaGoingUp = true;
     _selectionMode = SpriteEditorSelectionMode.Normal;
     this.AutoScroll = true;
     // Hook the idle event to constantly redraw our animation.
     Application.Idle += delegate { Invalidate(); };
 }
 public void MouseClicked(Point mousePos)
 {
     if (_selectionMode == SpriteEditorSelectionMode.SelectingTile)
     {
         Vector2 translatedPos = ParentEditor.ZoomBox.Camera
             .ConvertToWorldPos(new Vector2(mousePos.X, mousePos.Y));
         if (IceMath.IsPointInsideRectangle(new Point((int)translatedPos.X, (int)translatedPos.Y)
             , _spriteRectangles[_selectedRectangle]))
         {
             _selectionMode = SpriteEditorSelectionMode.Tiled;
             Rectangle spriteRect = _spriteRectangles[_selectedRectangle];
             Sprite.MaterialArea = _selectedRectangle;
             this.ParentEditor.RefreshAreaCombo();
         }
     }
 }
 protected override void Initialize()
 {            
     _spriteBatch = new SpriteBatch(GraphicsDevice);                       
     _checkerTexture = Texture2D.FromStream(GraphicsDevice, System.IO.File.OpenRead(Application.StartupPath + "\\Resources\\checker.png"));
     _crossTexture = Texture2D.FromStream(GraphicsDevice, System.IO.File.OpenRead(Application.StartupPath + "\\Resources\\cross.png"));
     _zoom = 1;
     _alphaCounter = 0;
     _alphaGoingUp = true;
     _selectionMode = SpriteEditorSelectionMode.Normal;
     this.AutoScroll = true;
 }