Rotational action indicator to show frictional forces on an axle or hinge. More...
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. | |
Rotational action indicator to show frictional forces on an axle or hinge.
Definition at line 19 of file RotationalActionIndicator.cs.
| NewGamePhysics.GraphicalElements.RotationalActionIndicator.RotationalActionIndicator | ( | ScreenManager | screenManager | ) |
Default constructor.
Definition at line 59 of file RotationalActionIndicator.cs.
| void NewGamePhysics.GraphicalElements.RotationalActionIndicator.Animate | ( | double | intensity | ) |
Animate rotation display.
| 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.
| 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.
| position | The display position. |
Definition at line 71 of file RotationalActionIndicator.cs.
1.6.2