forked from trash80/mGB
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extracts and consolidates screen code
- Extracts main screen, splash screen and screen.c for common untils - getPad has global controls, and then hands off to screen controls so that we may have screen specific controls/tables/layout - Each screen can have an init, show, render and getPad handler for relevant phases - Uses some enums
- Loading branch information
Showing
14 changed files
with
318 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include "pad.h" | ||
#include "../mGB.h" | ||
#include "../screen/main.h" | ||
#include "../screen/screen.h" | ||
#include "../synth/common.h" | ||
#include "../synth/pulse.h" | ||
#include "../synth/wav.h" | ||
|
||
uint8_t joyState; | ||
|
||
// moved the main pad handler out, split into screen level handlers | ||
// Before: 1770/1628 clock cycles, 379 bytes | ||
// After: getPad: 194 clock cycles, 46 bytes | ||
// getPadMainScreen: 418/387 clock cycles, 97 bytes | ||
// = 612/581, 143 bytes | ||
void getPad(void) { | ||
i = joypad(); | ||
if (i != joyState) { | ||
joyState = i; | ||
|
||
if ((i & J_A) && (i & J_SELECT)) { | ||
toggleScreen(); | ||
return; | ||
} | ||
|
||
if (i == J_START) { | ||
stopAllSynths(); | ||
return; | ||
} | ||
|
||
switch (currentScreen) { | ||
case SCREEN_MAIN: | ||
getPadMainScreen(); | ||
break; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#pragma once | ||
|
||
#include <gbdk/platform.h> | ||
|
||
extern uint8_t joyState; | ||
|
||
void getPad(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.