#include <Disc.h>
| Public Types | |
| enum | DiscType { YELLOW, RED } | 
| Is the Disc yellow or red? | |
| Public Member Functions | |
| Disc (CIwFVec2 position, DiscType discColour) | |
| ~Disc () | |
| void | Draw (double deltaTime) | 
| void | DrawTrajectory (float currentStep, float totalSteps) | 
| void | Launch (CIwFVec2 velocity) | 
| void | Update (double deltaTime) | 
| void | HandleInput () | 
| void | KeepInRange () | 
| void | SetOffset () | 
| void | UpdatePhysics (double deltaTime) | 
| CIwFVec2 | GetDrawPosition () | 
| void | SetDrawPosition (CIwFVec2 position) | 
| void | SetPhysicsObjectPosition (CIwFVec2 position) | 
| void | UpdateGridLogic () | 
| bool | IsActive () | 
| PhysicsObject * | GetPhysicsObject () | 
| void | SetTarget (float y, int column, int row) | 
| std::pair< int, int > | GetGridTarget () | 
| bool | HasTarget () | 
| void | SetHasTarget (bool toggle) | 
| int | GetColour () | 
| bool | HasLanded () | 
| bool | HasClearedGrid () | 
| char * | PositionToString () | 
| CIwFVec2 | StringToPosition (std::string str) | 
| void | SetIsStuck (bool toggle) | 
| bool | GetIsStuck () | 
| Protected Attributes | |
| CIwFVec2 | m_position | 
| Position of the disc. | |
| CIwFVec2 | m_offsetPosition | 
| Offset position of the disc (used for rendering). | |
| CIwFVec2 | m_initialPosition | 
| Starting position of the disc (for plotting trajectories). | |
| CIw2DImage * | m_texture | 
| Texture for the disc. | |
| PhysicsObject * | m_physicsObject | 
| PhysicsObject for the disc. | |
| DiscType | m_discType | 
| Type of disc (yellow or red). | |
| uint32 | m_colour | 
| Colour of the disc (0 = yellow, 1 = red). | |
| float | m_radius | 
| Radius of the disc. | |
| int | m_targetYPos | 
| Y position in the grid where the disc should land. | |
| bool | m_hasTarget | 
| Has this disc been assigned a target in the grid? | |
| bool | m_hasLanded | 
| Has this disc landed? | |
| bool | m_isStuck | 
| Is this disc stuck at the top of a full grid column. | |
| bool | m_hasClearedGrid | 
| Has the disc cleared the top-left corner of the grid. Prevents fast moving discs from tunnelling into first column of grid. | |
| std::pair< int, int > | m_gridPos | 
| Target grid square for this disc. | |
| bool | m_isGrabbed | 
| Has this disc been "grabbed" (touched by the player). | |
| CIwFVec2 | m_prevPosition | 
| Position of the disc at the last update. | |
| float | m_trajectoryAnimator | 
| "Animation" fpr trajectory line. | |
| CIw2DFont * | m_font | 
| Font for writing AI messages to the screen. | |
| float | m_twoPi | 
| Approx. value of two pi for debug drawing. | |
| float | m_trajectoryRadius | 
| Initial radius of the circles which will make up the trajectory line. | |
| float | m_trajectoryInitial | 
| Initial value for trajectory animation. | |
| float | m_trajectorySpeed | 
| "Animation" speed for the trajectory line. | |
| float | m_trajectoryScale | 
| Scale for trajectory lines. | |
| float | m_gridYPos | 
| Y position of the top of the grid. | |
| float | m_gravity | 
| Force of gravity. | |
| Static Protected Attributes | |
| static const int | m_drawRange = 120 | 
| How far back can the disc be pulled (drawn) by the player when firing? | |
| static const int | m_trajectoryDrawSegments = 16 | 
| Number of segments to use for debug drawing of trajectory line. | |
| static const int | m_alphaFadeRate = 3 | 
| Fadeout speed for the trajectory line. | |
| static const int | m_trajectoryMax = 2 | 
| Max animation steps for trajectory animation. | |
| static const int | m_trajectorySteps = 20 | 
| Number of draw steps for trajectory line. | |
| static const int | m_cumulativeOffset = 3 | 
| Cumulative offser for trajectory line. | |
Disc class.
A disc, which can be fired at the grid. Has an associated PhysicsBody by default.
| Disc::Disc | ( | CIwFVec2 | position, | |
| DiscType | discColour | |||
| ) | 
Disc constructor.
Creates a new disc of colour discColour at the specified position.
| [in] | position | Position the disc will be created at. | 
| [in] | discColour | Colour of the disc (yellow or red). | 
| Disc::~Disc | ( | ) | 
Destructor - delete the disc.
Deletes the disc and its PhysicsObject, and releases any memory they were using.
| void Disc::Draw | ( | double | deltaTime | ) | 
Draw the disc.
Draws the disc at the current position of its PhysicsObject.
| [in] | deltaTime | Time since the last update. | 
| void Disc::DrawTrajectory | ( | float | currentStep, | |
| float | totalSteps | |||
| ) | 
Draw the projected path of the disc.
Draws dots representing the path the disc will take when it is launched.
| [in] | currentStep | Current time step for the position calculation. | 
| [in] | totalSteps | Total number of time steps to use for the position calculation. | 
| int Disc::GetColour | ( | ) | 
Get colour of the disc.
Returns the colour of the disc (yellow or red).
| CIwFVec2 Disc::GetDrawPosition | ( | ) | 
Get draw position.
Returns the position the disc is being drawn at (top left corner) rather than its centre.
| std::pair< int, int > Disc::GetGridTarget | ( | ) | 
Get the grid target of a disc.
Returns the target position of this disc in the grid. Used to check if the disc has reached its final destination.
| bool Disc::GetIsStuck | ( | ) | 
Get whether this disc is stuck.
Get whether this disc has become stuck at the top of a full grid column. Stuck discs will be removed at the next update.
| PhysicsObject * Disc::GetPhysicsObject | ( | ) | 
Get the disc's PhysicsObject.
Returns this disc's PhysicsObject. A discs PhysicsObject is only initialised when the disc is activated (when it is fired from the catapult).
| void Disc::HandleInput | ( | ) | 
Handle user input.
Moves the disc as the user drags it.
| bool Disc::HasClearedGrid | ( | ) | 
Has this disc cleared grid.
Has this disc passed the top-left corner of the grid, in which case full collision checks must be performed. Also prevents fast moving discs from tunnelling through the left-hand side of the grid.
| bool Disc::HasLanded | ( | ) | 
Has this disc landed.
Has this disc come to rest in the grid, or is it still flying through the air.
| bool Disc::HasTarget | ( | ) | 
Does the disc have a target?
Has the disc been assigned a target with SetTarget()?.
| bool Disc::IsActive | ( | ) | 
Is the disc active?
Has the disc been activated by the user or is it still sitting idle in the slingshot.
| void Disc::KeepInRange | ( | ) | 
Keep in range.
Keeps the disc close to its spawn point regardless of how far the user drags their finger.
| void Disc::Launch | ( | CIwFVec2 | velocity | ) | 
Launch a disc.
Fires the disc with a given velocity.
| [in] | velocity | The velocity the disc will be given. | 
| char * Disc::PositionToString | ( | ) | 
Convert disc position to characters.
Convert the discs current position to a char array to be sent as a packet for multiplayer.
| void Disc::SetDrawPosition | ( | CIwFVec2 | position | ) | 
Set draw position.
Set the position the disc will be drawn at (top left corner).
| [in] | position | New position. | 
| void Disc::SetHasTarget | ( | bool | toggle | ) | 
Set whether this disc has a target.
Set whether the target grid position of this disc has been assigned.
| [in] | toggle | New value of m_hasTarget. | 
| void Disc::SetIsStuck | ( | bool | toggle | ) | 
Set whether this disc is stuck.
Set whether this disc has become stuck at the top of a full grid column. Stuck discs will be removed at the next update.
| [in] | toggle | New value of m_isStuck. | 
| void Disc::SetOffset | ( | ) | 
Set offset.
Offsets te discs draw position (top left corner) from it's actual position (centre).
| void Disc::SetPhysicsObjectPosition | ( | CIwFVec2 | position | ) | 
Set physicsObject position.
Sets the position of the disc's associated PhysicsObject. Should only be called after the disc is launched/fired.
| [in] | position | New position. | 
| void Disc::SetTarget | ( | float | y, | |
| int | column, | |||
| int | row | |||
| ) | 
Set the grid target of a disc.
The target position of this disc in the grid. Used to check if the disc has reached its final destination.
| [in] | y | Y Position of the target grid tile. | 
| [in] | column | Target column of the grid. | 
| [in] | row | Target row of the grid. | 
| CIwFVec2 Disc::StringToPosition | ( | std::string | str | ) | 
Convert a string to a position.
Convert a received string (in multiplayer) to a disc position.
| [in] | str | The string to be converted. | 
| void Disc::Update | ( | double | deltaTime | ) | 
Update the disc.
Updates the position of the disc and its PhysicsObject depending on user touch inputs. Also handles multiplayer updates.
| [in] | deltaTime | Time since the last update. | 
| void Disc::UpdateGridLogic | ( | ) | 
Update logic.
Update the disc's grid logic (assign's a target, checks if it has landed, etc.)
| void Disc::UpdatePhysics | ( | double | deltaTime | ) | 
Update physics.
Updates the discs physics object.
| [in] | deltaTime | Time since the last update. | 
 1.7.1
 1.7.1