Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display Updates and Mini Menu #1254

Merged
merged 29 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
42bae49
Initial commit for mini config menu
mikepparks Dec 1, 2024
fa04c3a
Implemented menu options and prepared methods for save functionality.
mikepparks Dec 12, 2024
60edf8b
Merge branch 'OpenStickCommunity:main' into 20241130-minimenu
mikepparks Dec 12, 2024
5124bf8
Removed stdio init
mikepparks Dec 12, 2024
91a0a70
Merge branch '20241130-minimenu' of github.com:madgooselabs/GP2040-CE…
mikepparks Dec 12, 2024
47ea2ee
Added screen saver mode in addition to display timeout. Default is Di…
mikepparks Dec 22, 2024
7df98c6
Added VLX and Sega 2P 6 button layout variants
mikepparks Dec 31, 2024
049b846
Added menu navigation helper function in prep for event system
mikepparks Jan 1, 2025
1615d1c
Adjustments to Arcade, Button Angled, and Capcom layouts to make them…
mikepparks Jan 2, 2025
000ab0b
Improved screen autodetection and manual override
mikepparks Jan 3, 2025
c6ab860
Adjusting conflicts
mikepparks Jan 3, 2025
f425741
Conflicts part deux
mikepparks Jan 3, 2025
188ffe5
Conflicts with enums
mikepparks Jan 3, 2025
b09492b
One more time with conflicts
mikepparks Jan 3, 2025
9d01b40
Button layout screen conflicts with change between profile banner and…
mikepparks Jan 3, 2025
d6bc68d
Remove profile variables
mikepparks Jan 3, 2025
52cdb54
Merge branch 'main' into 20241130-minimenu
mikepparks Jan 3, 2025
8ccf91c
Merge branch '20241130-minimenu' of github.com:madgooselabs/GP2040-CE…
mikepparks Jan 3, 2025
695a176
Merge branch 'OpenStickCommunity:main' into 20241130-minimenu
mikepparks Jan 4, 2025
c199b9e
Merge branch '20241130-minimenu' of github.com:madgooselabs/GP2040-CE…
mikepparks Jan 4, 2025
582bbe5
Mostly implemented menu navigation, config change storage, and reboot…
mikepparks Jan 8, 2025
ba0503c
Full menu navigation implementation.
mikepparks Jan 13, 2025
7d875b9
Increased storage size to 32k
mikepparks Jan 14, 2025
4b6d633
Added options to disable different components of the status bar on Bu…
mikepparks Jan 14, 2025
14df7fa
Merge branch 'main' into 20241130-minimenu
mikepparks Jan 14, 2025
ba3e459
Remove deprecated input history init
mikepparks Jan 14, 2025
1f9a4b8
Set default Display tab to Hardware
mikepparks Jan 14, 2025
092a370
_Actually_ set default Display tab to Hardware
mikepparks Jan 14, 2025
b218e4c
Adjust bounce velocity
mikepparks Jan 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ src/display/ui/elements/GPWidget.cpp
src/display/ui/elements/GPButton.cpp
src/display/ui/elements/GPLever.cpp
src/display/ui/elements/GPLabel.cpp
src/display/ui/elements/GPMenu.cpp
src/display/ui/elements/GPScreen.cpp
src/display/ui/elements/GPShape.cpp
src/display/ui/elements/GPSprite.cpp
Expand All @@ -196,6 +197,7 @@ src/display/ui/screens/PinViewerScreen.cpp
src/display/ui/screens/RestartScreen.cpp
src/display/ui/screens/StatsScreen.cpp
src/display/ui/screens/SplashScreen.cpp
src/display/ui/screens/DisplaySaverScreen.cpp
src/display/GPGFX.cpp
src/display/GPGFX_UI.cpp
src/drivermanager.cpp
Expand Down
19 changes: 16 additions & 3 deletions headers/addons/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@
#define INPUT_HISTORY_ROW 7
#endif

#ifndef DISPLAY_SAVER_MODE
#define DISPLAY_SAVER_MODE DISPLAY_SAVER_DISPLAY_OFF
#endif

#ifndef DISPLAY_LAYOUT_ORIENTATION
#define DISPLAY_LAYOUT_ORIENTATION BUTTON_ORIENTATION_DEFAULT
#endif

#ifndef DEFAULT_SPLASH
#define DEFAULT_SPLASH \
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, \
Expand Down Expand Up @@ -188,8 +196,9 @@ class DisplayAddon : public GPAddon
virtual std::string name() { return DisplayName; }

