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 <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "gfx_ball.h"
#include "gfx_sound.h"
Classes | |
struct | walls |
Macros | |
#define | SET_BALL_COORD(AXIS, VAL) |
#define | HORIZONTAL 0b1 |
#define | VERTICAL 0b10 |
#define | COLLIDE_WALL 1 |
#define | COLLIDE_BALL 2 |
#define | COLLIDE_WALL_TOP 1 |
#define | COLLIDE_WALL_BOTTOM 2 |
#define | COLLIDE_WALL_LEFT 3 |
#define | COLLIDE_WALL_RIGHT 4 |
#define | BALL_LEFT_POINT_X ball->f_x - ball->radius |
#define | BALL_LEFT_POINT_Y ball->f_y |
#define | BALL_RIGHT_POINT_X ball->f_x + ball->radius |
#define | BALL_RIGHT_POINT_Y ball->f_y |
#define | BALL_TOP_POINT_X ball->f_x |
#define | BALL_TOP_POINT_Y ball->f_y - ball->radius |
#define | BALL_BOTTOM_POINT_X ball->f_x |
#define | BALL_BOTTOM_POINT_Y ball->f_y + ball->radius |
#define | WALL ((wall_t *)object) |
#define | BALL ((ball_t *)object) |
Typedefs | |
typedef struct walls | walls_t |
Functions | |
wall_t * | gfxCreateWall (signed short x1, signed short y1, signed short w, signed short h, float dampening, unsigned int colour, void(*callback)(void *), void *args) |
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... | |
ball_t * | gfxCreateBall (signed short initial_x, signed short initial_y, unsigned int colour, signed short radius, float max_speed, void(*callback)(void *), void *args, gfx_image_handle_t sprite) |
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... | |
void | gfxUpdateBallPosition (ball_t *ball, unsigned int milli_seconds) |
Updates the position of the ball. More... | |
void | _changeBallDirection (ball_t *ball, signed char direction, float dampening) |
signed char | _collideWall (ball_t *ball, wall_t *wall, unsigned char collision_type, void(*callback)(void *), void *args) |
signed char | _handleCollision (ball_t *ball, void *object, unsigned char flag, void(*callback)(void *), void *args) |
signed char | _checkBallCollisionsWithWalls (ball_t *ball, void(*callback)(void *), void *args) |
unsigned char | _checkBallCollisionsWithBalls (ball_t *ball) |
signed char | gfxCheckBallCollisions (ball_t *ball, void(*callback)(void *), void *args) |
Variables | |
walls_t | walls = { 0 } |
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/>. ----------------------------------------------------------------------
#define BALL ((ball_t *)object) |
#define BALL_BOTTOM_POINT_X ball->f_x |
#define BALL_LEFT_POINT_Y ball->f_y |
#define BALL_RIGHT_POINT_Y ball->f_y |
#define BALL_TOP_POINT_X ball->f_x |
#define COLLIDE_BALL 2 |
#define COLLIDE_WALL 1 |
#define COLLIDE_WALL_BOTTOM 2 |
#define COLLIDE_WALL_LEFT 3 |
#define COLLIDE_WALL_RIGHT 4 |
#define COLLIDE_WALL_TOP 1 |
#define HORIZONTAL 0b1 |
#define SET_BALL_COORD | ( | AXIS, | |
VAL | |||
) |
#define VERTICAL 0b10 |
#define WALL ((wall_t *)object) |
void _changeBallDirection | ( | ball_t * | ball, |
signed char | direction, | ||
float | dampening | ||
) |
unsigned char _checkBallCollisionsWithBalls | ( | ball_t * | ball | ) |
signed char _checkBallCollisionsWithWalls | ( | ball_t * | ball, |
void(*)(void *) | callback, | ||
void * | args | ||
) |
signed char _collideWall | ( | ball_t * | ball, |
wall_t * | wall, | ||
unsigned char | collision_type, | ||
void(*)(void *) | callback, | ||
void * | args | ||
) |
signed char _handleCollision | ( | ball_t * | ball, |
void * | object, | ||
unsigned char | flag, | ||
void(*)(void *) | callback, | ||
void * | args | ||
) |
signed char gfxCheckBallCollisions | ( | ball_t * | ball, |
void(*)(void *) | callback, | ||
void * | args | ||
) |
ball_t* gfxCreateBall | ( | signed short | initial_x, |
signed short | initial_y, | ||
unsigned int | colour, | ||
signed short | radius, | ||
float | max_speed, | ||
void(*)(void *) | callback, | ||
void * | args, | ||
gfx_image_handle_t | sprite | ||
) |
wall_t* gfxCreateWall | ( | signed short | x1, |
signed short | y1, | ||
signed short | w, | ||
signed short | h, | ||
float | dampening, | ||
unsigned int | colour, | ||
void(*)(void *) | callback, | ||
void * | args | ||
) |