Show
Ignore:
Timestamp:
07/03/08 18:39:10 (5 months ago)
Author:
phill
Message:

o Added camera-follows-tag feature.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/x42view.net/Gui/Camera.cs

    r402 r594  
    8383                        get 
    8484                        { 
    85                                 Size sz = WorkingSize; 
    86                                 float aspect = (float)sz.Width / (float)sz.Height; 
    87  
    8885                                return Matrix.PerspectiveFovRH( currState.Fov * DegToRad, 
    89                                         aspect, zNear, zFar ); 
     86                                        AspectRatio, zNear, zFar ); 
    9087 
    9188                        } 
     
    129126                                zFar = value; 
    130127                                OnMatrixChanged( EventArgs.Empty ); 
     128                        } 
     129                } 
     130 
     131                private bool enabled = true; 
     132                [DefaultValue( true )] 
     133                public bool Enabled 
     134                { 
     135                        get { return enabled; } 
     136                        set 
     137                        { 
     138                                if( !value ) 
     139                                        DragEnd( false ); 
     140 
     141                                enabled = value; 
    131142                        } 
    132143                } 
     
    277288                        } 
    278289                } 
     290 
     291                public float AspectRatio 
     292                { 
     293                        get 
     294                        { 
     295                                Size sz = WorkingSize; 
     296                                return (float)sz.Width / (float)sz.Height; 
     297                        } 
     298                } 
     299 
    279300                #endregion 
    280301 
     
    405426                public void DragEnd( bool commit ) 
    406427                { 
     428                        if( mode == CameraMode.None ) 
     429                                return; 
     430 
    407431                        if( !commit ) 
    408432                        { 
     
    475499                private void control_MouseWheel( object sender, MouseEventArgs e ) 
    476500                { 
     501                        if( !enabled ) 
     502                                return; 
     503 
    477504                        Range -= e.Delta * zoomSpeed * 0.0001F; 
    478505                } 
     
    487514                private void control_MouseMove( object sender, MouseEventArgs e ) 
    488515                { 
     516                        if( !enabled ) 
     517                                return; 
     518 
    489519                        DragMove( e.Location ); 
    490520                } 
     
    492522                private void control_MouseDown( object sender, MouseEventArgs e ) 
    493523                { 
     524                        if( !enabled ) 
     525                                return; 
     526 
    494527                        if( mode != CameraMode.None ) 
    495528                                //don't interrupt one type of interaction for another 
     
    531564                void control_KeyDown( object sender, KeyEventArgs e ) 
    532565                { 
     566                        if( !enabled ) 
     567                                return; 
     568 
    533569                        if( e.KeyCode == Keys.Escape && mode != CameraMode.None ) 
    534570                        {