aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kdx.42@42l.fr>2023-03-28 03:57:12 +0000
committerkdx <kdx.42@42l.fr>2023-03-28 03:58:32 +0000
commitadfe71c6848e73da65fc91bbc745de4b0be29ce9 (patch)
treec2e1da0c3615c7be38fa904197a5059a9e0ae9fe
parent3e4d0b255a3363dc19e8db99845121b2b401e475 (diff)
downloadtzr-adfe71c6848e73da65fc91bbc745de4b0be29ce9.tar.gz
show/hide cursor
-rw-r--r--headers/TZR.h1
-rw-r--r--headers/TZR_globals.h1
-rw-r--r--headers/TZR_types.h1
-rw-r--r--sources/TZR_Init.c8
-rw-r--r--sources/globals.c1
5 files changed, 4 insertions, 8 deletions
diff --git a/headers/TZR.h b/headers/TZR.h
index 1af2f40..06e3714 100644
--- a/headers/TZR.h
+++ b/headers/TZR.h
@@ -15,6 +15,7 @@
.height=224, \
.target_fps=60, \
.pixel_perfect=true, \
+ .show_cursor=false, \
.title="TZR", \
._=0, __VA_ARGS__ })
diff --git a/headers/TZR_globals.h b/headers/TZR_globals.h
index 548110b..a6eaac7 100644
--- a/headers/TZR_globals.h
+++ b/headers/TZR_globals.h
@@ -17,7 +17,6 @@ extern unsigned long ___tzr_min_dt;
extern int ___tzr_should_quit;
extern int ___tzr_mouse_x;
extern int ___tzr_mouse_y;
-extern const char *___tzr_command[___TZR_RES_COUNT];
extern TZR_KeyState ___tzr_keystates[SDL_NUM_SCANCODES];
extern TZR_KeyState ___tzr_mousestates[256];
extern float ___tzr_scale;
diff --git a/headers/TZR_types.h b/headers/TZR_types.h
index 2377614..32f734a 100644
--- a/headers/TZR_types.h
+++ b/headers/TZR_types.h
@@ -41,6 +41,7 @@ struct TZR_Config {
int height;
int target_fps;
bool pixel_perfect;
+ bool show_cursor;
const char *title;
};
diff --git a/sources/TZR_Init.c b/sources/TZR_Init.c
index ce09a3c..7f80978 100644
--- a/sources/TZR_Init.c
+++ b/sources/TZR_Init.c
@@ -62,11 +62,7 @@ _TZR_Init(const TZR_Config *config)
___tzr_next_time = SDL_GetTicks64();
}
- ___tzr_command[TZR_RES_RAW] = getenv("TZR_EDIT_RAW");
- if (___tzr_command[TZR_RES_RAW] == NULL)
- ___tzr_command[TZR_RES_RAW] = "foot nvim";
- ___tzr_command[TZR_RES_IMAGE] = getenv("TZR_EDIT_IMAGE");
- if (___tzr_command[TZR_RES_IMAGE] == NULL)
- ___tzr_command[TZR_RES_IMAGE] = "gimp";
+ if (!___tzr_config.show_cursor)
+ SDL_ShowCursor(0);
return 0;
}
diff --git a/sources/globals.c b/sources/globals.c
index 7c4f26b..712edbf 100644
--- a/sources/globals.c
+++ b/sources/globals.c
@@ -17,7 +17,6 @@ unsigned long ___tzr_min_dt = 0;
int ___tzr_should_quit = 0;
int ___tzr_mouse_x = 0;
int ___tzr_mouse_y = 0;
-const char *___tzr_command[___TZR_RES_COUNT] = {};
TZR_KeyState ___tzr_keystates[SDL_NUM_SCANCODES] = {};
TZR_KeyState ___tzr_mousestates[256] = {}; //doc says than mouse button is u8
float ___tzr_scale = 1.0;