layout 2+1

This commit is contained in:
3djc
2021-04-06 10:29:01 +02:00
parent 2f1a5f6c95
commit d43242f686
2 changed files with 25 additions and 8 deletions
+6
View File
@@ -270,5 +270,11 @@ rect_t Layout::getMainZone(rect_t zone) const
zone.x += TRIM_SQUARE_SIZE; zone.x += TRIM_SQUARE_SIZE;
} }
if (zone.w % 2 != 0)
zone.w -= 1;
if (zone.h % 2 != 0)
zone.h -= 1;
return zone; return zone;
} }
+19 -8
View File
@@ -28,6 +28,8 @@
#define HAS_TRIMS() (persistentData->options[3].value.boolValue == true) #define HAS_TRIMS() (persistentData->options[3].value.boolValue == true)
#define IS_MIRRORED() (persistentData->options[4].value.boolValue == true) #define IS_MIRRORED() (persistentData->options[4].value.boolValue == true)
constexpr coord_t border = 10;
const uint8_t LBM_LAYOUT_2P1[] = { const uint8_t LBM_LAYOUT_2P1[] = {
#include "mask_layout2+1.lbm" #include "mask_layout2+1.lbm"
}; };
@@ -37,12 +39,6 @@ const ZoneOption OPTIONS_LAYOUT_2P1[] = {
LAYOUT_OPTIONS_END LAYOUT_OPTIONS_END
}; };
const rect_t ZONES_LAYOUT_2P1[3] = {
{ 240, 60, 192, 152 },
{ 48, 60, 180, 70 },
{ 48, 142, 180, 70 }
};
class Layout2P1: public Layout class Layout2P1: public Layout
{ {
public: public:
@@ -65,12 +61,27 @@ class Layout2P1: public Layout
unsigned int getZonesCount() const override unsigned int getZonesCount() const override
{ {
return DIM(ZONES_LAYOUT_2P1); return 3;
} }
rect_t getZone(unsigned int index) const override rect_t getZone(unsigned int index) const override
{ {
return ZONES_LAYOUT_2P1[index]; if (IS_MIRRORED())
index = 2 - index;
rect_t zone = getMainZone({border, border, LCD_W - 2 * border, LCD_H - 2 * border});
if (index == 0) {
return {zone.x, zone.y,zone.w / 2, zone.h};
}
else if (index == 1) {
return {zone.x + zone.w / 2, zone.y,zone.w / 2, zone.h / 2};
}
else {
return {zone.x + zone.w / 2, zone.y + zone.h / 2,zone.w / 2, zone.h / 2};
}
return zone;
} }
}; };