[nostalgia] Replace C strings with ox::StringView
This commit is contained in:
@@ -93,11 +93,11 @@ struct TileSheet {
|
||||
other.columns = 0;
|
||||
other.rows = 0;
|
||||
}
|
||||
constexpr SubSheet(const char *pName, int pColumns, int pRows, int bpp) noexcept:
|
||||
constexpr SubSheet(ox::CRStringView pName, int pColumns, int pRows, int bpp) noexcept:
|
||||
name(pName), columns(pColumns), rows(pRows),
|
||||
pixels(static_cast<std::size_t>(columns * rows * PixelsPerTile) / (bpp == 4 ? 2u : 1u)) {
|
||||
}
|
||||
constexpr SubSheet(const char *pName, int pColumns, int pRows, ox::Vector<uint8_t> pPixels) noexcept:
|
||||
constexpr SubSheet(ox::CRStringView pName, int pColumns, int pRows, ox::Vector<uint8_t> pPixels) noexcept:
|
||||
name(pName), columns(pColumns), rows(pRows), pixels(std::move(pPixels)) {
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ struct TileSheet {
|
||||
constexpr ox::Error addSubSheet(const SubSheetIdx &idx) noexcept {
|
||||
auto &parent = getSubSheet(idx);
|
||||
if (parent.subsheets.size() < 2) {
|
||||
parent.subsheets.emplace_back(ox::sfmt("Subsheet {}", parent.subsheets.size()).c_str(), 1, 1, bpp);
|
||||
parent.subsheets.emplace_back(ox::sfmt("Subsheet {}", parent.subsheets.size()), 1, 1, bpp);
|
||||
} else {
|
||||
parent.subsheets.emplace_back("Subsheet 0", parent.columns, parent.rows, bpp);
|
||||
parent.subsheets.emplace_back("Subsheet 1", 1, 1, bpp);
|
||||
@@ -482,7 +482,7 @@ void addCustomDrawer(Context *ctx, Drawer *cd) noexcept;
|
||||
|
||||
void removeCustomDrawer(Context *ctx, Drawer *cd) noexcept;
|
||||
|
||||
void setWindowTitle(Context *ctx, const char *title) noexcept;
|
||||
void setWindowTitle(Context *ctx, ox::CRStringView title) noexcept;
|
||||
|
||||
void focusWindow(Context *ctx) noexcept;
|
||||
|
||||
@@ -518,7 +518,7 @@ ox::Error loadSpriteTileSheet(Context *ctx,
|
||||
const ox::FileAddress &tilesheetAddr,
|
||||
const ox::FileAddress &paletteAddr) noexcept;
|
||||
|
||||
void puts(Context *ctx, int column, int row, const char *str) noexcept;
|
||||
void puts(Context *ctx, int column, int row, ox::CRStringView str) noexcept;
|
||||
|
||||
void setTile(Context *ctx, unsigned bgIdx, int column, int row, uint8_t tile) noexcept;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user