FreeRTOS Tetris
|
API to create balls and walls that interact with each other on a 2D plane. More...
Go to the source code of this file.
Data Structures | |
struct | ball |
Object to represent a ball that bounces off walls. More... | |
struct | wall |
Object to represent a wall that balls bounce off of. More... | |
Macros | |
Set wall location flags | |
Flags passed to setWallProperty to set the X, Y, width or height of a wall. | |
#define | SET_WALL_X 0b1 |
#define | SET_WALL_Y 0b10 |
#define | SET_WALL_WIDTH 0b100 |
#define | SET_WALL_HEIGHT 0b1000 |
#define | SET_WALL_AXES SET_WALL_X | SET_WALL_Y |
#define | SET_WALL_SIZE SET_WALL_WIDTH | SET_WALL_HEIGHT |
#define | SET_WALL_ALL SET_WALL_AXES | SET_WALL_SIZE |
Set ball speed flags | |
Flags passed to setBallSpeed to set various speed properties of a ball | |
#define | SET_BALL_SPEED_X 0b1 |
#define | SET_BALL_SPEED_Y 0b10 |
#define | SET_BALL_SPEED_MAX 0b100 |
#define | SET_BALL_SPEED_AXES SET_BALL_SPEED_X | SET_BALL_SPEED_Y |
#define | SET_BALL_SPEED_ALL SET_BALL_SPEED_AXES | SET_BALL_SPEED_MAX |
Typedefs | |
typedef void(* | callback_t) (void *args) |
Callback function attached to an object. More... | |
typedef struct ball | ball_t |
Object to represent a ball that bounces off walls. More... | |
typedef struct wall | wall_t |
Object to represent a wall that balls bounce off of. More... | |
Functions | |
ball_t * | createBall (signed short initial_x, signed short initial_y, unsigned int colour, signed short radius, float max_speed, callback_t callback, void *args) |
Creates a ball object. More... | |
wall_t * | createWall (signed short x1, signed short y1, signed short w, signed short h, float dampening, unsigned int colour, callback_t callback, void *args) |
Creates a wall object. More... | |
void | setWallProperty (wall_t *wall, signed short x, signed short y, signed short width, signed short height, unsigned char flags) |
Sets one or more properties of a wall. More... | |
void | setBallSpeed (ball_t *ball, float dx, float dy, float max_speed, unsigned char flags) |
Sets the speed of the ball. More... | |
void | setBallLocation (ball_t *ball, signed short x, signed short y) |
Sets the location of the ball. More... | |
signed char | checkBallCollisions (ball_t *ball, callback_t callback, void *args) |
Checks if a ball is currently collided with other objects. More... | |
void | updateBallPosition (ball_t *ball, unsigned int milli_seconds) |
Updates the position of the ball. More... | |
API to create balls and walls that interact with each other on a 2D plane.
---------------------------------------------------------------------- Copyright (C) Alexander Hoffman, 2019 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ----------------------------------------------------------------------