diff options
Diffstat (limited to 'src/map.c')
| -rw-r--r-- | src/map.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/map.c b/src/map.c new file mode 100644 index 0000000..ebcb077 --- /dev/null +++ b/src/map.c @@ -0,0 +1,35 @@ +#include "map.h" +#include "game.h" + +void repositionMap(Map* map) +{ + map->rect.x = GetRenderWidth() - map->rect.width; +} + +void initMap(Map* map, const Settings* settings) +{ + *map = (Map){ + .rect = (Rectangle){0.0, 0.0, settings->mapPreviewSize, + settings->mapPreviewSize}, + .isEnabled = settings->isMapPreviewEnabledDefault, + .isFullSize = false + }; + + repositionMap(map); +} + +void updateMap(Map* map, Game* game) +{ + // Handle window resize. + if (IsWindowResized()) + { + repositionMap(map); + } + + if (!map->isEnabled) + { + return; + } + + DrawRectangleLinesEx(map->rect, 3.0, BLUE); +} |
