25 #ifndef __GFX_BALL_H__
26 #define __GFX_BALL_H__
153 unsigned int colour,
signed short radius,
float max_speed,
171 signed short h,
float dampening,
unsigned int colour,
183 #define SET_WALL_X 0b1
185 #define SET_WALL_Y 0b10
187 #define SET_WALL_WIDTH 0b100
189 #define SET_WALL_HEIGHT 0b1000
191 #define SET_WALL_AXES SET_WALL_X | SET_WALL_Y
193 #define SET_WALL_SIZE SET_WALL_WIDTH | SET_WALL_HEIGHT
195 #define SET_WALL_ALL SET_WALL_AXES | SET_WALL_SIZE
212 signed short width,
signed short height,
213 unsigned char flags);
227 #define SET_BALL_SPEED_X 0b1
234 #define SET_BALL_SPEED_Y 0b10
241 #define SET_BALL_SPEED_MAX 0b100
248 #define SET_BALL_SPEED_AXES SET_BALL_SPEED_X | SET_BALL_SPEED_Y
256 #define SET_BALL_SPEED_ALL SET_BALL_SPEED_AXES | SET_BALL_SPEED_MAX
271 unsigned char flags);
void gfxSetBallLocation(ball_t *ball, signed short x, signed short y)
Sets the location of the ball.
Definition: gfx_ball.c:143
void gfxSetBallSpeed(ball_t *ball, float dx, float dy, float max_speed, unsigned char flags)
Sets the speed of the ball.
Definition: gfx_ball.c:123
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.
Definition: gfx_ball.c:76
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.
void(* callback_t)(void *args)
Callback function attached to an object.
Definition: gfx_ball.h:44
struct wall wall_t
Object to represent a wall that balls bounce off of.
void gfxUpdateBallPosition(ball_t *ball, unsigned int milli_seconds)
Updates the position of the ball.
Definition: gfx_ball.c:166
struct ball ball_t
Object to represent a ball that bounces off walls.
signed char gfxCheckBallCollisions(ball_t *ball, callback_t callback, void *args)
Checks if a ball is currently collided with other objects.
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.
void * gfx_image_handle_t
Handle used to reference loaded images, an invalid image will have a NULL handle.
Definition: gfx_draw.h:130
Object to represent a ball that bounces off walls.
Definition: gfx_ball.h:66
float dx
Definition: gfx_ball.h:75
void * args
Definition: gfx_ball.h:86
float max_speed
Definition: gfx_ball.h:78
signed short y
Definition: gfx_ball.h:70
signed short x
Definition: gfx_ball.h:69
gfx_image_handle_t sprite
Definition: gfx_ball.h:67
float f_y
Definition: gfx_ball.h:73
signed short radius
Definition: gfx_ball.h:83
unsigned int colour
Definition: gfx_ball.h:81
float dy
Definition: gfx_ball.h:76
float f_x
Definition: gfx_ball.h:72
callback_t callback
Definition: gfx_ball.h:85
Object to represent a wall that balls bounce off of.
Definition: gfx_ball.h:113
float dampening
Definition: gfx_ball.h:123
unsigned int colour
Definition: gfx_ball.h:126
signed short y2
Definition: gfx_ball.h:121
signed short y1
Definition: gfx_ball.h:115
signed short x1
Definition: gfx_ball.h:114
signed short w
Definition: gfx_ball.h:117
void * args
Definition: gfx_ball.h:129
callback_t callback
Definition: gfx_ball.h:128
signed short x2
Definition: gfx_ball.h:120
signed short h
Definition: gfx_ball.h:118