diff --git a/src/nostalgia/core/CMakeLists.txt b/src/nostalgia/core/CMakeLists.txt index c2b94caf..96d28345 100644 --- a/src/nostalgia/core/CMakeLists.txt +++ b/src/nostalgia/core/CMakeLists.txt @@ -5,6 +5,8 @@ add_library( media.cpp ) +target_compile_options(NostalgiaCore PRIVATE -Wsign-conversion) + target_link_libraries( NostalgiaCore PUBLIC OxFS diff --git a/src/nostalgia/core/gfx.cpp b/src/nostalgia/core/gfx.cpp index 68d7f6e6..617ead0a 100644 --- a/src/nostalgia/core/gfx.cpp +++ b/src/nostalgia/core/gfx.cpp @@ -142,9 +142,9 @@ static char charMap[128] = { }; Color32 toColor32(Color16 nc) noexcept { - Color32 r = ((nc & 0b0000000000011111) >> 0) * 8; - Color32 g = ((nc & 0b0000001111100000) >> 5) * 8; - Color32 b = ((nc & 0b0111110000000000) >> 10) * 8; + Color32 r = static_cast(((nc & 0b0000000000011111) >> 0) * 8); + Color32 g = static_cast(((nc & 0b0000001111100000) >> 5) * 8); + Color32 b = static_cast(((nc & 0b0111110000000000) >> 10) * 8); Color32 a = 255; return a | (b << 8) | (g << 16) | (r << 24); } @@ -177,7 +177,7 @@ uint8_t blue32(Color16 c) noexcept { void puts(Context *ctx, int column, int row, const char *str) { for (int i = 0; str[i]; i++) { - setTile(ctx, 0, column + i, row, charMap[static_cast(str[i])]); + setTile(ctx, 0, column + i, row, static_cast(charMap[static_cast(str[i])])); } } diff --git a/src/nostalgia/core/sdl/gfx.cpp b/src/nostalgia/core/sdl/gfx.cpp index fc301754..e563dff0 100644 --- a/src/nostalgia/core/sdl/gfx.cpp +++ b/src/nostalgia/core/sdl/gfx.cpp @@ -27,7 +27,7 @@ struct SdlImplData { SDL_Renderer *renderer = nullptr; std::array bgTextures; std::array bgTileMaps; - uint64_t prevFpsCheckTime = 0; + int64_t prevFpsCheckTime = 0; uint64_t draws = 0; }; @@ -105,7 +105,7 @@ ox::Error loadTileSheet(Context *ctx, } oxReturnError(readMC(ctx, palettePath).get(&palette)); - const auto bytesPerTile = tilesheet.bpp == 8 ? 64 : 32; + const unsigned bytesPerTile = tilesheet.bpp == 8 ? 64 : 32; const auto tiles = tilesheet.tiles.size() / bytesPerTile; const int width = 8; const int height = 8 * tiles; @@ -126,11 +126,12 @@ ox::Error loadTileSheet(Context *ctx, SDL_FreeSurface(surface); SDL_FreePalette(sdlPalette); + auto sectionIdx = static_cast(section); if (tss == TileSheetSpace::Background) { - if (id->bgTextures[section]) { - SDL_DestroyTexture(id->bgTextures[section]); + if (id->bgTextures[sectionIdx]) { + SDL_DestroyTexture(id->bgTextures[sectionIdx]); } - id->bgTextures[section] = texture; + id->bgTextures[sectionIdx] = texture; } return OxError(0);