| 
    FreeRTOS Emulator with SDL2 Based Graphics and Input Library
    1.0
    
   A POSIX wrapper to run FreeRTOS on an x86 machine with some basic input and output libraries aimed at making teaching FreeRTOS simpler. 
   | 
 
Object to represent a wall that balls bounce off of. More...
#include <gfx_ball.h>
Public Attributes | |
| signed short | x1 | 
| signed short | y1 | 
| signed short | w | 
| signed short | h | 
| signed short | x2 | 
| signed short | y2 | 
| float | dampening | 
| unsigned int | colour | 
| callback_t | callback | 
| void * | args | 
Object to represent a wall that balls bounce off of.
A wall object is created by passing the top left X and Y locations (in pixels) and the width and height of the desired wall. The wall also stores a colour that can be used to render it, allowing for the information to be stored in the object. A wall interacts with balls automatically as all walls generated are stored in a list that is iterated though by the function gfxCheckBallCollisions.
When a wall is collided with it causes a ball to loose or gain speed, the dampening is a normalized percentage value that is used to either increase or decrease the balls velocity. A dampening of -0.4 represents a 40% decrease in speed, similarly 0.4 represents a 40% increase in speed.
Please be aware that the position of a ball can be tested slower than a ball can move when the ball is moving extremely quickly, this can cause the balls to jump over objects, this is due to the extremely simple collision detection implemented.
A walls callback is a function pointer taking a function of the format void (*callback)(void *). If the function is set the that function is called when the wall is collided with. This allows for actions to be performed when a specific wall is collided with.
| void* wall::args | 
Collision callback args
| callback_t wall::callback | 
Collision callback
| unsigned int wall::colour | 
Hex RGB colour of the ball
| float wall::dampening | 
Value by which a balls speed is changed, eg. 0.2 represents a 20% increase in speed
| signed short wall::h | 
Height of wall (Y axis)
| signed short wall::w | 
Width of wall (X axis)
| signed short wall::x1 | 
Top left corner X coord of wall
| signed short wall::x2 | 
Bottom right corner X coord of wall
| signed short wall::y1 | 
Top left corner Y coord of wall
| signed short wall::y2 | 
Bottom right corner Y coord of wall