@@ -198,7 +198,7 @@ void CGameMixin::drawFont6x6(CFrame &bitmap, int x, int y, const char *text, con
198198 * @param color color
199199 * @param fill fill ?
200200 */
201- void CGameMixin::drawRect (CFrame &frame, const Rect &rect, const Color color, bool fill)
201+ void CGameMixin::drawRect (CFrame &frame, const rect_t &rect, const Color color, bool fill)
202202{
203203 uint32_t *rgba = frame.getRGB ().data ();
204204 const int rowPixels = frame.width ();
@@ -239,7 +239,7 @@ void CGameMixin::drawRect(CFrame &frame, const Rect &rect, const Color color, bo
239239 * @param colorMap
240240 */
241241
242- void CGameMixin::drawTile (CFrame &bitmap, const int x, const int y, CFrame &tile, const Rect &rect, const ColorMask colorMask, std::unordered_map<uint32_t , uint32_t > *colorMap)
242+ void CGameMixin::drawTile (CFrame &bitmap, const int x, const int y, CFrame &tile, const rect_t &rect, const ColorMask colorMask, std::unordered_map<uint32_t , uint32_t > *colorMap)
243243{
244244 const int width = bitmap.width ();
245245 uint32_t *dest = bitmap.getRGB ().data () + x + y * width;
@@ -506,8 +506,8 @@ void CGameMixin::drawScreen(CFrame &bitmap)
506506 const Color rectBorder = isPlayerHurt ? PINK
507507 : visualcues.livesShimmer ? GREEN
508508 : LIGHTGRAY;
509- drawRect (bitmap, Rect {0 , bitmap.height () - 16 , getWidth (), TILE_SIZE}, rectBG, true );
510- drawRect (bitmap, Rect {0 , bitmap.height () - 16 , getWidth (), TILE_SIZE}, rectBorder, false );
509+ drawRect (bitmap, rect_t {0 , bitmap.height () - 16 , getWidth (), TILE_SIZE}, rectBG, true );
510+ drawRect (bitmap, rect_t {0 , bitmap.height () - 16 , getWidth (), TILE_SIZE}, rectBorder, false );
511511 }
512512
513513 // draw current event text
@@ -539,7 +539,7 @@ void CGameMixin::drawScroll(CFrame &bitmap)
539539 constexpr int scrollHeight = 48 ;
540540 constexpr int partWidth = 16 ;
541541 const int y = bitmap.height () - scrollHeight;
542- constexpr Rect rect{0 , 0 , partWidth, scrollHeight};
542+ constexpr rect_t rect{0 , 0 , partWidth, scrollHeight};
543543 drawTile (bitmap, 0 , y, *sheet[SCROLL_LEFT], rect);
544544 for (int x = partWidth; x < bitmap.width () - partWidth; x += partWidth)
545545 drawTile (bitmap, x, y, *sheet[SCROLL_MID], rect);
@@ -727,7 +727,7 @@ void CGameMixin::drawViewPortDynamic(CFrame &bitmap)
727727 {
728728 if (firstX || firstY || lastX || lastY)
729729 {
730- Rect rect{
730+ rect_t rect{
731731 .x = !firstX ? 0 : halfOffset,
732732 .y = !firstY ? 0 : halfOffset,
733733 .width = !(firstX || lastX) ? tileSize : halfOffset,
@@ -772,7 +772,7 @@ void CGameMixin::drawViewPortDynamic(CFrame &bitmap)
772772
773773 if (firstX || firstY || lastX || lastY)
774774 {
775- Rect rect{
775+ rect_t rect{
776776 .x = !firstX ? 0 : halfOffset,
777777 .y = !firstY ? 0 : halfOffset,
778778 .width = !(firstX || lastX) ? tileSize : halfOffset,
@@ -853,7 +853,7 @@ void CGameMixin::drawBossses(CFrame &bitmap, const int mx, const int my, const i
853853 return a1 < b2 && a2 > b1;
854854 };
855855
856- auto betweenRect = [&between](const Rect &bRect, const Rect &sRect )
856+ auto betweenRect = [&between](const rect_t &bRect, const rect_t &sRect )
857857 {
858858 return between (bRect.x , bRect.x + bRect.width , sRect .x , sRect .x + sRect .width ) &&
859859 between (bRect.y , bRect.y + bRect.height , sRect .y , sRect .y + sRect .height );
@@ -868,7 +868,7 @@ void CGameMixin::drawBossses(CFrame &bitmap, const int mx, const int my, const i
868868 return _wu;
869869 };
870870
871- auto printRect = [](const Rect &rect, const std::string_view &name)
871+ auto printRect = [](const rect_t &rect, const std::string_view &name)
872872 {
873873 LOGI (" %s (%d, %d) w:%d h: %d" , name.data (), rect.x , rect.y , rect.width , rect.height );
874874 };
@@ -910,15 +910,15 @@ void CGameMixin::drawBossses(CFrame &bitmap, const int mx, const int my, const i
910910 // (using GRID_SIZE)
911911
912912 // Boss Rect
913- const Rect bRect{
913+ const rect_t bRect{
914914 GRID_SIZE * (boss.x () - hitbox.x ),
915915 GRID_SIZE * (boss.y () - hitbox.y ),
916916 frame.width (),
917917 frame.height (),
918918 };
919919
920920 // Screen Rect
921- const Rect sRect {
921+ const rect_t sRect {
922922 .x = GRID_SIZE * mx,
923923 .y = GRID_SIZE * my,
924924 .width = GRID_SIZE * sx,
@@ -929,7 +929,7 @@ void CGameMixin::drawBossses(CFrame &bitmap, const int mx, const int my, const i
929929 {
930930 const int x = bRect.x - sRect .x ;
931931 const int y = bRect.y - sRect .y ;
932- const Rect rect{
932+ const rect_t rect{
933933 .x = x < 0 ? std::abs (x) : 0 ,
934934 .y = y < 0 ? std::abs (y) : 0 ,
935935 .width = calcSize (x, bRect.width , sRect .width ),
@@ -949,7 +949,7 @@ void CGameMixin::drawBossses(CFrame &bitmap, const int mx, const int my, const i
949949
950950 // Hp Rect
951951 const float hpRatio = (float )boss.maxHp () / MAX_HP_GAUGE;
952- const Rect hRect{
952+ const rect_t hRect{
953953 .x = bRect.x ,
954954 .y = bRect.y - HP_BAR_HEIGHT - HP_BAR_SPACING,
955955 .width = MAX_HP_GAUGE, // boss.maxHp(),
@@ -959,13 +959,13 @@ void CGameMixin::drawBossses(CFrame &bitmap, const int mx, const int my, const i
959959 {
960960 const int x = hRect.x - sRect .x ;
961961 const int y = hRect.y - sRect .y ;
962- const Rect rectFullHp{
962+ const rect_t rectFullHp{
963963 .x = std::max (0 , x),
964964 .y = std::max (0 , y),
965965 .width = calcSize (x, hRect.width , sRect .width ),
966966 .height = calcSize (y, hRect.height , sRect .height ),
967967 };
968- const Rect rectHp{
968+ const rect_t rectHp{
969969 .x = std::max (0 , x),
970970 .y = std::max (0 , y),
971971 .width = calcSize (x, static_cast <int >(boss.hp () / hpRatio), sRect .width ),
@@ -2264,7 +2264,7 @@ void CGameMixin::drawSugarMeter(CFrame &bitmap, const int bx)
22642264 m_visualStates.rSugar = sugar;
22652265 for (int i = 0 ; i < (int )CGame::MAX_SUGAR_RUSH_LEVEL; ++i)
22662266 {
2267- const Rect rect{
2267+ const rect_t rect{
22682268 .x = bx * (int )FONT_SIZE + i * 5 ,
22692269 .y = Y_STATUS + 2 ,
22702270 .width = 4 ,
@@ -2402,9 +2402,9 @@ void CGameMixin::drawHealthBar(CFrame &bitmap, const bool isPlayerHurt)
24022402 const Color hpColor = game.isGodMode () ? WHITE : isPlayerHurt ? PINK
24032403 : LIME;
24042404 const int hpWidth = std::min (game.health () / 2 , bitmap.width () - 4 );
2405- drawRect (bitmap, Rect {4 , bitmap.height () - 12 , hpWidth, 8 },
2405+ drawRect (bitmap, rect_t {4 , bitmap.height () - 12 , hpWidth, 8 },
24062406 hpColor, true );
2407- drawRect (bitmap, Rect {4 , bitmap.height () - 12 , hpWidth, 8 },
2407+ drawRect (bitmap, rect_t {4 , bitmap.height () - 12 , hpWidth, 8 },
24082408 WHITE, false );
24092409 }
24102410}
@@ -2526,9 +2526,9 @@ void CGameMixin::drawUI(CFrame &bitmap, CGameUI &ui)
25262526 {
25272527 int x = baseX + btn.x ;
25282528 int y = baseY + btn.y ;
2529- drawRect (bitmap, Rect {.x = baseX + btn.x , .y = baseY + btn.y , .width = btn.width , .height = btn.height }, static_cast <Color>(btn.color ), true );
2529+ drawRect (bitmap, rect_t {.x = baseX + btn.x , .y = baseY + btn.y , .width = btn.width , .height = btn.height }, static_cast <Color>(btn.color ), true );
25302530 drawFont (bitmap, x, y, btn.text .c_str (), BLACK, CLEAR, 2 , 2 );
2531- drawRect (bitmap, Rect {.x = baseX + btn.x , .y = baseY + btn.y , .width = btn.width , .height = btn.height }, RED, false );
2531+ drawRect (bitmap, rect_t {.x = baseX + btn.x , .y = baseY + btn.y , .width = btn.width , .height = btn.height }, RED, false );
25322532 }
25332533}
25342534
0 commit comments