diff --git a/testbed/nanogui/ext/glfw/CMakeLists.txt b/testbed/nanogui/ext/glfw/CMakeLists.txt index 0dab1795..6c86ef5e 100644 --- a/testbed/nanogui/ext/glfw/CMakeLists.txt +++ b/testbed/nanogui/ext/glfw/CMakeLists.txt @@ -26,7 +26,7 @@ option(GLFW_INSTALL "Generate installation target" ON) option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF) if (WIN32) - option(GLFW_USE_DWM_SWAP_INTERVAL "Set swap interval even when DWM compositing is enabled" OFF) + option(GLFW_USE_DWM_SWAP_INTERVAL "Set swap interval even when DWM compositing is enabled" ON) option(GLFW_USE_OPTIMUS_HPG "Force use of high-performance GPU on Optimus systems" OFF) endif() diff --git a/testbed/nanogui/include/nanogui/combobox.h b/testbed/nanogui/include/nanogui/combobox.h index f1b9a1a8..30c9afd9 100644 --- a/testbed/nanogui/include/nanogui/combobox.h +++ b/testbed/nanogui/include/nanogui/combobox.h @@ -21,7 +21,8 @@ public: ComboBox(Widget *parent); /// Create a new combo box with the given items - ComboBox(Widget *parent, const std::vector &items); + ComboBox(Widget *parent, const std::vector &items, + const std::function& callback); /** * \brief Create a new combo box with the given items, providing both short and diff --git a/testbed/nanogui/src/combobox.cpp b/testbed/nanogui/src/combobox.cpp index 2f09aab5..8d5fe472 100644 --- a/testbed/nanogui/src/combobox.cpp +++ b/testbed/nanogui/src/combobox.cpp @@ -19,8 +19,10 @@ NAMESPACE_BEGIN(nanogui) ComboBox::ComboBox(Widget *parent) : PopupButton(parent), mSelectedIndex(0) { } -ComboBox::ComboBox(Widget *parent, const std::vector &items) +ComboBox::ComboBox(Widget *parent, const std::vector &items, + const std::function& callback) : PopupButton(parent), mSelectedIndex(0) { + setCallback(callback); setItems(items); } diff --git a/testbed/src/Gui.cpp b/testbed/src/Gui.cpp index 7c8c1161..ce187796 100644 --- a/testbed/src/Gui.cpp +++ b/testbed/src/Gui.cpp @@ -128,11 +128,10 @@ void Gui::createSimulationPanel() { scenesNames.push_back(scenes[i]->getName().c_str()); } Label* labelScenes = new Label(mSimulationPanel, "Scene","sans-bold"); - ComboBox* comboBoxScenes = new ComboBox(mSimulationPanel, scenesNames); - comboBoxScenes->setFixedWidth(150); - comboBoxScenes->setCallback([&, scenes](int index){ + ComboBox* comboBoxScenes = new ComboBox(mSimulationPanel, scenesNames, [&, scenes](int index) { mApp->switchScene(scenes[index]); }); + comboBoxScenes->setFixedWidth(150); } void Gui::createSettingsPanel() { @@ -316,7 +315,7 @@ void Gui::createSettingsPanel() { Label* labelSleepLinearVel = new Label(panelSleepLinearVel, "Sleep linear velocity","sans-bold"); labelSleepLinearVel->setFixedWidth(120); out.str(""); - out << std::setprecision(1) << std::fixed << (mApp->mEngineSettings.sleepLinearVelocity); + out << std::setprecision(2) << std::fixed << (mApp->mEngineSettings.sleepLinearVelocity); TextBox* textboxSleepLinearVel = new TextBox(panelSleepLinearVel); textboxSleepLinearVel->setFixedSize(Vector2i(70, 25)); textboxSleepLinearVel->setEditable(true); @@ -327,7 +326,7 @@ void Gui::createSettingsPanel() { try { float value = std::stof(str); std::ostringstream out; - out << std::setprecision(1) << std::fixed << std::showpoint << value; + out << std::setprecision(2) << std::fixed << std::showpoint << value; float finalValue = std::stof(out.str()); if (finalValue < 0 || finalValue > 10000) return false; @@ -350,18 +349,18 @@ void Gui::createSettingsPanel() { Label* labelSleepAngularVel = new Label(panelSleepAngularVel, "Sleep angular velocity","sans-bold"); labelSleepAngularVel->setFixedWidth(120); out.str(""); - out << std::setprecision(0) << std::fixed << (mApp->mEngineSettings.sleepAngularVelocity); + out << std::setprecision(2) << std::fixed << (mApp->mEngineSettings.sleepAngularVelocity); TextBox* textboxSleepAngularVel = new TextBox(panelSleepAngularVel); textboxSleepAngularVel->setFixedSize(Vector2i(70, 25)); textboxSleepAngularVel->setEditable(true); textboxSleepAngularVel->setValue(out.str()); - textboxSleepAngularVel->setUnits("m/s"); + textboxSleepAngularVel->setUnits("rad/s"); textboxSleepAngularVel->setCallback([&, textboxSleepAngularVel](const std::string &str) { try { float value = std::stof(str); std::ostringstream out; - out << std::setprecision(0) << std::fixed << std::showpoint << value; + out << std::setprecision(2) << std::fixed << std::showpoint << value; float finalValue = std::stof(out.str()); if (finalValue < 0 || finalValue > 10000) return false;