Skip to content

Commit

Permalink
fixing CI
Browse files Browse the repository at this point in the history
  • Loading branch information
wkjarosz committed Dec 28, 2023
1 parent 64bc530 commit b955b38
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,16 @@ hello_imgui_add_app(
)

set_target_properties(SamplinSafari PROPERTIES OUTPUT_NAME ${output_name} CXX_STANDARD 17)
target_link_libraries(SamplinSafari PRIVATE samplerlib linalg fmt::fmt)
if(EMSCRIPTEN)
target_link_libraries(SamplinSafari PRIVATE samplerlib linalg fmt::fmt emscripten-browser-file)
target_link_libraries(SamplinSafari PRIVATE emscripten-browser-file)
target_link_options(
SamplinSafari PRIVATE -sEXPORTED_RUNTIME_METHODS=[ccall] -sEXPORTED_FUNCTIONS=[_main,_malloc,_free]
-sNO_DISABLE_EXCEPTION_CATCHING
)
hello_imgui_set_emscripten_target_initial_memory_megabytes(SamplinSafari 120)
else()
target_link_libraries(SamplinSafari PRIVATE samplerlib linalg fmt::fmt-header-only portable-file-dialogs)
target_link_libraries(SamplinSafari PRIVATE portable-file-dialogs)
endif()

if(UNIX AND NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
Expand Down
19 changes: 10 additions & 9 deletions src/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ using std::to_string;

static int g_dismissed_version = 0;

static bool g_show_modal = false;
static bool g_open_help = false;

static const vector<pair<string, string>> g_help_strings = {
{"h", "Show this help window"},
{"h", "Toggle this help window"},
{"Left click+drag", "Rotate the camera"},
{"Scroll mouse/pinch", "Zoom the camera"},
{"1", "Switch to XY orthographic view"},
Expand Down Expand Up @@ -268,7 +268,7 @@ SampleViewer::SampleViewer()
if (posX > ImGui::GetCursorPosX())
ImGui::SetCursorPosX(posX);
if (ImGui::MenuItem(text))
g_show_modal = true;
g_open_help = true;
};

m_params.callbacks.ShowAppMenuItems = [this]()
Expand Down Expand Up @@ -405,7 +405,7 @@ SampleViewer::SampleViewer()
auto s = HelloImGui::LoadUserPref("AboutDismissedVersion");
g_dismissed_version = strtol(s.c_str(), nullptr, 10);
if (g_dismissed_version < version_combined())
g_show_modal = true;
g_open_help = true;
};

m_params.callbacks.BeforeExit = []
Expand Down Expand Up @@ -514,7 +514,7 @@ void SampleViewer::draw_gui()

void SampleViewer::draw_about_dialog()
{
if (g_show_modal)
if (g_open_help)
ImGui::OpenPopup("About");

// Always center this window when appearing
Expand All @@ -524,7 +524,8 @@ void SampleViewer::draw_about_dialog()
const float2 col_width = {11 * HelloImGui::EmSize(), 32 * HelloImGui::EmSize()};
ImGui::SetNextWindowContentSize(float2{col_width[0] + col_width[1], 0});

if (ImGui::BeginPopupModal("About", nullptr,
bool about_open = true;
if (ImGui::BeginPopupModal("About", &about_open,
ImGuiWindowFlags_HorizontalScrollbar | ImGuiWindowFlags_NoSavedSettings |
ImGuiWindowFlags_AlwaysAutoResize))
{
Expand Down Expand Up @@ -697,15 +698,15 @@ void SampleViewer::draw_about_dialog()
// ImGui::SetKeyboardFocusHere();
if (ImGui::Button("Dismiss", ImVec2(120, 0)) || ImGui::IsKeyPressed(ImGuiKey_Escape) ||
ImGui::IsKeyPressed(ImGuiKey_Enter) || ImGui::IsKeyPressed(ImGuiKey_Space) ||
(!g_show_modal && ImGui::IsKeyPressed(ImGuiKey_H)))
(!g_open_help && ImGui::IsKeyPressed(ImGuiKey_H)))
{
ImGui::CloseCurrentPopup();
g_dismissed_version = version_combined();
}
ImGui::SetItemDefaultFocus();

ImGui::EndPopup();
g_show_modal = false;
g_open_help = false;
}
}

Expand Down Expand Up @@ -1174,7 +1175,7 @@ void SampleViewer::process_hotkeys()
else if (ImGui::IsKeyPressed(ImGuiKey_B))
m_show_bbox = !m_show_bbox;
else if (ImGui::IsKeyPressed(ImGuiKey_H))
g_show_modal = !g_show_modal;
g_open_help = !g_open_help;
}

void SampleViewer::update_points(bool regenerate)
Expand Down

0 comments on commit b955b38

Please sign in to comment.