Skip to content

Commit e803ecb

Browse files
committed
rename some flags/events
1 parent 644a717 commit e803ecb

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

shared/chip8.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ void chip8_reset(bool verbose) {
245245
chip8.paused = 0;
246246

247247
/* flip the GUI bit */
248-
gui.soft_reset_flag = 0;
248+
gui.reset_flag = 0;
249249

250250
if (verbose) toast_show(TOAST_INFO, "Reset");
251251

@@ -276,9 +276,9 @@ void chip8_run(){
276276
event = input_poll();
277277

278278
/* do something based on response... */
279-
if (event & USER_QUIT) return;
279+
if (event & QUIT) return;
280280
if (event & LOAD_ROM) chip8_load_rom(NULL);
281-
if (event & SOFT_RESET) chip8_reset(true);
281+
if (event & RESET) chip8_reset(true);
282282
if (event & SAVE_PROFILE) chip8_save_profile();
283283

284284
/* Update toast timers */

shared/gui.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static void gui_main_menu(void) {
210210
}
211211

212212
if (ImGui::BeginMenu("Emulation")) {
213-
ImGui::MenuItem("Reset", "F5", &gui.soft_reset_flag);
213+
ImGui::MenuItem("Reset", "F5", &gui.reset_flag);
214214
before = chip8.paused;
215215
ImGui::MenuItem("Pause", "P", &chip8.paused);
216216
if (before != chip8.paused) {
@@ -316,7 +316,7 @@ void gui_cleanup(void) {
316316
}
317317

318318
void gui_init(void) {
319-
gui.soft_reset_flag = 0;
319+
gui.reset_flag = 0;
320320
gui.load_rom_flag = 0;
321321
gui.save_profile_flag = 0;
322322
gui.quit_flag = 0;

shared/gui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct gui {
2121
bool show_about;
2222
bool show_usage;
2323

24-
bool soft_reset_flag;
24+
bool reset_flag;
2525
bool load_rom_flag;
2626
bool save_profile_flag;
2727
bool quit_flag;

shared/input.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ static int input_process_events(void) {
4141
int response = CONTINUE;
4242

4343
/* cose when the user clicks 'X' */
44-
if (input.event.type == SDL_QUIT) response = USER_QUIT;
44+
if (input.event.type == SDL_QUIT) response = QUIT;
4545

4646
/* keystroke events */
4747
if (input.event.type == SDL_KEYDOWN) {
48-
if (input.state[SDL_SCANCODE_ESCAPE]) response = USER_QUIT;
49-
if (input.state[SDL_SCANCODE_F5]) response = SOFT_RESET;
48+
if (input.state[SDL_SCANCODE_ESCAPE]) response = QUIT;
49+
if (input.state[SDL_SCANCODE_F5]) response = RESET;
5050
if (input.state[SDL_SCANCODE_RETURN]) display_toggle_fullscreen();
5151
if (input.state[SDL_SCANCODE_P]) {
5252
chip8.paused = !chip8.paused;
@@ -78,7 +78,7 @@ static int input_process_events(void) {
7878
}
7979

8080
/* the window manager requests that the window be closed */
81-
if (input.event.window.event == SDL_WINDOWEVENT_CLOSE) response = USER_QUIT;
81+
if (input.event.window.event == SDL_WINDOWEVENT_CLOSE) response = QUIT;
8282
}
8383

8484
return response;
@@ -99,8 +99,8 @@ int input_poll(void) {
9999

100100
/* check GUI */
101101
gui_process_events(&input.event);
102-
if (gui.quit_flag) response |= USER_QUIT;
103-
if (gui.soft_reset_flag) response |= SOFT_RESET;
102+
if (gui.quit_flag) response |= QUIT;
103+
if (gui.reset_flag) response |= RESET;
104104
if (gui.load_rom_flag) response |= LOAD_ROM;
105105
if (gui.save_profile_flag) response |= SAVE_PROFILE;
106106

shared/input.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ extern "C" {
1313
/* there is a 4 ( and no 3), so each value
1414
can represent a unique bit position */
1515
#define CONTINUE 0
16-
#define USER_QUIT 1
17-
#define SOFT_RESET 2
16+
#define QUIT 1
17+
#define RESET 2
1818
#define LOAD_ROM 4
1919
#define SAVE_PROFILE 8
2020

0 commit comments

Comments
 (0)