void handleSystemRestart(GPEvent* e);
void handleMenuNavigation(GPEvent* e);
private:
bool updateDisplayScreen();
bool updateDisplayScreen();
void drawStatusBar(Gamepad*);
void initMenu(char**);
bool pressedUp();
Expand All @@ -209,11 +218,15 @@ class DisplayAddon : public GPAddon
GPGFX* gpDisplay;
GPScreen* gpScreen;
DisplayMode currDisplayMode;
DisplayMode prevDisplayMode;
DisplayMode prevDisplayMode;
bool turnOffWhenSuspended;
uint32_t bootMode;

GPGFX_DisplayTypeOptions gpOptions;
DisplaySaverMode displaySaverMode;

GPGFX_DisplayTypeOptions gpOptions;

GamepadButtonMapping *mapMenuToggle;
};

#endif
93 changes: 56 additions & 37 deletions headers/buttonlayouts.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,30 @@
{GP_ELEMENT_BTN_BUTTON, {119,33, 5, 5, 1, 1, GAMEPAD_MASK_S2, GP_SHAPE_ELLIPSE}}\
}

#define BUTTON_GROUP_VLXB_6B {\
{GP_ELEMENT_BTN_BUTTON, {50, 31, 7, 7, 1, 1, GAMEPAD_MASK_B3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {66, 24, 7, 7, 1, 1, GAMEPAD_MASK_B4, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {82, 24, 7, 7, 1, 1, GAMEPAD_MASK_R1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {45, 47, 7, 7, 1, 1, GAMEPAD_MASK_B1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {61, 40, 7, 7, 1, 1, GAMEPAD_MASK_B2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {77, 40, 7, 7, 1, 1, GAMEPAD_MASK_R2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {119,33, 5, 5, 1, 1, GAMEPAD_MASK_S2, GP_SHAPE_ELLIPSE}}\
}

#define BUTTON_GROUP_FIGHTBOARD {\
{GP_ELEMENT_BTN_BUTTON, {69, 27, 7, 7, 1, 1, GAMEPAD_MASK_B3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {86, 18, 7, 7, 1, 1, GAMEPAD_MASK_B4, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {103,18, 7, 7, 1, 1, GAMEPAD_MASK_R1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {120,18, 7, 7, 1, 1, GAMEPAD_MASK_L1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {69, 43, 7, 7, 1, 1, GAMEPAD_MASK_B1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {86, 35, 7, 7, 1, 1, GAMEPAD_MASK_B2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {103,35, 7, 7, 1, 1, GAMEPAD_MASK_R2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {120,35, 7, 7, 1, 1, GAMEPAD_MASK_L2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {84, 47, 3, 3, 1, 1, GAMEPAD_MASK_L3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {94, 47, 3, 3, 1, 1, GAMEPAD_MASK_S1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {103,47, 3, 3, 1, 1, GAMEPAD_MASK_A1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {112,47, 3, 3, 1, 1, GAMEPAD_MASK_S2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {122,47, 3, 3, 1, 1, GAMEPAD_MASK_R3, GP_SHAPE_ELLIPSE}}\
{GP_ELEMENT_BTN_BUTTON, {67, 27, 7, 7, 1, 1, GAMEPAD_MASK_B3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {84, 18, 7, 7, 1, 1, GAMEPAD_MASK_B4, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {101,18, 7, 7, 1, 1, GAMEPAD_MASK_R1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {118,18, 7, 7, 1, 1, GAMEPAD_MASK_L1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {67, 43, 7, 7, 1, 1, GAMEPAD_MASK_B1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {84, 35, 7, 7, 1, 1, GAMEPAD_MASK_B2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {101,35, 7, 7, 1, 1, GAMEPAD_MASK_R2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {118,35, 7, 7, 1, 1, GAMEPAD_MASK_L2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {82, 47, 3, 3, 1, 1, GAMEPAD_MASK_L3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {92, 47, 3, 3, 1, 1, GAMEPAD_MASK_S1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {101,47, 3, 3, 1, 1, GAMEPAD_MASK_A1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {110,47, 3, 3, 1, 1, GAMEPAD_MASK_S2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {120,47, 3, 3, 1, 1, GAMEPAD_MASK_R3, GP_SHAPE_ELLIPSE}}\
}

#define BUTTON_GROUP_VEWLIX7 {\
Expand All @@ -166,6 +176,15 @@
{GP_ELEMENT_BTN_BUTTON, {111,46, 8, 8, 1, 1, GAMEPAD_MASK_L2, GP_SHAPE_ELLIPSE}}\
}

#define BUTTON_GROUP_SEGA_2P_6B {\
{GP_ELEMENT_BTN_BUTTON, {57, 34, 8, 8, 1, 1, GAMEPAD_MASK_B3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {75, 24, 8, 8, 1, 1, GAMEPAD_MASK_B4, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {93, 24, 8, 8, 1, 1, GAMEPAD_MASK_R1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {57, 52, 8, 8, 1, 1, GAMEPAD_MASK_B1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {75, 42, 8, 8, 1, 1, GAMEPAD_MASK_B2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {93, 42, 8, 8, 1, 1, GAMEPAD_MASK_R2, GP_SHAPE_ELLIPSE}}\
}

#define BUTTON_GROUP_NOIR8 {\
{GP_ELEMENT_BTN_BUTTON, {57, 33, 8, 8, 1, 1, GAMEPAD_MASK_B3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {75, 24, 8, 8, 1, 1, GAMEPAD_MASK_B4, GP_SHAPE_ELLIPSE}},\
Expand All @@ -178,14 +197,14 @@
}

#define BUTTON_GROUP_CAPCOM {\
{GP_ELEMENT_BTN_BUTTON, {64, 28, 8, 8, 1, 1, GAMEPAD_MASK_B3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {82, 28, 8, 8, 1, 1, GAMEPAD_MASK_B4, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {100,28, 8, 8, 1, 1, GAMEPAD_MASK_R1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {118,28, 8, 8, 1, 1, GAMEPAD_MASK_L1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {64, 46, 8, 8, 1, 1, GAMEPAD_MASK_B1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {82, 46, 8, 8, 1, 1, GAMEPAD_MASK_B2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {100,46, 8, 8, 1, 1, GAMEPAD_MASK_R2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {118,46, 8, 8, 1, 1, GAMEPAD_MASK_L2, GP_SHAPE_ELLIPSE}}\
{GP_ELEMENT_BTN_BUTTON, {62, 28, 8, 8, 1, 1, GAMEPAD_MASK_B3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {80, 28, 8, 8, 1, 1, GAMEPAD_MASK_B4, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {98, 28, 8, 8, 1, 1, GAMEPAD_MASK_R1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {116,28, 8, 8, 1, 1, GAMEPAD_MASK_L1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {62, 46, 8, 8, 1, 1, GAMEPAD_MASK_B1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {80, 46, 8, 8, 1, 1, GAMEPAD_MASK_B2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {98, 46, 8, 8, 1, 1, GAMEPAD_MASK_R2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {116,46, 8, 8, 1, 1, GAMEPAD_MASK_L2, GP_SHAPE_ELLIPSE}}\
}

#define BUTTON_GROUP_CAPCOM6 {\
Expand All @@ -209,25 +228,25 @@
}

#define BUTTON_GROUP_WASD_BUTTONS {\
{GP_ELEMENT_BTN_BUTTON, {69, 28, 7, 7, 1, 1, GAMEPAD_MASK_B3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {86, 24, 7, 7, 1, 1, GAMEPAD_MASK_B4, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {103,24, 7, 7, 1, 1, GAMEPAD_MASK_R1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {120,28, 7, 7, 1, 1, GAMEPAD_MASK_L1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {63, 45, 7, 7, 1, 1, GAMEPAD_MASK_B1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {80, 41, 7, 7, 1, 1, GAMEPAD_MASK_B2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {97, 41, 7, 7, 1, 1, GAMEPAD_MASK_R2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {114,45, 7, 7, 1, 1, GAMEPAD_MASK_L2, GP_SHAPE_ELLIPSE}}\
{GP_ELEMENT_BTN_BUTTON, {67, 28, 7, 7, 1, 1, GAMEPAD_MASK_B3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {84, 24, 7, 7, 1, 1, GAMEPAD_MASK_B4, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {101,24, 7, 7, 1, 1, GAMEPAD_MASK_R1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {118,28, 7, 7, 1, 1, GAMEPAD_MASK_L1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {61, 45, 7, 7, 1, 1, GAMEPAD_MASK_B1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {78, 41, 7, 7, 1, 1, GAMEPAD_MASK_B2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {95, 41, 7, 7, 1, 1, GAMEPAD_MASK_R2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {112,45, 7, 7, 1, 1, GAMEPAD_MASK_L2, GP_SHAPE_ELLIPSE}}\
}

#define BUTTON_GROUP_ARCADE_BUTTONS {\
{GP_ELEMENT_BTN_BUTTON, {64, 28, 8, 8, 1, 1, GAMEPAD_MASK_B3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {82, 24, 8, 8, 1, 1, GAMEPAD_MASK_B4, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {100,24, 8, 8, 1, 1, GAMEPAD_MASK_R1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {118,28, 8, 8, 1, 1, GAMEPAD_MASK_L1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {59, 46, 8, 8, 1, 1, GAMEPAD_MASK_B1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {77, 42, 8, 8, 1, 1, GAMEPAD_MASK_B2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {95, 42, 8, 8, 1, 1, GAMEPAD_MASK_R2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {113,46, 8, 8, 1, 1, GAMEPAD_MASK_L2, GP_SHAPE_ELLIPSE}}\
{GP_ELEMENT_BTN_BUTTON, {62, 28, 8, 8, 1, 1, GAMEPAD_MASK_B3, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {80, 24, 8, 8, 1, 1, GAMEPAD_MASK_B4, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {98, 24, 8, 8, 1, 1, GAMEPAD_MASK_R1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {116,28, 8, 8, 1, 1, GAMEPAD_MASK_L1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {57, 46, 8, 8, 1, 1, GAMEPAD_MASK_B1, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {75, 42, 8, 8, 1, 1, GAMEPAD_MASK_B2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {93, 42, 8, 8, 1, 1, GAMEPAD_MASK_R2, GP_SHAPE_ELLIPSE}},\
{GP_ELEMENT_BTN_BUTTON, {111,46, 8, 8, 1, 1, GAMEPAD_MASK_L2, GP_SHAPE_ELLIPSE}}\
}

#define BUTTON_GROUP_STICKLESS13A {\
Expand Down
7 changes: 5 additions & 2 deletions headers/display/GPGFX.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,27 @@ class GPGFX {

void init(GPGFX_DisplayTypeOptions options);

GPGFX_DisplayTypeOptions getAvailableDisplay();
GPGFX_DisplayTypeOptions getAvailableDisplay(GPGFX_DisplayType displayType);

GPGFX_DisplayBase* getDriver() { return displayDriver; }

// drawing methods
void clearScreen();
void render();

uint32_t getPixel(uint16_t x, uint16_t y);
void drawPixel(uint16_t x, uint16_t y, uint32_t color);
void drawText(uint16_t x, uint16_t y, std::string text, uint8_t invert = 0);
void drawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint32_t color, uint8_t filled);
void drawArc(uint16_t x, uint16_t y, uint32_t radiusX, uint32_t radiusY, uint32_t color, uint8_t filled, double startAngle, double endAngle, uint8_t closed);
void drawEllipse(uint16_t x, uint16_t y, uint32_t radiusX, uint32_t radiusY, uint32_t color, uint8_t filled);
void drawRectangle(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint32_t color, uint8_t filled, double rotationAngle = 0);
void drawPolygon(uint16_t x, uint16_t y, uint16_t radius, uint16_t sides, uint32_t color, uint8_t filled, double rotation = 0);
void drawSprite(uint8_t* spriteData, uint16_t width, uint16_t height, uint16_t pitch, uint16_t x, uint16_t y, uint8_t priority);
void drawSprite(uint8_t* spriteData, uint16_t width, uint16_t height, uint16_t pitch, uint16_t x, uint16_t y, uint8_t priority, double scale = 1.0);
private:
GPGFX_DisplayBase* displayDriver = nullptr;

bool detectDisplay(GPGFX_DisplayTypeOptions* display, GPGFX_DisplayType displayType);
};

#endif
2 changes: 2 additions & 0 deletions headers/display/GPGFX_UI_screens.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ enum DisplayMode {
BUTTONS,
SPLASH,
PIN_VIEWER,
DISPLAY_SAVER,
STATS,
MAIN_MENU,
RESTART
};

#include "ui/screens/ButtonLayoutScreen.h"
#include "ui/screens/ConfigScreen.h"
#include "ui/screens/DisplaySaverScreen.h"
#include "ui/screens/MainMenuScreen.h"
#include "ui/screens/PinViewerScreen.h"
#include "ui/screens/RestartScreen.h"
Expand Down
5 changes: 4 additions & 1 deletion headers/display/GPGFX_UI_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
#include <functional>
#include <vector>

typedef struct {
typedef struct MenuEntry {
std::string label;
uint8_t* icon;
std::vector<MenuEntry>* submenu;
std::function<int32_t()> currentValue;
std::function<void()> action;
int32_t optionValue = -1;
} MenuEntry;

typedef struct {
Expand Down
1 change: 1 addition & 0 deletions headers/display/GPGFX_UI_widgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "ui/elements/GPScreen.h"
#include "ui/elements/GPShape.h"
#include "ui/elements/GPSprite.h"
#include "ui/elements/GPMenu.h"

#include "GPGFX_UI_screens.h"

Expand Down
2 changes: 1 addition & 1 deletion headers/display/ui/elements/GPButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class GPButton : public GPWidget {
double _angle = 0;
double _angleEnd = 0;
bool _closed = false;
int16_t _inputMask = -1;
int32_t _inputMask = -1;
bool _inputDirection = false;
GPElement _inputType = GP_ELEMENT_BTN_BUTTON;
GPShape_Type _shape = GP_SHAPE_ELLIPSE;
Expand Down
31 changes: 31 additions & 0 deletions headers/display/ui/elements/GPMenu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#ifndef _GPMENU_H_
#define _GPMENU_H_

#include "GPWidget.h"
#include "GPShape.h"
#include "GPGFX_UI_types.h"

class GPMenu : public GPShape {
public:
void draw();
GPMenu* setMenuSize(uint16_t sizeX, uint16_t sizeY) { this->menuSizeX = sizeX; this->menuSizeY = sizeY; return this; }

uint16_t getDataSize() { return this->menuEntryData->size(); };

void setIndex(uint16_t pos) { this->menuIndex = pos; };
uint16_t getIndex() { return this->menuIndex; };

void setMenuData(std::vector<MenuEntry>* menu) { this->menuEntryData = menu; };
void setMenuTitle(std::string title) { this->menuTitle = title; };
private:
uint16_t menuSizeX = 0;
uint16_t menuSizeY = 0;

uint16_t menuLines = 15;
uint16_t menuIndex = 0;

std::vector<MenuEntry>* menuEntryData;
std::string menuTitle;
};

#endif
4 changes: 4 additions & 0 deletions headers/display/ui/elements/GPWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class GPWidget : public GPGFX_UI {

double getScaleX() { return ((double)(this->getViewport().right - this->getViewport().left) / (double)(getRenderer()->getDriver()->getMetrics()->width)); }
double getScaleY() { return ((double)(this->getViewport().bottom - this->getViewport().top) / (double)(getRenderer()->getDriver()->getMetrics()->height)); }

void setVisibility(bool visible) { this->_visibility = visible; }
bool getVisibility() { return this->_visibility; }
protected:
uint16_t x = 0;
uint16_t y = 0;
Expand All @@ -36,6 +39,7 @@ class GPWidget : public GPGFX_UI {
uint16_t fillColor = 0;
uint16_t _ID;
uint16_t _priority = 0;
bool _visibility = true;

GPViewport _viewport;
};
Expand Down
14 changes: 13 additions & 1 deletion headers/display/ui/screens/ButtonLayoutScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#include <deque>
#include <array>
#include <functional>
#include <algorithm>
#include <cctype>
#include <locale>
#include "layoutmanager.h"
#include "GPGFX_UI_widgets.h"
#include "GPGFX_UI_layouts.h"
Expand Down Expand Up @@ -158,9 +161,18 @@ class ButtonLayoutScreen : public GPScreen {
uint8_t prevProfileNumber = 0;
ButtonLayoutParamsLeft prevLeftOptions;
ButtonLayoutParamsRight prevRightOptions;

ButtonLayoutOrientation prevOrientation;

bool macroEnabled;

bool showInputMode = true;
bool showTurboMode = true;
bool showDpadMode = true;
bool showSocdMode = true;
bool showMacroMode = true;
bool showProfileMode = false;
void trim(std::string &s);

uint16_t map(uint16_t x, uint16_t in_min, uint16_t in_max, uint16_t out_min, uint16_t out_max);
void processInputHistory();
bool compareCustomLayouts();
Expand Down
Loading