diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-03-22 16:58:22 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-03-22 16:58:22 +0000 |
| commit | 6dac51795e5672f32bba787c0f011cb01e464a96 (patch) | |
| tree | 2018973bd3b6451491af85784566917563c16a44 | |
| parent | 09c15f206edac18bd2158c189c821b9ba85d3939 (diff) | |
| download | puzzles-6dac51795e5672f32bba787c0f011cb01e464a96.zip puzzles-6dac51795e5672f32bba787c0f011cb01e464a96.tar.gz puzzles-6dac51795e5672f32bba787c0f011cb01e464a96.tar.bz2 puzzles-6dac51795e5672f32bba787c0f011cb01e464a96.tar.xz | |
Add an environment variable to control initial cursor visibility
If you define PUZZLES_INITIAL_CURSOR=y, puzzles that have a keyboard
cursor will default to making it visible rather than invisible at the
start of a new game. Behaviour is otherwise the same, so mouse actions
will cause the cursor to vanish and keyboard actions will cause it to
appear. It's just the default that has changed.
The purpose of this is for use on devices and platforms where the
primary or only means of interaction is keyboard-based. In those cases,
starting with the keyboard cursor invisible is weird and a bit
confusing.
| -rw-r--r-- | blackbox.c | 2 | ||||
| -rw-r--r-- | bridges.c | 2 | ||||
| -rw-r--r-- | dominosa.c | 2 | ||||
| -rw-r--r-- | filling.c | 2 | ||||
| -rw-r--r-- | flip.c | 2 | ||||
| -rw-r--r-- | flood.c | 2 | ||||
| -rw-r--r-- | galaxies.c | 2 | ||||
| -rw-r--r-- | guess.c | 1 | ||||
| -rw-r--r-- | keen.c | 3 | ||||
| -rw-r--r-- | lightup.c | 2 | ||||
| -rw-r--r-- | magnets.c | 2 | ||||
| -rw-r--r-- | map.c | 2 | ||||
| -rw-r--r-- | mines.c | 2 | ||||
| -rw-r--r-- | mosaic.c | 2 | ||||
| -rw-r--r-- | net.c | 2 | ||||
| -rw-r--r-- | netslide.c | 2 | ||||
| -rw-r--r-- | palisade.c | 2 | ||||
| -rw-r--r-- | pattern.c | 2 | ||||
| -rw-r--r-- | pearl.c | 2 | ||||
| -rw-r--r-- | pegs.c | 2 | ||||
| -rw-r--r-- | range.c | 2 | ||||
| -rw-r--r-- | rect.c | 2 | ||||
| -rw-r--r-- | samegame.c | 2 | ||||
| -rw-r--r-- | signpost.c | 2 | ||||
| -rw-r--r-- | singles.c | 2 | ||||
| -rw-r--r-- | sixteen.c | 2 | ||||
| -rw-r--r-- | slant.c | 2 | ||||
| -rw-r--r-- | solo.c | 3 | ||||
| -rw-r--r-- | tents.c | 2 | ||||
| -rw-r--r-- | towers.c | 3 | ||||
| -rw-r--r-- | tracks.c | 2 | ||||
| -rw-r--r-- | twiddle.c | 2 | ||||
| -rw-r--r-- | undead.c | 5 | ||||
| -rw-r--r-- | unequal.c | 3 | ||||
| -rw-r--r-- | unruly.c | 2 |
35 files changed, 36 insertions, 40 deletions
@@ -485,7 +485,7 @@ static game_ui *new_ui(const game_state *state) ui->newmove = false; ui->cur_x = ui->cur_y = 1; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->flash_laser = 0; @@ -2127,7 +2127,7 @@ static game_ui *new_ui(const game_state *state) ui_cancel_drag(ui); ui->cur_x = state->islands[0].x; ui->cur_y = state->islands[0].y; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->show_hints = false; return ui; } @@ -2713,7 +2713,7 @@ static game_ui *new_ui(const game_state *state) { game_ui *ui = snew(game_ui); ui->cur_x = ui->cur_y = 0; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->highlight_1 = ui->highlight_2 = -1; return ui; } @@ -1396,7 +1396,7 @@ static game_ui *new_ui(const game_state *state) ui->sel = NULL; ui->cur_x = ui->cur_y = 0; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->keydragging = false; return ui; @@ -913,7 +913,7 @@ static game_ui *new_ui(const game_state *state) { game_ui *ui = snew(game_ui); ui->cx = ui->cy = 0; - ui->cdraw = false; + ui->cdraw = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -775,7 +775,7 @@ struct game_ui { static game_ui *new_ui(const game_state *state) { struct game_ui *ui = snew(struct game_ui); - ui->cursor_visible = false; + ui->cursor_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->cx = FILLX; ui->cy = FILLY; return ui; @@ -2688,7 +2688,7 @@ static game_ui *new_ui(const game_state *state) game_ui *ui = snew(game_ui); ui->dragging = false; ui->cur_x = ui->cur_y = 1; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -410,6 +410,7 @@ static game_ui *new_ui(const game_state *state) ui->params = state->params; /* structure copy */ ui->curr_pegs = new_pegrow(state->params.npegs); ui->holds = snewn(state->params.npegs, bool); + ui->display_cur = getenv_bool("PUZZLES_SHOW_CURSOR", false); memset(ui->holds, 0, sizeof(bool)*state->params.npegs); ui->drag_opeg = -1; return ui; @@ -1530,8 +1530,7 @@ static game_ui *new_ui(const game_state *state) ui->hx = ui->hy = 0; ui->hpencil = false; - ui->hshow = false; - ui->hcursor = false; + ui->hshow = ui->hcursor = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -1835,7 +1835,7 @@ static game_ui *new_ui(const game_state *state) { game_ui *ui = snew(game_ui); ui->cur_x = ui->cur_y = 0; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -1730,7 +1730,7 @@ static game_ui *new_ui(const game_state *state) { game_ui *ui = snew(game_ui); ui->cur_x = ui->cur_y = 0; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -2287,7 +2287,7 @@ static game_ui *new_ui(const game_state *state) ui->drag_pencil = 0; ui->show_numbers = false; ui->cur_x = ui->cur_y = 0; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->cur_moved = false; ui->cur_lastmove = 0; return ui; @@ -2387,7 +2387,7 @@ static game_ui *new_ui(const game_state *state) ui->completed = false; ui->flash_is_death = false; /* *shrug* */ ui->cur_x = ui->cur_y = 0; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -1009,7 +1009,7 @@ static game_ui *new_ui(const game_state *state) ui->last_state = 0; ui->solved = false; ui->cur_x = ui->cur_y = 0; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -2010,7 +2010,7 @@ static game_ui *new_ui(const game_state *state) ui->org_x = ui->org_y = 0; ui->cur_x = ui->cx = state->width / 2; ui->cur_y = ui->cy = state->height / 2; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); get_random_seed(&seed, &seedsize); ui->rs = random_new(seed, seedsize); sfree(seed); @@ -969,7 +969,7 @@ static game_ui *new_ui(const game_state *state) game_ui *ui = snew(game_ui); ui->cur_x = 0; ui->cur_y = -1; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -878,7 +878,7 @@ static game_ui *new_ui(const game_state *state) { game_ui *ui = snew(game_ui); ui->x = ui->y = 0; - ui->show = false; + ui->show = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -1236,7 +1236,7 @@ static game_ui *new_ui(const game_state *state) ret = snew(game_ui); ret->dragging = false; ret->cur_x = ret->cur_y = 0; - ret->cur_visible = false; + ret->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ret; } @@ -1862,7 +1862,7 @@ static game_ui *new_ui(const game_state *state) ui->ndragcoords = -1; ui->dragcoords = snewn(sz, int); - ui->cursor_active = false; + ui->cursor_active = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->curx = ui->cury = 0; return ui; @@ -785,7 +785,7 @@ static game_ui *new_ui(const game_state *state) ui->sx = ui->sy = ui->dx = ui->dy = 0; ui->dragging = false; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->cur_jumping = false; /* make sure we start the cursor somewhere on the grid. */ @@ -1227,7 +1227,7 @@ static game_ui *new_ui(const game_state *state) { struct game_ui *ui = snew(game_ui); ui->r = ui->c = 0; - ui->cursor_show = false; + ui->cursor_show = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -2206,7 +2206,7 @@ static game_ui *new_ui(const game_state *state) reset_ui(ui); ui->erasing = false; ui->cur_x = ui->cur_y = 0; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->cur_dragging = false; return ui; } @@ -1062,7 +1062,7 @@ static game_ui *new_ui(const game_state *state) ui->nselected = 0; ui->xsel = ui->ysel = 0; - ui->displaysel = false; + ui->displaysel = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -1393,7 +1393,7 @@ static game_ui *new_ui(const game_state *state) * copy to clone, there's code that needs fixing in game_redraw too. */ ui->cx = ui->cy = 0; - ui->cshow = false; + ui->cshow = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->dragging = false; ui->sx = ui->sy = ui->dx = ui->dy = 0; @@ -1446,7 +1446,7 @@ static game_ui *new_ui(const game_state *state) game_ui *ui = snew(game_ui); ui->cx = ui->cy = 0; - ui->cshow = false; + ui->cshow = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->show_black_nums = false; return ui; @@ -569,7 +569,7 @@ static game_ui *new_ui(const game_state *state) game_ui *ui = snew(game_ui); ui->cur_x = 0; ui->cur_y = 0; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->cur_mode = unlocked; return ui; @@ -1582,7 +1582,7 @@ static game_ui *new_ui(const game_state *state) { game_ui *ui = snew(game_ui); ui->cur_x = ui->cur_y = 0; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -4559,8 +4559,7 @@ static game_ui *new_ui(const game_state *state) ui->hx = ui->hy = 0; ui->hpencil = false; - ui->hshow = false; - ui->hcursor = false; + ui->hshow = ui->hcursor = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -1455,7 +1455,7 @@ static game_ui *new_ui(const game_state *state) ui->drag_button = -1; ui->drag_ok = false; ui->cx = ui->cy = 0; - ui->cdisp = false; + ui->cdisp = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -1163,8 +1163,7 @@ static game_ui *new_ui(const game_state *state) ui->hx = ui->hy = 0; ui->hpencil = false; - ui->hshow = false; - ui->hcursor = false; + ui->hshow = ui->hcursor = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -2018,7 +2018,7 @@ static game_ui *new_ui(const game_state *state) ui->notrack = false; ui->dragging = false; ui->drag_sx = ui->drag_sy = ui->drag_ex = ui->drag_ey = -1; - ui->cursor_active = false; + ui->cursor_active = getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->curx = ui->cury = 1; return ui; @@ -618,7 +618,7 @@ static game_ui *new_ui(const game_state *state) ui->cur_x = 0; ui->cur_y = 0; - ui->cur_visible = false; + ui->cur_visible = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -1645,10 +1645,9 @@ struct game_ui { static game_ui *new_ui(const game_state *state) { game_ui *ui = snew(game_ui); - ui->hx = ui->hy = 0; ui->hpencil = false; - ui->hshow = false; - ui->hcursor = false; + ui->hx = ui->hy = ui->hshow = ui->hcursor = + getenv_bool("PUZZLES_SHOW_CURSOR", false); ui->ascii = false; return ui; } @@ -1440,8 +1440,7 @@ static game_ui *new_ui(const game_state *state) ui->hx = ui->hy = 0; ui->hpencil = false; - ui->hshow = false; - ui->hcursor = false; + ui->hshow = ui->hcursor = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ui; } @@ -1513,7 +1513,7 @@ static game_ui *new_ui(const game_state *state) game_ui *ret = snew(game_ui); ret->cx = ret->cy = 0; - ret->cursor = false; + ret->cursor = getenv_bool("PUZZLES_SHOW_CURSOR", false); return ret; } |