|
Clove
A Simple Physics Engine to simulate Hooke's law in a 2D environment
|
#include <Rectangle.h>
Public Member Functions | |
| void | draw () |
| Draw the Object on the screen. | |
| void | updatePosition (float deltaTime) |
| Update the object's position. | |
| std::vector< float > & | getVertices () |
| Return reference to coordinates of object's vertices. | |
| void | setVertices (std::vector< float > newVertices) |
| Set object's vertices coordinates. | |
| std::vector< float > | getOriginalCoordinates () |
| Return coordinates of original object location on initialisation. | |
| void | setOriginalCoordinates (std::vector< float > newOriginalCoordinates) |
| Set original coordinates to be saved should the original vector be changed. | |
| float | getSprintConstant () const |
| Work out the force being applied to the object. | |
| void | setDisplacement (float newX) |
| Set displacement. | |
| void | updateDisplacement (float value, float deltaTime) |
| Update displacement. | |
| bool | getClearSquaresFlag () const |
| Return flag stating whether or not squares have been cleared. | |
| void | setClearSquaresFlag (bool value) |
| Return flag stating whether or not squares have been cleared. | |
| std::vector< Square * > & | getSquaresTouching () |
| Return Reference to squares touching vector. | |
| void | setSquaresTouching (Square *square) |
| Add to Squares Touching Vector. | |
| float | getVelocity () const |
| Return the Velocity of the object. | |
| void | setVelocity (float newVelocity) |
| Set Velocity. | |
| void | updateVelocity (float value, float deltaTime) |
| Update Velocity. | |
| float | getMass () const |
| Return the Mass of the object. | |
| float | getDecay () const |
| Return the oscillation decay of the object. | |
| bool | findSquaresTouching (Square *square) |
| Return true if square is found in 'squaresTouching'. | |
| void | eraseItemInSquaresTouching (Square *square) |
| Erase an item in 'squaresTouching'. | |
| void | clearSquaresTouching () |
| Clear Squares Touching Vector. | |
| Public Member Functions inherited from Drawable | |
| void | draw () |
Additional Inherited Members | |
| Protected Attributes inherited from Drawable | |
| std::vector< float > | vertices |
| Shape Corners. | |
| std::vector< unsigned int > | indices |
| Use to select specific vertices to draw. | |
| unsigned int | numberOfVertices = 0 |
| How many Vertices we wish to draw. | |
| unsigned int | vertexLocation = 0 |
| Vertex attribute index in Shader. | |
| unsigned int | vertexSize = 0 |
| How many dimensions is the vector. | |
| unsigned int | stride = 0 |
| The space between consectuive vertex attributes (In Bytes). | |
| const void * | byteOffset = nullptr |
| Offset in VBO. | |
| VAO | ArrayObject |
| VBO | BufferObject |
| EBO | ElementBufferObject |
Draw a Rectangle.
| void Rectangle::eraseItemInSquaresTouching | ( | Square * | square | ) |
Erase an item in 'squaresTouching'.
| square | Square being operated on |
| bool Rectangle::findSquaresTouching | ( | Square * | square | ) |
Return true if square is found in 'squaresTouching'.
| square | The square being operated on |
|
inline |
Return flag stating whether or not squares have been cleared.
| value | Update the flag on whether or not to clear the square vector |
|
inline |
Set displacement.
| newX | New X value |
|
inline |
Set original coordinates to be saved should the original vector be changed.
| newOriginalCoordinates | Save a set of coordinates (Should be the original coordinates of the object) |
|
inline |
Add to Squares Touching Vector.
| square | Pointer to a specific square |
|
inline |
Set Velocity.
| newVelocity | New velocity value |
|
inline |
Set object's vertices coordinates.
| newVertices | New vertices location |
|
inline |
Update displacement.
| value | Additional displacement value being added to the overall displacement |
| deltaTime | The time between frames |
| void Rectangle::updatePosition | ( | float | deltaTime | ) |
Update the object's position.
| deltaTime | Time between frames |
|
inline |
Update Velocity.
| value | New value to be added to overall object velocity |
| deltaTime | Time between frames |