From a0f5e5a0c57bc1216d2b057f41c655af8cb01187 Mon Sep 17 00:00:00 2001 From: attilavs2 Date: Fri, 28 Feb 2025 21:23:51 +0100 Subject: [PATCH] + tile cobble/grass, modifs --- Makefile | 13 +++++++------ assets/tile_cobble.png | Bin 0 -> 2123 bytes assets/tile_grass.png | Bin 0 -> 960 bytes src/config.h | 2 +- src/main.c | 14 +++++++++++--- src/map.c | 12 ++++++++++++ src/map.h | 15 +++++++++++++++ src/ui.c | 6 +++--- src/ui.h | 4 ++-- 9 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 assets/tile_cobble.png create mode 100644 assets/tile_grass.png create mode 100644 src/map.c create mode 100644 src/map.h diff --git a/Makefile b/Makefile index e6c321c..f8dcc5c 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ OUTNAME = mtycoon -CFLAGS = -O0 -g -Wall -Wextra -I ./raylib/include -pipe +CFLAGS = -O0 -Wall -Wextra -g -I ./raylib/include -pipe CC = gcc @@ -28,16 +28,17 @@ windef: $(eval BUILD_DIR = build-win) $(eval LDFLAGS = $(LDFLAGS_WIN)) +builddir: + - mkdir $(BUILD_DIR) + mkdir build-tmp + - mv $(wildcard $(BUILD_DIR)/*.o) build-tmp/ + build-tmp/%.o : $(SRC_DIR)/%.c ${CC} -c $< -o $@ ${CFLAGS} build: $(OBJS) ${CC} ${CFLAGS} -o ${OUTPUT} $(OBJS) ${LDFLAGS} -builddir: - - mkdir $(BUILD_DIR) - mkdir build-tmp - - mv $(wildcard $(BUILD_DIR)/*.o) build-tmp/ builddir2: mv $(wildcard build-tmp/*.o) $(BUILD_DIR) @@ -60,4 +61,4 @@ clean: .NOTPARALLEL: builddir builddir2 -.PHONY: all test clean win testwin prodwin +.PHONY: all test clean win windef builddir builddir2 testwin diff --git a/assets/tile_cobble.png b/assets/tile_cobble.png new file mode 100644 index 0000000000000000000000000000000000000000..b294ef0d8bb5e96bacb1fc9d446a8b77e3b88c13 GIT binary patch literal 2123 zcmV-R2(EX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PGmB+*to;LX0>C|@s`%CqAPJ^(=nJYrR`WbNV@jT9IJX^W z93Rs-rM-|CP5FEB^EDw~bt6bs%fs-c)PJzo70)vUdU9f>Vs4V7~TrnN<^Tyn!` z5{HR?+EEmnz};+qnQGe6)D6yUS+7@T1Xxz$*;lF^5}ImToFyifCRDv3$6@9q1UeJavCCv zVnb1Ef>B&J$1w}kO^a%O9)hJtOfMWx-nJgEI%UYkGAGMs zcvY@ve_=MiCOeRAW9(6HAtFdD({6b0G1bOV78UB1EX>4Tx04R}tkv&MmKpe$iQ>CI+K|6?a$WWc^q9Ts93Pq?8YK2xEOfLO`CJjl7 zi=*ILaPVWX>fqw6tAnc`2!4RL3r>nIQsV!TLW@`rj{EWM-sA2aAk@oDv$|q{rrTyJ z5f?MrRWa}i0bvYb0DUsEj5$e4qT~3whmWs!QJ&TL+@GUg%~=faiNrBxm^SeS@yw=e zaNZ{lv7)RJpA%1*bV1@rt}7nDaW1$l@XU~zPR$dCh{Zx1D{ah*rbawX98oo$@`a4Y zD(5ZETDi)a_v9}O=Jb_iuG0)7fkiAqf(Qjwlu(9^D6Kjv7E-hy@8BPG{Svtpa+Scy zv49FR$gUs!4}N!R<)_CX>@2HM@dakSAh-}00052 zNklQO-SC7KD2 zokBvD5P;}%#7_WJ2sNrwwRFnv?|>r;9|9F6NC3I>B8c_E=IlB7w^NPek>&(c*ux(J zRh9YTV*RqosVmA9I8y3X&mU>;u4@Eo?J8`=Z?C3p^7(v2Ev37*52 zbfZSv!soChUEN+it|aKrUb>XZhrDWU-5eHlXKUwF?0b^e%T2va|9CM5H-}7efCekT iFj0oq3YaKCo8&L{lbAFkwY+Hn0000$mm* literal 0 HcmV?d00001 diff --git a/src/config.h b/src/config.h index 05a3de8..be8d94b 100644 --- a/src/config.h +++ b/src/config.h @@ -2,7 +2,7 @@ #define VERSION_MAJ 0 #define VERSION_MIN 1 -#define VERSION_PATCH 0 +#define VERSION_PATCH 1 // Set in ui.c extern char *VERSION_STR; diff --git a/src/main.c b/src/main.c index 88b9120..0a3449e 100644 --- a/src/main.c +++ b/src/main.c @@ -12,8 +12,16 @@ #include "draw.h" #include "ui.h" -//Idées : -// - Drogues +// Idées : +// - Drogues + +/* TODO +* UI worker/machine : +* map : +* - Textures : ~ +* - Affichage : +* - convertisseur : +*/ int init(Game *game){ int err = init_draw(); @@ -45,7 +53,7 @@ int main(){ int c_worker = 0; for(int k = 0; k < 42; k++){ - for(int j = 0; j < 1; j++){ + for(int j = 0; j < 256; j++){ Machine *coal_mine = add_machine(&game.machines, (V2d){k*250+40,j*400+40}); coal_mine->type = MT_CoalMine; Machine *iron_mine = add_machine(&game.machines, (V2d){k*250+40,j*400+240}); diff --git a/src/map.c b/src/map.c new file mode 100644 index 0000000..63144e1 --- /dev/null +++ b/src/map.c @@ -0,0 +1,12 @@ +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "types.h" + diff --git a/src/map.h b/src/map.h new file mode 100644 index 0000000..e0ba8e5 --- /dev/null +++ b/src/map.h @@ -0,0 +1,15 @@ +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "types.h" + +#pragma once + + diff --git a/src/ui.c b/src/ui.c index 2a2da9f..72417d8 100644 --- a/src/ui.c +++ b/src/ui.c @@ -180,7 +180,7 @@ bool widget_coll(Rectangle widget, V2d point){ bool widgets_treat_event(Game *game, MTEvent event){ bool treated = true; - for(int i = 0; i < WIDGET_N; i++){ + for(int i = WIDGET_N-1; i >= 0 && treated; i--){ if(!gui_info.widget_active[i]) continue; Widget *w = gui_info.widgets[i]; @@ -193,11 +193,11 @@ bool widgets_treat_event(Game *game, MTEvent event){ default: continue; case EV_Mouse: - if(w->capt_flags & ~CF_Mouse) + if(w->capt_flags & CF_Mouse) break; continue; case EV_Keyb: - if(w->capt_flags & ~CF_Keyb) + if(w->capt_flags & CF_Keyb) break; continue; } diff --git a/src/ui.h b/src/ui.h index 814a704..dbd1891 100644 --- a/src/ui.h +++ b/src/ui.h @@ -17,8 +17,8 @@ enum CaptureFlags { CF_None = 0x0, - CF_Mouse = 0x2, //Mouse clicks - CF_Keyb = 0x4 + CF_Mouse = 0x1, //Mouse clicks + CF_Keyb = 0x2 }; enum EventTypes {