This commit is contained in:
@@ -9,6 +9,10 @@
|
||||
#define OLYMPIC_PROJECT_NAME "OlympicProject"
|
||||
#endif
|
||||
|
||||
#ifndef OLYMPIC_APP_ID
|
||||
#define OLYMPIC_APP_ID "AppID"
|
||||
#endif
|
||||
|
||||
#ifndef OLYMPIC_APP_NAME
|
||||
#define OLYMPIC_APP_NAME "App"
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,7 @@ target_compile_definitions(
|
||||
OLYMPIC_GUI_APP=1
|
||||
OLYMPIC_LOAD_STUDIO_MODULES=1
|
||||
OLYMPIC_APP_NAME="Studio"
|
||||
OLYMPIC_APP_ID="net.drinkingtea.nostalgia.NostalgiaStudio"
|
||||
)
|
||||
target_link_libraries(
|
||||
StudioAppLib PUBLIC
|
||||
|
||||
@@ -92,7 +92,9 @@ static ox::Error runStudio(
|
||||
ox::StringViewCR appName,
|
||||
ox::StringViewCR projectDataDir,
|
||||
ox::UPtr<ox::FileSystem> &&fs) noexcept {
|
||||
OX_REQUIRE_M(ctx, turbine::init(std::move(fs), appName));
|
||||
OX_REQUIRE_M(
|
||||
ctx,
|
||||
turbine::init(std::move(fs), appName, "net.drinkingtea.nostalgia.NostalgiaStudio"));
|
||||
oxLogError(turbine::setWindowIcon(*ctx, WindowIcons()));
|
||||
turbine::setWindowTitle(*ctx, keelCtx(*ctx).appName);
|
||||
turbine::setKeyEventHandler(*ctx, keyEventHandler);
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "gfx.hpp"
|
||||
|
||||
namespace turbine {
|
||||
|
||||
class Context;
|
||||
|
||||
using TimeMs = uint64_t;
|
||||
@@ -91,9 +90,15 @@ KeyEventHandler keyEventHandler(Context const &ctx) noexcept;
|
||||
[[nodiscard]]
|
||||
bool buttonDown(Context const &ctx, Key) noexcept;
|
||||
|
||||
ox::Result<ox::UPtr<Context>> init(ox::UPtr<ox::FileSystem> &&fs, ox::StringViewCR appName) noexcept;
|
||||
ox::Result<ox::UPtr<Context>> init(
|
||||
ox::UPtr<ox::FileSystem> &&fs,
|
||||
ox::StringViewCR appName,
|
||||
ox::StringViewCR appId = {}) noexcept;
|
||||
|
||||
ox::Result<ox::UPtr<Context>> init(ox::StringViewCR fsPath, ox::StringViewCR appName) noexcept;
|
||||
ox::Result<ox::UPtr<Context>> init(
|
||||
ox::StringViewCR fsPath,
|
||||
ox::StringViewCR appName,
|
||||
ox::StringViewCR appId = {}) noexcept;
|
||||
|
||||
ox::Error run(Context &ctx) noexcept;
|
||||
|
||||
|
||||
@@ -139,4 +139,12 @@ KeyEventHandler keyEventHandler(Context const &ctx) noexcept {
|
||||
return ctx.keyEventHandler;
|
||||
}
|
||||
|
||||
float scale(Context const&) noexcept {
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool isWayland() noexcept {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -330,7 +330,9 @@ static void handleGlfwWindowCloseEvent(GLFWwindow *window) noexcept {
|
||||
}
|
||||
|
||||
ox::Result<ox::UPtr<Context>> init(
|
||||
ox::UPtr<ox::FileSystem> &&fs, ox::StringViewCR appName) noexcept {
|
||||
ox::UPtr<ox::FileSystem> &&fs,
|
||||
ox::StringViewCR appName,
|
||||
ox::StringViewCR appId) noexcept {
|
||||
auto ctx = ox::make_unique<Context>();
|
||||
OX_RETURN_ERROR(keel::init(ctx->keelCtx, std::move(fs), appName));
|
||||
using namespace std::chrono;
|
||||
@@ -346,6 +348,13 @@ ox::Result<ox::UPtr<Context>> init(
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
|
||||
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
|
||||
{
|
||||
auto appIdCstr = ox_malloca(appId.bytes() + 1, char);
|
||||
OX_ALLOW_UNSAFE_BUFFERS_BEGIN
|
||||
ox::strncpy(appIdCstr.get(), appId.data(), appId.bytes());
|
||||
OX_ALLOW_UNSAFE_BUFFERS_END
|
||||
glfwWindowHintString(GLFW_WAYLAND_APP_ID, appIdCstr.get());
|
||||
}
|
||||
constexpr auto Scale = 5;
|
||||
ctx->window = glfwCreateWindow(
|
||||
240 * Scale, 160 * Scale, ctx->keelCtx.appName.c_str(), nullptr, nullptr);
|
||||
|
||||
@@ -8,9 +8,12 @@
|
||||
|
||||
namespace turbine {
|
||||
|
||||
ox::Result<ox::UPtr<Context>> init(ox::StringViewCR fsPath, ox::StringViewCR appName) noexcept {
|
||||
ox::Result<ox::UPtr<Context>> init(
|
||||
ox::StringViewCR fsPath,
|
||||
ox::StringViewCR appName,
|
||||
ox::StringViewCR appId) noexcept {
|
||||
OX_REQUIRE_M(fs, keel::loadRomFs(fsPath));
|
||||
return init(std::move(fs), appName);
|
||||
return init(std::move(fs), appName, appId);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user