diff options
| author | Franklin Wei <me@fwei.tk> | 2017-11-25 20:36:40 -0500 |
|---|---|---|
| committer | Franklin Wei <franklin@rockbox.org> | 2020-12-07 19:27:19 -0500 |
| commit | 93de2db34ee5a2e6ea983597e28db396939d87df (patch) | |
| tree | a0deb42d6f3ad5e959d41d377062142626f68333 | |
| parent | ddbf45f92e1433c87e4406af3df37c0f90f6f5d7 (diff) | |
| download | puzzles-93de2db34ee5a2e6ea983597e28db396939d87df.zip puzzles-93de2db34ee5a2e6ea983597e28db396939d87df.tar.gz puzzles-93de2db34ee5a2e6ea983597e28db396939d87df.tar.bz2 puzzles-93de2db34ee5a2e6ea983597e28db396939d87df.tar.xz | |
Fake button presses for Palisade
| -rw-r--r-- | palisade.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -867,13 +867,14 @@ static char *game_text_format(const game_state *state) struct game_ui { int x, y; bool show; + bool fake_ctrl, fake_shift; }; 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 = ui->fake_ctrl = ui->fake_shift = false; return ui; } @@ -917,7 +918,10 @@ static char *interpret_move(const game_state *state, game_ui *ui, const game_drawstate *ds, int x, int y, int button) { int w = state->shared->params.w, h = state->shared->params.h; - bool control = button & MOD_CTRL, shift = button & MOD_SHFT; + bool control = (button & MOD_CTRL) | ui->fake_ctrl, shift = (button & MOD_SHFT) | ui->fake_shift; + + /* reset */ + ui->fake_ctrl = ui->fake_shift = false; button &= ~MOD_MASK; @@ -1000,6 +1004,16 @@ static char *interpret_move(const game_state *state, game_ui *ui, return UI_UPDATE; } } + else if(IS_CURSOR_SELECT(button)) { + /* CURSOR_SELECT or CURSOR_SELECT2 tells us to toggle whether + * the button press should be interpreted as having CTRL or + * shift pressed along with it, respectively. */ + ui->show = true; + if(button == CURSOR_SELECT2) + ui->fake_shift = !ui->fake_shift; + else + ui->fake_ctrl = !ui->fake_ctrl; + } return NULL; } |