#ifndef CONSTS_H #define CONSTS_H // ------------------------------------------------------------------------ // // SDL-related struct typedef struct imgs { int len; SDL_Texture** arr; } imgs; // ------------------------------------------------------------------------ // // car shenanigans typedef struct pt_t {int ix; int iy;} pt; typedef struct ptf_t {double fx; double fy;} ptf; typedef struct car_t car; // unused for now typedef struct item_t { const char* name; void (*onCollect)(car* user); void (*onUse)(car* user); } item; typedef struct car_t { const char* name; ptf pos; int size; ptf vel; int nCoins; item* itm; // either NULL or a pointer to an item } car; // ------------------------------------------------------------------------ // // (take a) map typedef struct color_t { uint8_t red; uint8_t green; uint8_t blue; } color; // 2 types of objects : rectangles and circles typedef struct rectangle_t { int x; int y; int w; int h; color rgb; double restitution; void (*onHit)(struct rectangle_t * self, car* bonk); void (*betweenTurn) (struct rectangle_t * self); } rectangle; typedef struct circle_t { int x; int y; int r; color rgb; double restitution; void (*onHit)(struct circle_t * self, car* bonk); void (*betweenTurn) (struct circle_t * self); } circle; typedef struct chunk_t { rectangle* rects; int nRects; circle* circles; int nCircles; // size of the chunk int chW; int chH; // absolute coords int chX; int chY; // neighbors struct chunk_t* north; struct chunk_t* east; struct chunk_t* south; struct chunk_t* west; } chunk; // global car data typedef struct carData_t { car* c; chunk* curChunk; } carData; // ------------------------------------------------------------------------ // extern imgs* digits; // SDL data extern imgs* letters; // SDL data extern int currentTurn; // name explains extern chunk* start; // starting chunk extern chunk** allRooms; // an array containing every generated room, used for free() extern int nMaxRooms; // size of allRooms extern carData* players; // contains each player and its corresponding data extern int nPlayers; // size of players #endif