+ tile cobble/grass, modifs

This commit is contained in:
attilavs2 2025-02-28 21:23:51 +01:00
parent af88efce0a
commit a0f5e5a0c5
9 changed files with 51 additions and 15 deletions

View file

@ -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

BIN
assets/tile_cobble.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
assets/tile_grass.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 960 B

View file

@ -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;

View file

@ -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});

12
src/map.c Normal file
View file

@ -0,0 +1,12 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <raylib.h>
#include <raymath.h>
#include "types.h"

15
src/map.h Normal file
View file

@ -0,0 +1,15 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <raylib.h>
#include <raymath.h>
#include "types.h"
#pragma once

View file

@ -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;
}

View file

@ -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 {