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.
|
API to create balls and walls that interact with each other on a 2D plane. More...
#include "gfx_draw.h"
Go to the source code of this file.
Classes | |
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 gfxSetWallProperty 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 gfxSetBallSpeed 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 * | gfxCreateBall (signed short initial_x, signed short initial_y, unsigned int colour, signed short radius, float max_speed, callback_t callback, void *args, gfx_image_handle_t sprite) |
Creates a ball object. More... | |
wall_t * | gfxCreateWall (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 | gfxSetWallProperty (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 | gfxSetBallSpeed (ball_t *ball, float dx, float dy, float max_speed, unsigned char flags) |
Sets the speed of the ball. More... | |
void | gfxSetBallLocation (ball_t *ball, signed short x, signed short y) |
Sets the location of the ball. More... | |
signed char | gfxCheckBallCollisions (ball_t *ball, callback_t callback, void *args) |
Checks if a ball is currently collided with other objects. More... | |
void | gfxUpdateBallPosition (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/>. ----------------------------------------------------------------------