diff --git a/main.c b/main.c
index 946d00c..e41cc40 100644
--- a/main.c
+++ b/main.c
@@ -3,6 +3,9 @@
static inline int min(int a, int b) {
return a < b ? a : b;
}
+static inline int max(int a, int b) {
+ return a > b ? a : b;
+}
int screen_width = 500;
int screen_height = 550;
@@ -13,6 +16,10 @@ int nb_cell = 16;
Rectangle grid = {0};
+Image tile_image_orig = {0};
+Texture tile_texture = {0};
+Image tile_hover_image_orig = {0};
+Texture tile_hover_texture = {0};
Image mine_image_orig = {0};
Texture mine_texture = {0};
@@ -22,9 +29,19 @@ void screen_resize_handle(void) {
menu.width = screen_width;
grid_len = min(screen_width, screen_height - menu.height);
- grid = (Rectangle){(screen_width - grid_len) / 2,
- screen_height - grid_len,
- grid_len, grid_len};
+ grid = (Rectangle){
+ (screen_width - grid_len) / 2,
+ screen_height - grid_len,
+ grid_len, grid_len
+ };
+
+ Image tile_copy = ImageCopy(tile_image_orig);
+ ImageResize(&tile_copy, grid.width/nb_cell, grid.height/nb_cell);
+ tile_texture = LoadTextureFromImage(tile_copy);
+
+ Image tile_hover_copy = ImageCopy(tile_hover_image_orig);
+ ImageResize(&tile_hover_copy, grid.width/nb_cell, grid.height/nb_cell);
+ tile_hover_texture = LoadTextureFromImage(tile_hover_copy);
Image mine_copy = ImageCopy(mine_image_orig);
ImageResize(&mine_copy, grid.width/nb_cell, grid.height/nb_cell);
@@ -35,9 +52,12 @@ int main(void) {
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
menu = (Rectangle){0, 0, screen_width, screen_height - screen_width};
+ tile_image_orig = LoadImage("ressources/tile.png");
+ tile_hover_image_orig = LoadImage("ressources/tile_hover.png");
mine_image_orig = LoadImage("ressources/mine.png");
InitWindow(screen_width, screen_height, "mineur");
+ SetTargetFPS(60);
screen_resize_handle();
@@ -47,19 +67,42 @@ int main(void) {
BeginDrawing();
{
- ClearBackground(RAYWHITE);
+ ClearBackground(BLACK);
DrawRectangleRec(menu, RED);
- DrawRectangleRec(grid, GRAY);
+ DrawRectangleRec(grid, (Color) {
+ .r = 0xFF, .g = 0xDA, .b = 0x2E, .a = 255
+ });
for (int x=0; x
+
+
+
+
diff --git a/ressources/tile_hover.png b/ressources/tile_hover.png
new file mode 100644
index 0000000..0847865
Binary files /dev/null and b/ressources/tile_hover.png differ
diff --git a/ressources/tile_hover.svg b/ressources/tile_hover.svg
new file mode 100644
index 0000000..8c1aa67
--- /dev/null
+++ b/ressources/tile_hover.svg
@@ -0,0 +1,85 @@
+
+
+
+