Skip to content

Commit

Permalink
[Input] Renamed Joystick_GetDirectionPushed to Joystick_GetDirectionC…
Browse files Browse the repository at this point in the history
…hange and changed return value when direction didn't changed (JOY_INPUT_DIR_UNCHANGED)
  • Loading branch information
aoineko-fr committed Aug 24, 2022
1 parent 62272be commit 5dce16c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions engine/src/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#define JOY_INPUT_DIR_DOWN_RIGHT (JOY_INPUT_DIR_DOWN + JOY_INPUT_DIR_RIGHT)
#define JOY_INPUT_DIR_DOWN_LEFT (JOY_INPUT_DIR_DOWN + JOY_INPUT_DIR_LEFT)
#define JOY_INPUT_DIR_MASK 0x0F
#define JOY_INPUT_DIR_UNCHANGED 0xFF
#define JOY_INPUT_TRIGGER_A (1 << 4)
#define JOY_INPUT_TRIGGER_B (1 << 5)

Expand Down Expand Up @@ -91,7 +92,7 @@ void Joystick_Update();
// : JOY_INPUT_DIR_RIGHT
inline u8 Joystick_GetDirection(u8 port) { return g_JoyStats[port >> 6] & JOY_INPUT_DIR_MASK; }

// Function: Joystick_GetDirectionPushed
// Function: Joystick_GetDirectionChange
// Get current direction of the given joystick if different from previous one
// Only available if INPUT_JOY_UPDATE is TRUE.
//
Expand All @@ -105,12 +106,13 @@ inline u8 Joystick_GetDirection(u8 port) { return g_JoyStats[port >> 6] & JOY_IN
// : JOY_INPUT_DIR_DOWN
// : JOY_INPUT_DIR_LEFT
// : JOY_INPUT_DIR_RIGHT
inline u8 Joystick_GetDirectionPushed(u8 port)
// : JOY_INPUT_DIR_UNCHANGED
inline u8 Joystick_GetDirectionChange(u8 port)
{
u8 in = g_JoyStats[port >> 6] & JOY_INPUT_DIR_MASK;
u8 prev = g_JoyStatsPrev[port >> 6] & JOY_INPUT_DIR_MASK;
if(in == prev)
in = JOY_INPUT_DIR_NONE;
in = JOY_INPUT_DIR_UNCHANGED;
return in;
}

Expand Down
4 changes: 2 additions & 2 deletions projects/samples/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ goto :CheckInput
::*****************************************************************************
:: TOOLS SETTINGS
::*****************************************************************************
REM set Emulator=%ToolsDir%\OpenMSX\openmsx.exe
set Emulator=%ToolsDir%\OpenMSX\openmsx.exe
REM set Emulator=%ToolsDir%\Emulicious\Emulicious.exe
REM set Emulator=%ToolsDir%\BlueMSX\blueMSX.exe
REM set Emulator=%ToolsDir%\MEISEI\meisei.exe
Expand Down Expand Up @@ -163,7 +163,7 @@ set DoCompile=1
set DoMake=1
set DoPackage=1
set DoDeploy=1
set DoRun=0
set DoRun=1

::*****************************************************************************
:: START BUILD
Expand Down
8 changes: 4 additions & 4 deletions tools/MSXtk/MSXbin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,13 @@ i32 Export()
if (g_Decoration)
{
AddComment(strData, u8"_____________________________________________________________________________");
AddComment(strData, u8"▄ ▄ ▄ ▄▄▄ ▄▄ ▄ ▄▄ ▄");
AddComment(strData, u8" ██ ▀ ██▀█ ▀█▄ ▀█▄▀ ██▄ ▄ ██▀▄");
AddComment(strData, u8" ▀█▄▀ ██ █ ▄▄█▀ ██ █ ██▄▀ ██ ██ █");
AddComment(strData, u8" ▄ ▄ ▄▄▄ ▄▄ ▄ ▄▄ ▄");
AddComment(strData, u8" ██▀█ ▀█▄ ▀█▄▀ ██▄ ▄ ██▀▄");
AddComment(strData, u8" ██ █ ▄▄█▀ ██ █ ██▄▀ ██ ██ █");
AddComment(strData, u8"_____________________________________________________________________________");
}
// License
AddComment(strData, StringFormat("MSXbin %s by Guillaume \"Aoineko\" Blanchard (2021) under CC BY-SA free license", VERSION));
AddComment(strData, StringFormat("MSXbin %s by Guillaume \"Aoineko\" Blanchard (2022) under CC BY-SA free license", VERSION));
// Date
std::time_t result = std::time(nullptr);
char* ltime = std::asctime(std::localtime(&result));
Expand Down

0 comments on commit 5dce16c

Please sign in to comment.