aboutsummaryrefslogtreecommitdiffstats
path: root/src/map.c
blob: ebcb077dada0c4c24753d7de48f22976f54b403a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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);
}