Exemplo n.º 1
0
 public Camera( Viewport parent, float width, float height, float zoom, float rotation )
 {
     this._viewport = parent;
     this._visibleArea = new RectangleF( 0, 0, width, height );
     this._zoom = zoom;
     this._position = ScreenPosition;
     this._rotation = rotation;
 }
 public void SetProperties( RectangleF rect )
 {
     SetProperties( rect.X, rect.Y, rect.Width, rect.Height );
 }
Exemplo n.º 3
0
        public ActorEd( ActorTypeEd parent )
        {
            _parent = parent;
            _name = "Actor";
            _visible = true;
            _bounds = new RectangleF( 0f, 0f, 1f, 1f );

            _properties.Actor = this;

            parent.SpriteChanged += new EventHandler( parent_SpriteChanged );
            parent.RotationChanged += new EventHandler( parent_RotationChanged );
            parent.ScaleChanged += new EventHandler( parent_ScaleChanged );

            parent.IsTextActorChanged += new EventHandler( parent_IsTextActorChanged );
            parent.TextChanged += new EventHandler( parent_TextChanged );
            parent.TextColorChanged += new EventHandler( parent_TextColorChanged );
        }
Exemplo n.º 4
0
 public void UpdateBounds( )
 {
     Vector2 pos;
     if( !IsTextActor )
     {
         pos = WorldOrigin;
         _bounds = new RectangleF( pos.X, pos.Y, Sprite.Width * _scale, Sprite.Height * _scale );
     }
     else
     {
         if( !string.IsNullOrEmpty( Text ) )
         {
             Vector2 textSize = Font.MeasureString( Text );
             _origin = new Vector2( textSize.X * 0.5f, textSize.Y * 0.5f );
             pos = WorldOrigin;
             _bounds = new RectangleF( pos.X, pos.Y, textSize.X * _scale, textSize.Y * _scale );
         }
     }
 }
Exemplo n.º 5
0
 public static bool IsCollision( RectangleF r2, RectangleF r1 )
 {
     return (r1.X + r1.Width >= r2.X && r1.Y + r1.Height >= r2.Y && r1.X <= r2.X + r2.Width && r1.Y <= r2.Y + r2.Height);
 }
Exemplo n.º 6
0
        public RectangleF Union( RectangleF rect1, RectangleF rect2 )
        {
            RectangleF tempRect = new RectangleF( );

            if( rect1.x < rect2.x )
                tempRect.x = rect1.x;
            else
                tempRect.x = rect2.x;

            if( rect1.right > rect2.right )
                tempRect.right = rect1.right;
            else
                tempRect.right = rect2.right;

            tempRect.width = tempRect.right - tempRect.x;

            if( rect1.y < rect2.y )
                tempRect.y = rect1.y;
            else
                tempRect.y = rect2.y;

            if( rect1.bottom > rect2.bottom )
                tempRect.bottom = rect1.bottom;
            else
                tempRect.bottom = rect2.bottom;

            tempRect.height = tempRect.bottom - tempRect.y;
            return tempRect;
        }
Exemplo n.º 7
0
 /// <summary>
 /// Verifies if this zone contains a given rectangleF
 /// </summary>
 /// <param name="rectangle"></param>
 /// <returns></returns>
 public virtual bool Contains( RectangleF rectangle )
 {
     return Contains( (int)rectangle.X, (int)rectangle.Y ) && Contains( (int)rectangle.Width, (int)rectangle.Height );
 }
Exemplo n.º 8
0
 public virtual bool Intersects( RectangleF rectangle )
 {
     return Contains( (int)rectangle.X, (int)rectangle.Y ) || Contains( (int)rectangle.Width, (int)rectangle.Height );
 }
 public static void SetProperties( RectangleF rect )
 {
     SetProperties( (int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height );
 }