2019-11-21 19:30:54 +01:00
|
|
|
#ifndef BOX_H
|
|
|
|
#define BOX_H
|
|
|
|
|
2020-02-16 20:43:35 +01:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2020-01-29 14:34:47 +01:00
|
|
|
// Box type
|
|
|
|
// Used to simulate gravity and collides
|
|
|
|
|
2019-11-21 19:30:54 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
2019-12-11 16:31:18 +01:00
|
|
|
int x :16;
|
|
|
|
int y :16;
|
2019-11-21 19:30:54 +01:00
|
|
|
|
2019-12-11 16:31:18 +01:00
|
|
|
unsigned w :8;
|
|
|
|
unsigned h :8;
|
2019-11-21 19:30:54 +01:00
|
|
|
|
2019-12-11 16:31:18 +01:00
|
|
|
int vx :8;
|
|
|
|
int vy :8;
|
|
|
|
int last_vy :8;
|
2020-01-29 14:34:47 +01:00
|
|
|
int gravity :8;
|
2020-02-16 20:43:35 +01:00
|
|
|
//int isMario;
|
2019-11-21 19:30:54 +01:00
|
|
|
} box_t;
|
|
|
|
|
2020-02-16 20:43:35 +01:00
|
|
|
void boxMove(box_t * b);
|
|
|
|
bool boxContact(box_t const * b1, box_t const * b2);
|
|
|
|
void boxJump(box_t * b, int height);
|
2019-11-21 19:30:54 +01:00
|
|
|
|
2020-02-16 12:51:27 +01:00
|
|
|
#endif
|