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

Commit

Permalink
Merge pull request #134 from OpenStickFoundation/Hori-VLX-display
Browse files Browse the repository at this point in the history
VLX display updates
  • Loading branch information
arntsonl authored Nov 12, 2022
2 parents eea5cb9 + 6cdf701 commit e714d1a
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/addons/i2cdisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ class I2CDisplayAddon : public GPAddon
void drawTwinStickB(int startX, int startY, int buttonSize, int buttonPadding);
void drawBlankA(int startX, int startY, int buttonSize, int buttonPadding);
void drawBlankB(int startX, int startY, int buttonSize, int buttonPadding);
void drawVLXA(int startX, int startY, int buttonRadius, int buttonPadding);
void drawVLXB(int startX, int startY, int buttonRadius, int buttonPadding);
uint8_t ucBackBuffer[1024];
OBDISP obd;
std::string statusBar;
Expand Down
4 changes: 3 additions & 1 deletion include/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ typedef enum
BUTTON_LAYOUT_DANCEPADA,
BUTTON_LAYOUT_TWINSTICKA,
BUTTON_LAYOUT_BLANKA,
BUTTON_LAYOUT_VLXA,
} ButtonLayout;

typedef enum
Expand All @@ -28,7 +29,8 @@ typedef enum
BUTTON_LAYOUT_KEYBOARDB,
BUTTON_LAYOUT_DANCEPADB,
BUTTON_LAYOUT_TWINSTICKB,
BUTTON_LAYOUT_BLANKB
BUTTON_LAYOUT_BLANKB,
BUTTON_LAYOUT_VLXB,
} ButtonLayoutRight;

typedef enum
Expand Down
56 changes: 56 additions & 0 deletions src/addons/i2cdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ void I2CDisplayAddon::process() {
case BUTTON_LAYOUT_BLANKA:
drawBlankA(0, 0, 0, 0);
break;
case BUTTON_LAYOUT_VLXA:
drawVLXA(7, 28, 7, 2);
break;
}

switch (BUTTON_LAYOUT_RIGHT)
Expand Down Expand Up @@ -122,6 +125,9 @@ void I2CDisplayAddon::process() {
case BUTTON_LAYOUT_BLANKB:
drawSticklessButtons(0, 0, 0, 0);
break;
case BUTTON_LAYOUT_VLXB:
drawVLXB(6, 28, 7, 2);
break;
}
}

Expand Down Expand Up @@ -213,6 +219,38 @@ void I2CDisplayAddon::drawArcadeStick(int startX, int startY, int buttonRadius,
}
}

void I2CDisplayAddon::drawVLXA(int startX, int startY, int buttonRadius, int buttonPadding)
{
const int buttonMargin = buttonPadding + (buttonRadius * 2);

// Stick
obdPreciseEllipse(&obd, startX + (buttonMargin / 2), startY + (buttonMargin / 2), buttonRadius * 1.25, buttonRadius * 1.25, 1, 0);

if (pGamepad->pressedUp()) {
if (pGamepad->pressedLeft()) {
obdPreciseEllipse(&obd, startX + (buttonMargin / 5), startY + (buttonMargin / 5), buttonRadius, buttonRadius, 1, 1);
} else if (pGamepad->pressedRight()) {
obdPreciseEllipse(&obd, startX + (buttonMargin * 0.875), startY + (buttonMargin / 5), buttonRadius, buttonRadius, 1, 1);
} else {
obdPreciseEllipse(&obd, startX + (buttonMargin / 2), startY, buttonRadius, buttonRadius, 1, 1);
}
} else if (pGamepad->pressedDown()) {
if (pGamepad->pressedLeft()) {
obdPreciseEllipse(&obd, startX + (buttonMargin / 5), startY + (buttonMargin * 0.875), buttonRadius, buttonRadius, 1, 1);
} else if (pGamepad->pressedRight()) {
obdPreciseEllipse(&obd, startX + (buttonMargin * 0.875), startY + (buttonMargin * 0.875), buttonRadius, buttonRadius, 1, 1);
} else {
obdPreciseEllipse(&obd, startX + buttonMargin / 2, startY + buttonMargin, buttonRadius, buttonRadius, 1, 1);
}
} else if (pGamepad->pressedLeft()) {
obdPreciseEllipse(&obd, startX, startY + buttonMargin / 2, buttonRadius, buttonRadius, 1, 1);
} else if (pGamepad->pressedRight()) {
obdPreciseEllipse(&obd, startX + buttonMargin, startY + buttonMargin / 2, buttonRadius, buttonRadius, 1, 1);
} else {
obdPreciseEllipse(&obd, startX + buttonMargin / 2, startY + buttonMargin / 2, buttonRadius, buttonRadius, 1, 1);
}
}

void I2CDisplayAddon::drawTwinStickA(int startX, int startY, int buttonRadius, int buttonPadding)
{
const int buttonMargin = buttonPadding + (buttonRadius * 2);
Expand Down Expand Up @@ -330,6 +368,24 @@ void I2CDisplayAddon::drawVewlix(int startX, int startY, int buttonRadius, int b
obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75) - (buttonMargin / 3), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, pGamepad->pressedL2());
}

void I2CDisplayAddon::drawVLXB(int startX, int startY, int buttonRadius, int buttonPadding)
{
const int buttonMargin = buttonPadding + (buttonRadius * 2);

// 9-button Hori VLX
obdPreciseEllipse(&obd, startX + (buttonMargin * 2.75), startY + (buttonMargin * 0.2), buttonRadius, buttonRadius, 1, pGamepad->pressedB3());
obdPreciseEllipse(&obd, startX + (buttonMargin * 3.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, pGamepad->pressedB4());
obdPreciseEllipse(&obd, startX + (buttonMargin * 4.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, pGamepad->pressedR1());
obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75), startY - (buttonMargin / 4), buttonRadius, buttonRadius, 1, pGamepad->pressedL1());

obdPreciseEllipse(&obd, startX + (buttonMargin * 2.75) - (buttonMargin / 3), startY + buttonMargin + (buttonMargin * 0.2), buttonRadius, buttonRadius, 1, pGamepad->pressedB1());
obdPreciseEllipse(&obd, startX + (buttonMargin * 3.75) - (buttonMargin / 3), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, pGamepad->pressedB2());
obdPreciseEllipse(&obd, startX + (buttonMargin * 4.75) - (buttonMargin / 3), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, pGamepad->pressedR2());
obdPreciseEllipse(&obd, startX + (buttonMargin * 5.75) - (buttonMargin / 3), startY + buttonMargin - (buttonMargin / 4), buttonRadius, buttonRadius, 1, pGamepad->pressedL2());

obdPreciseEllipse(&obd, startX + (buttonMargin * 7.4) - (buttonMargin / 3.5), startY + buttonMargin - (buttonMargin / 1.5), buttonRadius *.8, buttonRadius * .8, 1, pGamepad->pressedS2());
}

void I2CDisplayAddon::drawVewlix7(int startX, int startY, int buttonRadius, int buttonPadding)
{
const int buttonMargin = buttonPadding + (buttonRadius * 2);
Expand Down
3 changes: 3 additions & 0 deletions src/addons/neopicoleds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,9 @@ std::vector<std::vector<Pixel>> NeoPicoLEDAddon::createLEDLayout(ButtonLayout la

case BUTTON_LAYOUT_BUTTONS_ANGLED:
return generatedLEDWasd(&positions);

case BUTTON_LAYOUT_VLXA:
return generatedLEDButtons(&positions);
}
}

Expand Down

0 comments on commit e714d1a

Please sign in to comment.