Clove
A Simple Physics Engine to simulate Hooke's law in a 2D environment
Loading...
Searching...
No Matches
Rectangle Class Reference

Draw a Rectangle. More...

#include <Rectangle.h>

Inheritance diagram for Rectangle:
Drawable

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

Detailed Description

Draw a Rectangle.

Member Function Documentation

◆ eraseItemInSquaresTouching()

void Rectangle::eraseItemInSquaresTouching ( Square * square)

Erase an item in 'squaresTouching'.

Parameters
squareSquare being operated on

◆ findSquaresTouching()

bool Rectangle::findSquaresTouching ( Square * square)

Return true if square is found in 'squaresTouching'.

Parameters
squareThe square being operated on

◆ setClearSquaresFlag()

void Rectangle::setClearSquaresFlag ( bool value)
inline

Return flag stating whether or not squares have been cleared.

Parameters
valueUpdate the flag on whether or not to clear the square vector

◆ setDisplacement()

void Rectangle::setDisplacement ( float newX)
inline

Set displacement.

Parameters
newXNew X value

◆ setOriginalCoordinates()

void Rectangle::setOriginalCoordinates ( std::vector< float > newOriginalCoordinates)
inline

Set original coordinates to be saved should the original vector be changed.

Parameters
newOriginalCoordinatesSave a set of coordinates (Should be the original coordinates of the object)

◆ setSquaresTouching()

void Rectangle::setSquaresTouching ( Square * square)
inline

Add to Squares Touching Vector.

Parameters
squarePointer to a specific square

◆ setVelocity()

void Rectangle::setVelocity ( float newVelocity)
inline

Set Velocity.

Parameters
newVelocityNew velocity value

◆ setVertices()

void Rectangle::setVertices ( std::vector< float > newVertices)
inline

Set object's vertices coordinates.

Parameters
newVerticesNew vertices location

◆ updateDisplacement()

void Rectangle::updateDisplacement ( float value,
float deltaTime )
inline

Update displacement.

Parameters
valueAdditional displacement value being added to the overall displacement
deltaTimeThe time between frames

◆ updatePosition()

void Rectangle::updatePosition ( float deltaTime)

Update the object's position.

Parameters
deltaTimeTime between frames

◆ updateVelocity()

void Rectangle::updateVelocity ( float value,
float deltaTime )
inline

Update Velocity.

Parameters
valueNew value to be added to overall object velocity
deltaTimeTime between frames

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