Skip to content

Commit 9f39fbd

Browse files
committed
compilation fix 2
1 parent ed2fe2f commit 9f39fbd

10 files changed

Lines changed: 39 additions & 38 deletions

File tree

packages/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ DATAPATH = ../data/*
44
APPDIR = $(APP_NAME).AppDir
55
APP_DATA = $(APPDIR)/usr/share/data
66
APP_ID = com.cfrankb.$(APP_NAME)
7-
APP_ICON = data/${APP_NAME}.png
7+
APP_ICON = data/appimage/${APP_NAME}.png
88
DESKTOP_FILE = data/$(APP_ID).desktop
99
APP_DESKTOP_FILE = $(APPDIR)/usr/share/applications/$(APP_ID).desktop
1010

packages/bin/deb-genc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
t.write(MAN_PAGE)
6868

6969

70-
DEPENDS = ", ".join(["libc6 (>= 2.27)", "libsdl2", "libsdl2-mixer", "libxmp", "libz"])
70+
DEPENDS = ", ".join(["libc6 (>= 2.27)", "libsdl3", "libsdl3-mixer", "libxmp", "libz"])
7171

7272
paths = ["src/*.cpp", "src/**/*.cpp", "src/**/**/*.cpp"]
7373
src = []
90.6 KB
Loading

src/assetman.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ namespace AssetMan
122122
if (!ptr)
123123
{
124124
LOGE("can't fetch asset: %s", filepath.c_str());
125-
return false;
125+
return {};
126126
}
127127
data.assign(ptr, ptr + size);
128128
delete[] ptr;
129-
return true;
129+
return data;
130130
#else
131131
CFileWrap file;
132132
if (!file.open(filepath.c_str(), "rb"))

src/gamemixin.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/gamemixin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,13 +300,13 @@ protected slots:
300300
void drawLevelIntro(CFrame &bitmap);
301301
void drawFont(CFrame &frame, int x, int y, const char *text, Color color = WHITE, Color bgcolor = BLACK, const int scaleX = 1, const int scaleY = 1);
302302
void drawFont6x6(CFrame &frame, int x, int y, const char *text, const Color color = WHITE, const Color bgcolor = BLACK);
303-
void drawRect(CFrame &frame, const Rect &rect, const Color color = GREEN, bool fill = true);
303+
void drawRect(CFrame &frame, const rect_t &rect, const Color color = GREEN, bool fill = true);
304304
void plotLine(CFrame &frame, int x0, int y0, const int x1, const int y1, const Color color);
305305
inline void drawTimeout(CFrame &bitmap);
306306
inline void drawKeys(CFrame &bitmap);
307307
inline void drawSugarMeter(CFrame &bitmap, const int bx);
308308
inline void drawTile(CFrame &bitmap, const int x, const int y, CFrame &tile, const bool alpha, const ColorMask colorMask = COLOR_NOCHANGE, std::unordered_map<uint32_t, uint32_t> *colorMap = nullptr);
309-
inline void drawTile(CFrame &bitmap, const int x, const int y, CFrame &tile, const Rect &rect, const ColorMask colorMask = COLOR_NOCHANGE, std::unordered_map<uint32_t, uint32_t> *colorMap = nullptr);
309+
inline void drawTile(CFrame &bitmap, const int x, const int y, CFrame &tile, const rect_t &rect, const ColorMask colorMask = COLOR_NOCHANGE, std::unordered_map<uint32_t, uint32_t> *colorMap = nullptr);
310310
void drawTileFaz(CFrame &bitmap, const int x, const int y, CFrame &tile, int fazBitShift = 0, const ColorMask colorMask = COLOR_NOCHANGE);
311311
inline CFrame *tile2Frame(const uint8_t tileID, ColorMask &colorMask, std::unordered_map<uint32_t, uint32_t> *&colorMap);
312312
void drawHealthBar(CFrame &bitmap, const bool isPlayerHurt);

src/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "build.h"
3434
#include "statedata.h"
3535
#include "states.h"
36+
#include "strhelper.h"
3637

3738
const uint32_t FPS = CRuntime::tickRate();
3839
const uint32_t SLEEP = 1000 / FPS;

src/rect.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#pragma once
2020

21-
struct Rect
21+
struct rect_t
2222
{
2323
int x;
2424
int y;

src/runtime.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ void CRuntime::paint()
155155

156156
SDL_UpdateTexture(m_app.texture, nullptr, bitmap.getRGB().data(), getWidth() * sizeof(uint32_t));
157157
#if defined(__ANDROID__)
158-
Rect safeArea = getSafeAreaWindow();
158+
rect_t safeArea = getSafeAreaWindow();
159159
SDL_FRect rectDest{.x = _f(safeArea.x), .y = _f(safeArea.y), .w = _f(safeArea.width), .h = _f(safeArea.height)};
160160
#else
161161
int width;
@@ -265,9 +265,9 @@ void CRuntime::debugSDL()
265265
const Rez rezScreen = getScreenSize();
266266
LOGI("SCREENSIZE: %d x %d; Orientation: %d", rezScreen.w, rezScreen.h, currentOrientation);
267267

268-
Rect safeAreaWmd = getSafeAreaWindow();
268+
rect_t safeAreaWmd = getSafeAreaWindow();
269269
LOGI("safeAreaWnd: x: %d, y: %d, w: %d, h: %d", safeAreaWmd.x, safeAreaWmd.y, safeAreaWmd.width, safeAreaWmd.height);
270-
Rect safeAreaTexture = windowRect2textureRect(safeAreaWmd);
270+
rect_t safeAreaTexture = windowRect2textureRect(safeAreaWmd);
271271
LOGI("safeAreaTexture: x: %d, y: %d, w: %d, h: %d", safeAreaTexture.x, safeAreaTexture.y, safeAreaTexture.width, safeAreaTexture.height);
272272

273273
int pixelW = 0, pixelH = 0;
@@ -1299,7 +1299,7 @@ void CRuntime::drawTitleScreen(CFrame &bitmap)
12991299
drawTitlePix(bitmap, offsetY);
13001300

13011301
const int baseY = 2 * offsetY + title.height();
1302-
const Rect rect{
1302+
const rect_t rect{
13031303
8,
13041304
baseY,
13051305
getWidth() - 16,
@@ -2492,7 +2492,7 @@ Rez CRuntime::getWindowSize()
24922492
CRuntime::pos_t CRuntime::windowPos2texturePos(posF_t pos)
24932493
{
24942494
#if defined(__ANDROID__)
2495-
Rect safeRect = getSafeAreaWindow();
2495+
rect_t safeRect = getSafeAreaWindow();
24962496
pos.x -= safeRect.x;
24972497
pos.y -= safeRect.y;
24982498
float w = getWidth();
@@ -2514,22 +2514,22 @@ void CRuntime::onOrientationChange()
25142514
LOGI("Orientation changed - %s mode", isLandscape ? "Landscape" : "Portrait");
25152515
}
25162516

2517-
Rect CRuntime::getSafeAreaWindow()
2517+
rect_t CRuntime::getSafeAreaWindow()
25182518
{
25192519
SDL_Rect safe;
25202520
if (!SDL_GetWindowSafeArea(m_app.window, &safe))
25212521
{
25222522
LOGE("SDL_GetWindowSafeArea() failed; error: %s", SDL_GetError());
25232523
}
2524-
return Rect{
2524+
return rect_t{
25252525
safe.x,
25262526
safe.y,
25272527
safe.w,
25282528
safe.h,
25292529
};
25302530
}
25312531

2532-
Rect CRuntime::windowRect2textureRect(const Rect &wRect)
2532+
rect_t CRuntime::windowRect2textureRect(const rect_t &wRect)
25332533
{
25342534
Rez rez = getWindowSize();
25352535
float w = (float)getWidth() * 2;
@@ -2538,7 +2538,7 @@ Rect CRuntime::windowRect2textureRect(const Rect &wRect)
25382538
{
25392539
return static_cast<int>(w * (float)u / rez.w);
25402540
};
2541-
return Rect{
2541+
return rect_t{
25422542
_c(wRect.x),
25432543
_c(wRect.y),
25442544
_c(wRect.width),

src/runtime.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ class CRuntime : public CGameMixin
6767
bool createSDLWindow();
6868
Rez getScreenSize();
6969
Rez getWindowSize();
70-
Rect getSafeAreaWindow();
71-
Rect windowRect2textureRect(const Rect &wRect);
70+
rect_t getSafeAreaWindow();
71+
rect_t windowRect2textureRect(const rect_t &wRect);
7272
void debugSDL();
7373
bool saveToFile(const std::string filepath, const std::string name);
7474
bool loadFromFile(const std::string filepath, std::string &name);

0 commit comments

Comments
 (0)