+ tile cobble/grass, modifs
This commit is contained in:
parent
af88efce0a
commit
a0f5e5a0c5
9 changed files with 51 additions and 15 deletions
13
Makefile
13
Makefile
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
OUTNAME = mtycoon
|
OUTNAME = mtycoon
|
||||||
|
|
||||||
CFLAGS = -O0 -g -Wall -Wextra -I ./raylib/include -pipe
|
CFLAGS = -O0 -Wall -Wextra -g -I ./raylib/include -pipe
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
|
|
||||||
|
@ -28,16 +28,17 @@ windef:
|
||||||
$(eval BUILD_DIR = build-win)
|
$(eval BUILD_DIR = build-win)
|
||||||
$(eval LDFLAGS = $(LDFLAGS_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
|
build-tmp/%.o : $(SRC_DIR)/%.c
|
||||||
${CC} -c $< -o $@ ${CFLAGS}
|
${CC} -c $< -o $@ ${CFLAGS}
|
||||||
|
|
||||||
build: $(OBJS)
|
build: $(OBJS)
|
||||||
${CC} ${CFLAGS} -o ${OUTPUT} $(OBJS) ${LDFLAGS}
|
${CC} ${CFLAGS} -o ${OUTPUT} $(OBJS) ${LDFLAGS}
|
||||||
|
|
||||||
builddir:
|
|
||||||
- mkdir $(BUILD_DIR)
|
|
||||||
mkdir build-tmp
|
|
||||||
- mv $(wildcard $(BUILD_DIR)/*.o) build-tmp/
|
|
||||||
|
|
||||||
builddir2:
|
builddir2:
|
||||||
mv $(wildcard build-tmp/*.o) $(BUILD_DIR)
|
mv $(wildcard build-tmp/*.o) $(BUILD_DIR)
|
||||||
|
@ -60,4 +61,4 @@ clean:
|
||||||
|
|
||||||
.NOTPARALLEL: builddir builddir2
|
.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
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
BIN
assets/tile_grass.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 960 B |
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#define VERSION_MAJ 0
|
#define VERSION_MAJ 0
|
||||||
#define VERSION_MIN 1
|
#define VERSION_MIN 1
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 1
|
||||||
|
|
||||||
// Set in ui.c
|
// Set in ui.c
|
||||||
extern char *VERSION_STR;
|
extern char *VERSION_STR;
|
||||||
|
|
14
src/main.c
14
src/main.c
|
@ -12,8 +12,16 @@
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
|
|
||||||
//Idées :
|
// Idées :
|
||||||
// - Drogues
|
// - Drogues
|
||||||
|
|
||||||
|
/* TODO
|
||||||
|
* UI worker/machine :
|
||||||
|
* map :
|
||||||
|
* - Textures : ~
|
||||||
|
* - Affichage :
|
||||||
|
* - convertisseur :
|
||||||
|
*/
|
||||||
|
|
||||||
int init(Game *game){
|
int init(Game *game){
|
||||||
int err = init_draw();
|
int err = init_draw();
|
||||||
|
@ -45,7 +53,7 @@ int main(){
|
||||||
int c_worker = 0;
|
int c_worker = 0;
|
||||||
|
|
||||||
for(int k = 0; k < 42; k++){
|
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});
|
Machine *coal_mine = add_machine(&game.machines, (V2d){k*250+40,j*400+40});
|
||||||
coal_mine->type = MT_CoalMine;
|
coal_mine->type = MT_CoalMine;
|
||||||
Machine *iron_mine = add_machine(&game.machines, (V2d){k*250+40,j*400+240});
|
Machine *iron_mine = add_machine(&game.machines, (V2d){k*250+40,j*400+240});
|
||||||
|
|
12
src/map.c
Normal file
12
src/map.c
Normal 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
15
src/map.h
Normal 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
|
||||||
|
|
||||||
|
|
6
src/ui.c
6
src/ui.c
|
@ -180,7 +180,7 @@ bool widget_coll(Rectangle widget, V2d point){
|
||||||
|
|
||||||
bool widgets_treat_event(Game *game, MTEvent event){
|
bool widgets_treat_event(Game *game, MTEvent event){
|
||||||
bool treated = true;
|
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])
|
if(!gui_info.widget_active[i])
|
||||||
continue;
|
continue;
|
||||||
Widget *w = gui_info.widgets[i];
|
Widget *w = gui_info.widgets[i];
|
||||||
|
@ -193,11 +193,11 @@ bool widgets_treat_event(Game *game, MTEvent event){
|
||||||
default:
|
default:
|
||||||
continue;
|
continue;
|
||||||
case EV_Mouse:
|
case EV_Mouse:
|
||||||
if(w->capt_flags & ~CF_Mouse)
|
if(w->capt_flags & CF_Mouse)
|
||||||
break;
|
break;
|
||||||
continue;
|
continue;
|
||||||
case EV_Keyb:
|
case EV_Keyb:
|
||||||
if(w->capt_flags & ~CF_Keyb)
|
if(w->capt_flags & CF_Keyb)
|
||||||
break;
|
break;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
4
src/ui.h
4
src/ui.h
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
enum CaptureFlags {
|
enum CaptureFlags {
|
||||||
CF_None = 0x0,
|
CF_None = 0x0,
|
||||||
CF_Mouse = 0x2, //Mouse clicks
|
CF_Mouse = 0x1, //Mouse clicks
|
||||||
CF_Keyb = 0x4
|
CF_Keyb = 0x2
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EventTypes {
|
enum EventTypes {
|
||||||
|
|
Loading…
Add table
Reference in a new issue