[nostalgia] Replace C strings with ox::StringView

This commit is contained in:
2022-12-31 17:14:43 -06:00
parent 55ea405a54
commit 679226ef73
31 changed files with 81 additions and 75 deletions
+5 -4
View File
@@ -85,7 +85,7 @@ ox::Error shutdownGfx(Context*) noexcept {
return {};
}
void setWindowTitle(Context*, const char*) noexcept {
void setWindowTitle(Context*, ox::CRStringView) noexcept {
}
void focusWindow(Context*) noexcept {
@@ -210,10 +210,11 @@ ox::Error loadSpritePalette(Context *ctx, unsigned cbb, const ox::FileAddress &p
}
// Do NOT use Context in the GBA version of this function.
void puts(Context *ctx, int column, int row, const char *str) noexcept {
for (int i = 0; str[i]; i++) {
void puts(Context *ctx, int column, int row, ox::CRStringView str) noexcept {
const auto col = static_cast<unsigned>(column);
for (auto i = 0u; i < str.bytes(); i++) {
const auto c = charMap[static_cast<unsigned>(str[i])];
setTile(ctx, 0, column + i, row, static_cast<uint8_t>(c));
setTile(ctx, 0, static_cast<int>(col + i), row, static_cast<uint8_t>(c));
}
}