Go to the documentation of this file.
25 #ifndef __TUM_BALL_H__
26 #define __TUM_BALL_H__
152 unsigned int colour,
signed short radius,
float max_speed,
170 signed short h,
float dampening,
unsigned int colour,
182 #define SET_WALL_X 0b1
184 #define SET_WALL_Y 0b10
186 #define SET_WALL_WIDTH 0b100
188 #define SET_WALL_HEIGHT 0b1000
190 #define SET_WALL_AXES SET_WALL_X | SET_WALL_Y
192 #define SET_WALL_SIZE SET_WALL_WIDTH | SET_WALL_HEIGHT
194 #define SET_WALL_ALL SET_WALL_AXES | SET_WALL_SIZE
211 signed short width,
signed short height,
212 unsigned char flags);
226 #define SET_BALL_SPEED_X 0b1
233 #define SET_BALL_SPEED_Y 0b10
240 #define SET_BALL_SPEED_MAX 0b100
247 #define SET_BALL_SPEED_AXES SET_BALL_SPEED_X | SET_BALL_SPEED_Y
255 #define SET_BALL_SPEED_ALL SET_BALL_SPEED_AXES | SET_BALL_SPEED_MAX
271 unsigned char flags);
struct wall wall_t
Object to represent a wall that balls bounce off of.
signed short y1
Definition: TUM_Ball.h:115
void(* callback_t)(void *args)
Callback function attached to an object.
Definition: TUM_Ball.h:46
float dy
Definition: TUM_Ball.h:76
signed short x
Definition: TUM_Ball.h:69
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.
Definition: TUM_Ball.c:53
callback_t callback
Definition: TUM_Ball.h:85
signed short x1
Definition: TUM_Ball.h:114
void setBallSpeed(ball_t *ball, float dx, float dy, float max_speed, unsigned char flags)
Sets the speed of the ball.
Definition: TUM_Ball.c:99
signed short y
Definition: TUM_Ball.h:70
struct ball ball_t
Object to represent a ball that bounces off walls.
float f_y
Definition: TUM_Ball.h:73
signed char checkBallCollisions(ball_t *ball, callback_t callback, void *args)
Checks if a ball is currently collided with other objects.
float f_x
Definition: TUM_Ball.h:72
Object to represent a wall that balls bounce off of.
Definition: TUM_Ball.h:113
float dx
Definition: TUM_Ball.h:75
unsigned int colour
Definition: TUM_Ball.h:81
float max_speed
Definition: TUM_Ball.h:78
float dampening
Definition: TUM_Ball.h:123
void * args
Definition: TUM_Ball.h:86
void setBallLocation(ball_t *ball, signed short x, signed short y)
Sets the location of the ball.
Definition: TUM_Ball.c:119
callback_t callback
Definition: TUM_Ball.h:128
void * args
Definition: TUM_Ball.h:129
Object to represent a ball that bounces off walls.
Definition: TUM_Ball.h:68
signed short w
Definition: TUM_Ball.h:117
signed short h
Definition: TUM_Ball.h:118
signed short radius
Definition: TUM_Ball.h:83
void updateBallPosition(ball_t *ball, unsigned int milli_seconds)
Updates the position of the ball.
Definition: TUM_Ball.c:142
unsigned int colour
Definition: TUM_Ball.h:126
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.
signed short y2
Definition: TUM_Ball.h:121
signed short x2
Definition: TUM_Ball.h:120
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.