macOS fixes; call onAppWindowResized after launch

This commit is contained in:
Luke Street 2022-02-08 03:42:59 -05:00
parent 011f65c48f
commit 72b4d5a7fc
3 changed files with 9 additions and 22 deletions

View File

@ -64,7 +64,10 @@ if(DEFINED ENV{GITHUB_ENV})
endif() endif()
message(STATUS "Metaforce version set to ${METAFORCE_WC_DESCRIBE}") message(STATUS "Metaforce version set to ${METAFORCE_WC_DESCRIBE}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
project(metaforce LANGUAGES C CXX ASM VERSION ${METAFORCE_VERSION_STRING}) if(APPLE)
set(EXTRA_LANGUAGES OBJC)
endif()
project(metaforce LANGUAGES C CXX ASM ${EXTRA_LANGUAGES} VERSION ${METAFORCE_VERSION_STRING})
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ATHENA_ARCH) string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ATHENA_ARCH)
string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ATHENA_HOST_ARCH) string(TOLOWER "${CMAKE_HOST_SYSTEM_PROCESSOR}" ATHENA_HOST_ARCH)

View File

@ -266,9 +266,14 @@ fn app_run(mut delegate: cxx::UniquePtr<ffi::AppDelegate>, icon: ffi::Icon) {
sdl_controller_sys: controller, sdl_controller_sys: controller,
sdl_open_controllers: Default::default(), sdl_open_controllers: Default::default(),
}; };
let window_size = WindowSize {
width: app.gpu.surface_config.width,
height: app.gpu.surface_config.height,
};
unsafe { unsafe {
APP.replace(app); APP.replace(app);
ffi::App_onAppLaunched(delegate.as_mut().unwrap()); ffi::App_onAppLaunched(delegate.as_mut().unwrap());
ffi::App_onAppWindowResized(delegate.as_mut().unwrap_unchecked(), &window_size);
}; };
let mut last_frame: Option<Instant> = None; let mut last_frame: Option<Instant> = None;
event_loop.run(move |event, _, control_flow| { event_loop.run(move |event, _, control_flow| {

View File

@ -285,14 +285,8 @@ public:
m_voiceEngine->setVolume(0.7f); m_voiceEngine->setVolume(0.7f);
m_amuseAllocWrapper.emplace(*m_voiceEngine); m_amuseAllocWrapper.emplace(*m_voiceEngine);
// hecl::ProjectPath projectPath;
for (const auto& str : aurora::get_args()) { for (const auto& str : aurora::get_args()) {
auto arg = static_cast<std::string>(str); auto arg = static_cast<std::string>(str);
// hecl::Sstat theStat;
// if (hecl::Stat((arg + "/out").c_str(), &theStat) == 0 && S_ISDIR(theStat.st_mode)) {
// hecl::ProjectRootPath rootPath(arg);
// hecl::Database::Project tmp(rootPath); // Force project creation
// }
if (m_deferredProject.empty() && !arg.starts_with('-') && !arg.starts_with('+')) if (m_deferredProject.empty() && !arg.starts_with('-') && !arg.starts_with('+'))
m_deferredProject = arg; m_deferredProject = arg;
if (arg == "--no-shader-warmup") if (arg == "--no-shader-warmup")
@ -300,16 +294,6 @@ public:
else if (arg == "--no-sound") else if (arg == "--no-sound")
m_voiceEngine->setVolume(0.f); m_voiceEngine->setVolume(0.f);
} }
// if (m_deferredProject.empty()) {
// /* Default behavior - search upwards for packaged project containing the program */
// if (hecl::ProjectRootPath projRoot = hecl::SearchForProject(ExeDir)) {
// std::string rootPath(projRoot.getAbsolutePath());
// hecl::Sstat theStat;
// if (hecl::Stat((rootPath + "/out/files/MP1/Metroid1.upak").c_str(), &theStat) == 0 && S_ISREG(theStat.st_mode))
// m_deferredProject = rootPath + "/out";
// }
// }
} }
void initialize() { void initialize() {
@ -401,11 +385,6 @@ public:
m_imGuiConsole.ShowAboutWindow(false, m_errorString); m_imGuiConsole.ShowAboutWindow(false, m_errorString);
} }
// {
// OPTICK_EVENT("Flush");
// CGraphics::SetCommitResourcesAsLazy(false);
// }
return true; return true;
} }