mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-22 16:32:13 -07:00
Expose the NO_EFFECT/UNUSED distinction through midend_process_key()
This removed the "handled" pointer and instead extends the existing boolean return value (quit or don't quit) into an enumeration. One of the values still quits the program, but now there are different values for keys that had an effect, had no effect, and are not used by the puzzle at all. The mapping from interpret_move results to process_key results is roughly: move string -> PKR_SOME_EFFECT MOVE_UI_UPDATE -> PKR_SOME_EFFECT MOVE_NO_EFFECT -> PKR_NO_EFFECT MOVE_UNUSED -> PKR_UNUSED The mid-end can also generate results internally, and is the only place that PKR_QUIT can arise. For compatibility, PKR_QUIT is zero, so anything expecting a false return value to mean quit will be unsurprised. The other values are ordered so that lower values indicate a greater amount of handling of the key.
This commit is contained in:
@ -320,7 +320,8 @@ void midend_reset_tilesize(midend *me);
|
||||
void midend_new_game(midend *me);
|
||||
void midend_restart_game(midend *me);
|
||||
void midend_stop_anim(midend *me);
|
||||
bool midend_process_key(midend *me, int x, int y, int button, bool *handled);
|
||||
enum { PKR_QUIT = 0, PKR_SOME_EFFECT, PKR_NO_EFFECT, PKR_UNUSED };
|
||||
int midend_process_key(midend *me, int x, int y, int button);
|
||||
key_label *midend_request_keys(midend *me, int *nkeys);
|
||||
const char *midend_current_key_label(midend *me, int button);
|
||||
void midend_force_redraw(midend *me);
|
||||
|
Reference in New Issue
Block a user