[jasper/player] Rename player from jasper to Jasper, add quit shortcut in debug builds

This commit is contained in:
2025-01-08 22:03:50 -06:00
parent 2cf6e48a73
commit 0ae3adc7c7
3 changed files with 26 additions and 14 deletions

View File

@ -1,33 +1,33 @@
add_executable(
jasper WIN32 MACOSX_BUNDLE
Jasper WIN32 MACOSX_BUNDLE
app.cpp
)
if(BUILDCORE_TARGET STREQUAL "gba")
set(LOAD_KEEL_MODS FALSE)
set_target_properties(jasper
set_target_properties(Jasper
PROPERTIES
LINK_FLAGS ${LINKER_FLAGS}
COMPILER_FLAGS "-mthumb -mthumb-interwork"
)
OBJCOPY_FILE(jasper)
OBJCOPY_FILE(Jasper)
else()
set(LOAD_KEEL_MODS TRUE)
endif()
target_compile_definitions(
jasper PRIVATE
Jasper PRIVATE
OLYMPIC_LOAD_KEEL_MODULES=$<BOOL:${LOAD_KEEL_MODS}>
OLYMPIC_GUI_APP=1
)
# enable LTO
if(NOT WIN32)
set_property(TARGET jasper PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
set_property(TARGET Jasper PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
target_link_libraries(
jasper PUBLIC
Jasper PUBLIC
JasperProfile
JasperKeelModules
OlympicApplib

View File

@ -24,14 +24,23 @@ ox::Error run(
ox::SpanView<ox::CString> args) noexcept {
auto const fsPath = args.size() > 1 ? args[1] : ".";
OX_REQUIRE_M(tctx, turbine::init(fsPath, project));
OX_REQUIRE(bootfile, keel::readObj<jasper::core::Bootfile>(keelCtx(*tctx), "/Bootfile"));
auto &kctx = keelCtx(*tctx);
OX_REQUIRE(bootfile, keel::readObj<jasper::core::Bootfile>(kctx, "/Bootfile"));
oxOut("Jasper Player\n");
OX_REQUIRE(nctx, ncore::init(*tctx));
auto const&worldPath = *bootfile->args.at(0).unwrap();
OX_REQUIRE(worldStatic, readObj<world::WorldStatic>(keelCtx(*tctx), worldPath));
OX_REQUIRE(worldStatic, readObj<world::WorldStatic>(kctx, worldPath));
world::World world(*nctx, *worldStatic);
OX_RETURN_ERROR(world.setupDisplay());
turbine::setApplicationData(*tctx, &world);
if constexpr(ox::defines::Debug) {
turbine::setKeyEventHandler(*tctx, [](
turbine::Context &tctx, turbine::Key const key, bool const down) {
if (down && key == turbine::Key::Alpha_Q) {
turbine::requestShutdown(tctx);
}
});
}
setUpdateHandler(*tctx, [](turbine::Context &tctx) -> int {
auto &world = *applicationData<world::World>(tctx);
auto [sleepTime, err] = world.update();