From 0df2d329d9ec3458d8f6d80b5937ad92722da940 Mon Sep 17 00:00:00 2001 From: Krow Savcik Date: Thu, 11 Jan 2024 15:29:47 +0200 Subject: added: config.def.h Now the default configuration is in config.def.h Before compiling for the first time, config.h is created. --- Makefile | 9 ++++++--- README.md | 2 +- config.def.h | 31 +++++++++++++++++++++++++++++++ src/config.h | 34 ---------------------------------- 4 files changed, 38 insertions(+), 38 deletions(-) create mode 100644 config.def.h delete mode 100644 src/config.h diff --git a/Makefile b/Makefile index ba33b3c..b3eccec 100644 --- a/Makefile +++ b/Makefile @@ -3,11 +3,12 @@ include config.mk TOBJ = ui.o canvas.o user.o palette.o tools.o debug.o OBJ = $(addprefix build/, ${TOBJ}) -all: build run - -build: ${OBJ} src/cdraw.c +build: prep config.h ${OBJ} src/cdraw.c ${CC} ${CFLAGS} ${LIBS} ${OBJ} src/cdraw.c -o build/cdraw +config.h: + cp config.def.h config.h + prep: mkdir -p build @@ -20,3 +21,5 @@ build/%.o: src/%.c clean: rm $(OBJ) rm build/cdraw + +.PHONY: build clean run prep diff --git a/README.md b/README.md index 2a971c7..9ddf504 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ And these features are waiting to be implemented: Controls -------- -All the keybindings can be changed in *src/config.h*. +All the keybindings can be changed in *config.h*. - **=/-** for zooming in/out - **arrows** for moving the canvas diff --git a/config.def.h b/config.def.h new file mode 100644 index 0000000..396f26a --- /dev/null +++ b/config.def.h @@ -0,0 +1,31 @@ +#define COLTOINT(R,G,B) (R<<16)+(G<<8)+B + +const unsigned int maxzoom = 20; +const unsigned int fps = 30; +const char *def_palette_path = "assets/default.gpl"; +const char *def_theme_path = "assets/ui.png"; +const unsigned int back_c = COLTOINT(146, 161, 185); + +static Key keys[] = { + /* modifier key function argument */ + {0, SDLK_EQUALS, user_canvas_zoom_change, {.i = 1}}, + {0, SDLK_MINUS, user_canvas_zoom_change, {.i = -1}}, + {0, SDLK_UP, user_canvas_move_y, {.i = 10}}, + {0, SDLK_DOWN, user_canvas_move_y, {.i = -10}}, + {0, SDLK_LEFT, user_canvas_move_x, {.i = 10}}, + {0, SDLK_RIGHT, user_canvas_move_x, {.i = -10}}, + {0, SDLK_s, user_canvas_save, {.v = NULL}}, + {0, SDLK_r, user_canvas_refresh, {.v = NULL}}, + {0, SDLK_o, user_canvas_open, {.s = NULL}}, + {KMOD_LSHIFT, SDLK_e, user_canvas_export_png, {.v = NULL}}, + {KMOD_LSHIFT, SDLK_i, user_canvas_import_png, {.s = NULL}}, + {0, SDLK_b, user_tool_change, {.i = 0}}, + {0, SDLK_e, user_tool_change, {.i = 1}}, + {0, SDLK_f, user_tool_change, {.i = 2}}, + {0, SDLK_i, user_tool_change, {.i = 3}}, + {0, SDLK_n, user_canvas_create_new, {.v = NULL}}, + {0, SDLK_LEFTBRACKET, user_canvas_pal_col_chng, {.i = -1}}, + {0, SDLK_RIGHTBRACKET, user_canvas_pal_col_chng, {.i = 1}}, + {KMOD_LSHIFT, SDLK_r, user_testing_reload_tex, {.i = 1}}, + {0, SDLK_m, user_debug_mem_show, {.v = NULL}}, +}; diff --git a/src/config.h b/src/config.h deleted file mode 100644 index f224a64..0000000 --- a/src/config.h +++ /dev/null @@ -1,34 +0,0 @@ -#define COLTOINT(R,G,B) (R<<16)+(G<<8)+B - -const unsigned int maxzoom = 20; -const unsigned int fps = 30; -const char *def_palette_path = "assets/default.gpl"; -const char *def_theme_path = "assets/ui.png"; -const unsigned int back_c = COLTOINT(146, 161, 185); - -static Key keys[] = { - /* modifier key function argument */ - {0, SDLK_EQUALS, user_canvas_zoom_change, {.i = 1}}, - {0, SDLK_MINUS, user_canvas_zoom_change, {.i = -1}}, - {0, SDLK_UP, user_canvas_move_y, {.i = 10}}, - {0, SDLK_DOWN, user_canvas_move_y, {.i = -10}}, - {0, SDLK_LEFT, user_canvas_move_x, {.i = 10}}, - {0, SDLK_RIGHT, user_canvas_move_x, {.i = -10}}, - {0, SDLK_s, user_canvas_save, {.v = NULL}}, - {0, SDLK_r, user_canvas_refresh, {.v = NULL}}, - {0, SDLK_o, user_canvas_open, {.s = NULL}}, - {KMOD_LSHIFT, SDLK_e, user_canvas_export_png, {.v = NULL}}, - {KMOD_LSHIFT, SDLK_i, user_canvas_import_png, {.s = NULL}}, - {0, SDLK_b, user_tool_change, {.i = 0}}, - {0, SDLK_e, user_tool_change, {.i = 1}}, - {0, SDLK_f, user_tool_change, {.i = 2}}, - {0, SDLK_i, user_tool_change, {.i = 3}}, - {0, SDLK_n, user_canvas_create_new, {.v = NULL}}, - {0, SDLK_LEFTBRACKET, user_canvas_pal_col_chng, {.i = -1}}, - {0, SDLK_RIGHTBRACKET, user_canvas_pal_col_chng, {.i = 1}}, -/* {0, SDLK_j, user_testing_layer_add, {.i = 1}},*/ - {KMOD_LSHIFT, SDLK_r, user_testing_reload_tex, {.i = 1}}, -/* {KMOD_LSHIFT, SDLK_LEFTBRACKET, user_layer_chng, {.i = -1}},*/ -/* {KMOD_LSHIFT, SDLK_RIGHTBRACKET, user_layer_chng, {.i = 1}},*/ - {0, SDLK_m, user_debug_mem_show, {.v = NULL}}, -}; -- cgit v1.2.3