NewGamePhysics.GraphicalElements.RotationalActionIndicator Class Reference

Rotational action indicator to show frictional forces on an axle or hinge. More...

List of all members.

Public Member Functions

 RotationalActionIndicator (ScreenManager screenManager)
 Default constructor.
void SetPosition (Vector2 position)
 Set the 2D position of the indicator.
void Animate (double intensity)
 Animate rotation display.
void Draw (GameTime gameTime)
 Draws a red circle.

Detailed Description

Rotational action indicator to show frictional forces on an axle or hinge.

Definition at line 19 of file RotationalActionIndicator.cs.


Constructor & Destructor Documentation

NewGamePhysics.GraphicalElements.RotationalActionIndicator.RotationalActionIndicator ( ScreenManager  screenManager  ) 

Default constructor.

Definition at line 59 of file RotationalActionIndicator.cs.

00060         {
00061             this.screenManager = screenManager;
00062             this.actionIndicatorRotation = 0.0f;
00063             this.center = new Vector2();
00064             this.scale = 20.0f;
00065         }


Member Function Documentation

void NewGamePhysics.GraphicalElements.RotationalActionIndicator.Animate ( double  intensity  ) 

Animate rotation display.

Parameters:
intensity The amount of the animation.

Definition at line 80 of file RotationalActionIndicator.cs.

00081         {
00082             if (intensity == 0)
00083             {
00084                 this.visible = false;
00085                 return;
00086             }
00087 
00088             this.visible = true;
00089             this.actionIndicatorRotation += (float)(actionRotationSpeed * intensity);
00090             this.actionIndicatorRotation = MathHelper.WrapAngle(this.actionIndicatorRotation);
00091 
00092             if (intensity < 0.0)
00093             {
00094                 this.drawColor = Color.Red;
00095             }
00096             else
00097             {
00098                 this.drawColor = Color.Green;
00099             }
00100         }

void NewGamePhysics.GraphicalElements.RotationalActionIndicator.Draw ( GameTime  gameTime  ) 

Draws a red circle.

Parameters:
gameTime The game time.

Definition at line 106 of file RotationalActionIndicator.cs.

00107         {
00108             if (visible)
00109             {
00110                 PrimitiveBatch primitiveBatch = screenManager.PrimitiveBatch;
00111 
00112                 const int segments = 16;
00113                 const double angle = MathHelper.TwoPi / segments;
00114 
00115                 double curAngle = this.actionIndicatorRotation;
00116                 primitiveBatch.Begin(PrimitiveType.LineList);
00117                 for (int i = 0; i < segments; i++)
00118                 {
00119                     Vector2 point = this.center + new Vector2(
00120                         this.scale * (float)Math.Round(Math.Sin(curAngle), 4),
00121                         this.scale * (float)Math.Round(Math.Cos(curAngle), 4));
00122                     primitiveBatch.AddVertex(point, this.drawColor);
00123                     curAngle += angle;
00124                 }
00125 
00126                 primitiveBatch.End();
00127             }
00128         }

void NewGamePhysics.GraphicalElements.RotationalActionIndicator.SetPosition ( Vector2  position  ) 

Set the 2D position of the indicator.

Parameters:
position The display position.

Definition at line 71 of file RotationalActionIndicator.cs.

00072         {
00073             this.center = position;
00074         }


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2