Skip to content

Commit

Permalink
toggle collapse mode of settings window
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathemalsky committed Aug 30, 2023
1 parent a6fde99 commit 7c7fb6a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ key | function
------|-------------
`ESC` | close application
`F3` | toggle visibility of settings window
`C` | toggle collapse mode of settings window
`R` | recompute solution(s)
`T` | switch display of approximation to next mode
`1` | toggle drawing of BTSP approximation
Expand Down
3 changes: 2 additions & 1 deletion include/draw/variables.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
namespace drawing {
extern graph::Euclidean EUCLIDEAN;

extern bool SHOW_SETTINGS_WINDOW;
extern bool SHOW_DEBUG_WINDOW;
extern bool SHOW_SETTINGS_WINDOW;
extern bool COLLAPSE_SETTINGS_WINDOW;

extern std::array<bool, std::to_underlying(ProblemType::NUMBER_OF_OPTIONS)> ACTIVE;

Expand Down
3 changes: 3 additions & 0 deletions src/draw/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ void keyCallback([[maybe_unused]] GLFWwindow* window, int key, [[maybe_unused]]
if (key == GLFW_KEY_6 && action == GLFW_PRESS) {
toggle(drawing::ACTIVE[std::to_underlying(ProblemType::TSP_exact)]);
}
if (key == GLFW_KEY_C && action == GLFW_PRESS) {
toggle(drawing::COLLAPSE_SETTINGS_WINDOW);
}
if (key == GLFW_KEY_T && action == GLFW_PRESS) {
if (drawing::ACTIVE[std::to_underlying(ProblemType::BTSP_approx)]) {
cycleBTSPApproxDisplay();
Expand Down
2 changes: 2 additions & 0 deletions src/draw/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ void drawImgui(Appearance& appearance) {
if (drawing::SHOW_SETTINGS_WINDOW) {
ImGui::Begin("Settings", &drawing::SHOW_SETTINGS_WINDOW);

ImGui::SetWindowCollapsed(drawing::COLLAPSE_SETTINGS_WINDOW);

ImGui::Checkbox("BTSP approx", &drawing::ACTIVE[std::to_underlying(ProblemType::BTSP_approx)]);
ImGui::ColorEdit3("##BTSP approx", (float*) &appearance.colour[std::to_underlying(ProblemType::BTSP_approx)]);
ImGui::SliderFloat("thickness##BTSP approx", &appearance.thickness[std::to_underlying(ProblemType::BTSP_approx)], 0.0f, 30.0f, "%.1f");
Expand Down
1 change: 1 addition & 0 deletions src/draw/variables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ graph::Euclidean EUCLIDEAN;

bool SHOW_DEBUG_WINDOW;
bool SHOW_SETTINGS_WINDOW;
bool COLLAPSE_SETTINGS_WINDOW;

std::array<bool, std::to_underlying(ProblemType::NUMBER_OF_OPTIONS)> ACTIVE;
bool BTSP_DRAW_OPEN_EAR_DECOMPOSITION;
Expand Down

0 comments on commit 7c7fb6a

Please sign in to comment.