[nostalgia] Remove dynamic library usage

Will make dynamically loaded Modules impossible, but they add complexity
and really aren't that useful...
This commit is contained in:
Gary Talent 2020-12-17 20:08:02 -06:00
parent 7a837502a1
commit d09dc5cc01
8 changed files with 28 additions and 11 deletions

View File

@ -205,6 +205,12 @@ ox::Error loadSpritePalette(Context *ctx, int section, ox::FileAddress paletteAd
}
// Do NOT use Context in the GBA version of this function.
void puts(Context *ctx, int column, int row, const char *str) {
for (int i = 0; str[i]; i++) {
setTile(ctx, 0, column + i, row, static_cast<uint8_t>(charMap[static_cast<int>(str[i])]));
}
}
void setTile(Context*, int layer, int column, int row, uint8_t tile) {
MEM_BG_MAP[layer][row * GbaTileColumns + column] = tile;
}

View File

@ -11,7 +11,7 @@
namespace nostalgia::core {
// map ASCII values to the nostalgia charset
static char charMap[128] = {
char charMap[128] = {
0,
0,
0,
@ -175,12 +175,6 @@ uint8_t blue32(Color16 c) noexcept {
return blue16(c) * 8;
}
void puts(Context *ctx, int column, int row, const char *str) {
for (int i = 0; str[i]; i++) {
setTile(ctx, 0, column + i, row, static_cast<uint8_t>(charMap[static_cast<int>(str[i])]));
}
}
static_assert(color16(0, 31, 0, 0) == 992);
static_assert(color16(16, 31, 0, 0) == 1008);
static_assert(color16(16, 31, 8, 0) == 9200);

View File

@ -14,6 +14,8 @@
namespace nostalgia::core {
extern char charMap[128];
enum class TileSheetSpace {
Background,
Sprite

View File

@ -3,7 +3,7 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
add_library(
NostalgiaCore-Qt SHARED
NostalgiaCore-Qt OBJECT
gfx.cpp
)

View File

@ -29,7 +29,16 @@ ox::Error loadBgTileSheet(Context*,
return OxError(1);
}
void puts(Context *ctx, int column, int row, const char *str) {
for (int i = 0; str[i]; i++) {
setTile(ctx, 0, column + i, row, static_cast<uint8_t>(charMap[static_cast<int>(str[i])]));
}
}
void setTile(Context*, int, int, int, uint8_t) {
}
void setSprite(Context*, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned, unsigned) {
}
}

View File

@ -194,6 +194,12 @@ void draw(Context *ctx) {
SDL_RenderPresent(id->renderer);
}
void puts(Context *ctx, int column, int row, const char *str) {
for (int i = 0; str[i]; i++) {
setTile(ctx, 0, column + i, row, static_cast<uint8_t>(charMap[static_cast<int>(str[i])]));
}
}
void setTile(Context *ctx, int layer, int column, int row, uint8_t tile) {
auto id = ctx->implData<SdlImplData>();
auto z = static_cast<unsigned>(layer);

View File

@ -2,7 +2,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
add_library(
NostalgiaStudio SHARED
NostalgiaStudio OBJECT
editor.cpp
wizard.cpp
module.cpp

View File

@ -46,8 +46,8 @@ ox::Error model(T *io, NostalgiaStudioState *obj) {
}
struct NostalgiaStudioProfile {
QString appName;
QString orgName;
QString appName = "Nostalgia Studio";
QString orgName = "Drinking Tea";
QVector<QString> modulesPath;
};