[nostalgia] Update Studio to handle tabs and open directory dialog on Mac, Update core::init
This commit is contained in:
@@ -107,6 +107,22 @@ constexpr float bluef(Color16 c) noexcept {
|
||||
}
|
||||
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr float redf(Color32 c) noexcept {
|
||||
return static_cast<float>(red32(c)) / 255.f;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr float greenf(Color32 c) noexcept {
|
||||
return static_cast<float>(green32(c)) / 255.f;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr float bluef(Color32 c) noexcept {
|
||||
return static_cast<float>(blue32(c)) / 255.f;
|
||||
}
|
||||
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr Color16 color16(uint8_t r, uint8_t g, uint8_t b) noexcept {
|
||||
return r | (g << 5) | (b << 10);
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
|
||||
#include <ox/fs/fs.hpp>
|
||||
|
||||
#include "assetmanager.hpp"
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
class Context;
|
||||
@@ -23,15 +25,19 @@ class Drawer {
|
||||
// User Input Output
|
||||
class Context {
|
||||
public:
|
||||
ox::FileSystem *rom = nullptr;
|
||||
ox::UniquePtr<ox::FileSystem> rom;
|
||||
ox::Vector<Drawer*, 5> drawers;
|
||||
const char *appName = "Nostalgia";
|
||||
#ifndef OX_BARE_METAL
|
||||
AssetManager assetManager;
|
||||
#endif
|
||||
private:
|
||||
void *m_customData = nullptr;
|
||||
void *m_windowerData = nullptr;
|
||||
void *m_rendererData = nullptr;
|
||||
|
||||
public:
|
||||
constexpr Context() noexcept = default;
|
||||
Context() noexcept = default;
|
||||
|
||||
Context(Context &other) noexcept = delete;
|
||||
Context(const Context &other) noexcept = delete;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <ox/fs/fs.hpp>
|
||||
|
||||
#include "assetmanager.hpp"
|
||||
#include "clipboard.hpp"
|
||||
#include "consts.hpp"
|
||||
#include "gfx.hpp"
|
||||
@@ -20,7 +21,7 @@ namespace nostalgia::core {
|
||||
|
||||
using event_handler = int(*)(Context*);
|
||||
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::FileSystem *fs) noexcept;
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, const char *appName = "Nostalgia") noexcept;
|
||||
|
||||
ox::Error run(Context *ctx) noexcept;
|
||||
|
||||
|
||||
@@ -40,9 +40,10 @@ static void initTimer() noexcept {
|
||||
REG_IE = REG_IE | Int_timer0;
|
||||
}
|
||||
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::FileSystem *fs) noexcept {
|
||||
ox::Result<ox::UniquePtr<Context>> init(ox::UniquePtr<ox::FileSystem> fs, const char *appName) noexcept {
|
||||
auto ctx = ox::make_unique<Context>();
|
||||
ctx->rom = fs;
|
||||
ctx->rom = std::move(fs);
|
||||
ctx->appName = std::move(appName);
|
||||
oxReturnError(initGfx(ctx.get()));
|
||||
initTimer();
|
||||
initIrq();
|
||||
|
||||
@@ -162,7 +162,8 @@ ox::Error initConsole(Context *ctx) noexcept {
|
||||
ctx = new (ox_alloca(sizeof(Context))) Context();
|
||||
oxRequire(rom, loadRom());
|
||||
ox::FileStore32 fs(rom, 32 * ox::units::MB);
|
||||
ctx->rom = new (ox_alloca(sizeof(ox::FileSystem32))) ox::FileSystem32(fs);
|
||||
auto romFs = new (ox_alloca(sizeof(ox::FileSystem32))) ox::FileSystem32(fs);
|
||||
new (&ctx->rom) ox::UniquePtr<ox::FileSystem>(romFs);
|
||||
}
|
||||
return loadBgTileSheet(ctx, 0, TilesheetAddr, PaletteAddr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user