43 lines
904 B
C
43 lines
904 B
C
#ifndef WORLD_H
|
|
#define WORLD_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
|
|
enum tile_type {
|
|
TILE_TYPE_VOID,
|
|
TILE_TYPE_SOLID,
|
|
};
|
|
|
|
|
|
struct tile {
|
|
t_rect rect;
|
|
enum tile_type type;
|
|
};
|
|
|
|
|
|
struct world {
|
|
enum tile_type **tilemap;
|
|
struct tile *tiles;
|
|
|
|
int tile_size;
|
|
unsigned int tilemap_width;
|
|
unsigned int tilemap_height;
|
|
size_t tile_nonvoid_count;
|
|
float gravity;
|
|
};
|
|
|
|
|
|
struct world *world_create(void);
|
|
void world_destroy(struct world *world);
|
|
void world_drawdef(struct world *world);
|
|
bool world_find_intersect_frect(struct world *world, t_frect rect, t_frect *intersection);
|
|
bool world_find_intersect_rect(struct world *world, t_rect rect, t_rect *intersection);
|
|
bool world_is_tile_at(struct world *world, float x, float y);
|
|
void world_place_tile(struct world *world, float x, float y);
|
|
void world_remove_tile(struct world *world, float x, float y);
|
|
|
|
|
|
#endif
|