Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
DDR
Browse files Browse the repository at this point in the history
BUTTON_LAYOUT_DANCEPADA and BUTTON_LAYOUT_DANCEPADB are back!
  • Loading branch information
UntrustedRoot committed Aug 14, 2022
1 parent 98ea4eb commit 608de80
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/addons/i2cdisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ class I2CDisplayAddon : public GPAddon
void drawWasdButtons(int startX, int startY, int buttonRadius, int buttonPadding);
void drawArcadeButtons(int startX, int startY, int buttonRadius, int buttonPadding);
void drawSplashScreen(int splashMode, int splashSpeed);
void drawDancepadA(int startX, int startY, int buttonSize, int buttonPadding);
void drawDancepadB(int startX, int startY, int buttonSize, int buttonPadding);
uint8_t ucBackBuffer[1024];
OBDISP obd;
std::string statusBar;
Expand Down
2 changes: 2 additions & 0 deletions include/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ typedef enum
BUTTON_LAYOUT_UDLR,
BUTTON_LAYOUT_MIXBOX,
BUTTON_LAYOUT_MAMEA,
BUTTON_LAYOUT_DANCEPADA,
} ButtonLayout;

typedef enum
Expand All @@ -23,6 +24,7 @@ typedef enum
BUTTON_LAYOUT_SEGA2P,
BUTTON_LAYOUT_NOIR8,
BUTTON_LAYOUT_MAMEB,
BUTTON_LAYOUT_DANCEPADB,
} ButtonLayoutRight;

typedef enum
Expand Down
31 changes: 31 additions & 0 deletions src/addons/i2cdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ void I2CDisplayAddon::process() {
case BUTTON_LAYOUT_MAMEA:
drawMAMEA(8, 28, 10, 1);
break;
case BUTTON_LAYOUT_DANCEPADA:
drawDancepadA(39, 12, 15, 2);
break;
}

switch (BUTTON_LAYOUT_RIGHT)
Expand Down Expand Up @@ -100,6 +103,9 @@ void I2CDisplayAddon::process() {
case BUTTON_LAYOUT_MAMEB:
drawMAMEB(68, 28, 10, 1);
break;
case BUTTON_LAYOUT_DANCEPADB:
drawDancepadB(39, 12, 15, 2);
break;
}
}

Expand Down Expand Up @@ -456,6 +462,31 @@ void I2CDisplayAddon::drawArcadeButtons(int startX, int startY, int buttonRadius
obdPreciseEllipse(&obd, startX + buttonMargin * 5.875, startY + buttonMargin, buttonRadius, buttonRadius, 1, gamepad->pressedL2());
}

// I pulled this out of my PR, brought it back because of recent talks re: SOCD and rhythm games
// Enjoy!

void I2CDisplayAddon::drawDancepadA(int startX, int startY, int buttonSize, int buttonPadding)
{
Gamepad * gamepad = Storage::getInstance().GetGamepad();
const int buttonMargin = buttonPadding + buttonSize;

obdRectangle(&obd, startX, startY + buttonMargin, startX + buttonSize, startY + buttonSize + buttonMargin, 1, gamepad->pressedLeft());
obdRectangle(&obd, startX + buttonMargin, startY + buttonMargin * 2, startX + buttonSize + buttonMargin, startY + buttonSize + buttonMargin * 2, 1, gamepad->pressedDown());
obdRectangle(&obd, startX + buttonMargin, startY, startX + buttonSize + buttonMargin, startY + buttonSize, 1, gamepad->pressedUp());
obdRectangle(&obd, startX + buttonMargin * 2, startY + buttonMargin, startX + buttonSize + buttonMargin * 2, startY + buttonSize + buttonMargin, 1, gamepad->pressedRight());
}

void I2CDisplayAddon::drawDancepadB(int startX, int startY, int buttonSize, int buttonPadding)
{
Gamepad * gamepad = Storage::getInstance().GetGamepad();
const int buttonMargin = buttonPadding + buttonSize;

obdRectangle(&obd, startX, startY, startX + buttonSize, startY + buttonSize, 1, gamepad->pressedB2()); // Up/Left
obdRectangle(&obd, startX, startY + buttonMargin * 2, startX + buttonSize, startY + buttonSize + buttonMargin * 2, 1, gamepad->pressedB4()); // Down/Left
obdRectangle(&obd, startX + buttonMargin * 2, startY, startX + buttonSize + buttonMargin * 2, startY + buttonSize, 1, gamepad->pressedB1()); // Up/Right
obdRectangle(&obd, startX + buttonMargin * 2, startY + buttonMargin * 2, startX + buttonSize + buttonMargin * 2, startY + buttonSize + buttonMargin * 2, 1, gamepad->pressedB3()); // Down/Right
}

void I2CDisplayAddon::drawSplashScreen(int splashMode, int splashSpeed)
{
int mils = getMillis();
Expand Down

0 comments on commit 608de80

Please sign in to comment.