Skip to content

Commit

Permalink
Add option to disable cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
RowdyVoyeur authored Apr 23, 2024
1 parent 5211cf9 commit 6dcd089
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ config_params_s init_config() {

c.init_fullscreen = 0; // default fullscreen state at load
c.init_use_gpu = 1; // default to use hardware acceleration
c.init_disable_cursor = 1; // default to disable cursor
c.idle_ms = 10; // default to high performance
c.wait_for_device = 1; // default to exit if device disconnected
c.wait_packets = 1024; // default zero-byte attempts to disconnect (about 2
Expand Down Expand Up @@ -82,7 +83,7 @@ void write_config(config_params_s *conf) {

SDL_Log("Writing config file to %s", config_path);

const unsigned int INI_LINE_COUNT = 44;
const unsigned int INI_LINE_COUNT = 45;
const unsigned int LINELEN = 50;

// Entries for the config file
Expand All @@ -93,6 +94,8 @@ void write_config(config_params_s *conf) {
conf->init_fullscreen ? "true" : "false");
snprintf(ini_values[initPointer++], LINELEN, "use_gpu=%s\n",
conf->init_use_gpu ? "true" : "false");
sprintf(ini_values[initPointer++], "disable_cursor=%s\n",
conf->init_disable_cursor ? "true" : "false");
snprintf(ini_values[initPointer++], LINELEN, "idle_ms=%d\n", conf->idle_ms);
snprintf(ini_values[initPointer++], LINELEN, "wait_for_device=%s\n",
conf->wait_for_device ? "true" : "false");
Expand Down Expand Up @@ -242,6 +245,7 @@ void read_audio_config(ini_t *ini, config_params_s *conf) {
void read_graphics_config(ini_t *ini, config_params_s *conf) {
const char *param_fs = ini_get(ini, "graphics", "fullscreen");
const char *param_gpu = ini_get(ini, "graphics", "use_gpu");
const char *param_cursor = ini_get(ini, "graphics", "disable_cursor");
const char *idle_ms = ini_get(ini, "graphics", "idle_ms");
const char *param_wait = ini_get(ini, "graphics", "wait_for_device");
const char *wait_packets = ini_get(ini, "graphics", "wait_packets");
Expand All @@ -257,7 +261,14 @@ void read_graphics_config(ini_t *ini, config_params_s *conf) {
} else
conf->init_use_gpu = 0;
}


if(param_cursor != NULL){
if (strcmpci(param_cursor, "true") == 0) {
conf->init_disable_cursor = 1;
} else
conf->init_disable_cursor = 0;
}

if (idle_ms != NULL)
conf->idle_ms = SDL_atoi(idle_ms);

Expand Down

0 comments on commit 6dcd089

Please sign in to comment.