Skip to content

Commit

Permalink
#229 theme builder did not copy icons
Browse files Browse the repository at this point in the history
  • Loading branch information
davetcc committed Aug 26, 2024
1 parent 402a49f commit 44ef11c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/graphics/GraphicsDeviceRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ namespace tcgfx {
void GraphicsDeviceRenderer::enableCardLayout(const DrawableIcon& left, const DrawableIcon& right, MenuTouchScreenManager* touchScreenManager, bool monoDisplay) {
if(cardLayoutPane == nullptr) {
cardLayoutPane = new CardLayoutPane(&left, &right, touchScreenManager, monoDisplay);
} else {
serlogF(SER_TCMENU_INFO, "Card already init");
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/graphics/TcThemeBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,9 @@ ThemePropertiesBuilder &TcThemeBuilder::menuItemOverride(MenuItem &item) {
}

TcThemeBuilder& TcThemeBuilder::enableCardLayoutWithXbmImages(Coord iconSize, const uint8_t *leftIcon, const uint8_t *rightIcon, bool isMono) {
renderer.enableCardLayout(
DrawableIcon(-1, iconSize, tcgfx::DrawableIcon::ICON_XBITMAP, leftIcon, nullptr),
DrawableIcon(-1, iconSize, tcgfx::DrawableIcon::ICON_XBITMAP, rightIcon, nullptr),
nullptr, isMono);
auto left = new DrawableIcon(-1, iconSize, tcgfx::DrawableIcon::ICON_XBITMAP, leftIcon, nullptr);
auto right = new DrawableIcon(-1, iconSize, tcgfx::DrawableIcon::ICON_XBITMAP, rightIcon, nullptr);
renderer.enableCardLayout(*left, *right, nullptr, isMono);
return *this;
}

Expand Down Expand Up @@ -137,3 +136,4 @@ TcThemeBuilder& TcThemeBuilder::manualDimensions(int x, int y) {
renderer.setDisplayDimensions(x, y);
return *this;
}

4 changes: 2 additions & 2 deletions src/graphics/TcThemeBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace tcgfx {
* @param mag the magnification value
* @return reference to itself for chaining
*/
ThemePropertiesBuilder& withNativeFont(void* data, uint8_t mag) {
ThemePropertiesBuilder& withNativeFont(const void* data, uint8_t mag) {
fontData = data;
fontMag = mag;
needsProps();
Expand Down Expand Up @@ -349,7 +349,7 @@ namespace tcgfx {
* @param mag the native mag value
* @return reference to itself for chaining
*/
TcThemeBuilder& withNativeFont(void* data, uint8_t mag) {
TcThemeBuilder& withNativeFont(const void* data, uint8_t mag) {
fontData = data;
fontMag = mag;
return *this;
Expand Down

0 comments on commit 44ef11c

Please sign in to comment.