MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / createSimulationPanel

Method createSimulationPanel

testbed/src/Gui.cpp:155–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155void Gui::createSimulationPanel() {
156
157 mSimulationPanel = new Window(mScreen, "Simulation");
158 mSimulationPanel->set_position(Vector2i(15, 15));
159 mSimulationPanel->set_layout(new GroupLayout(10, 5, 10 , 20));
160 //mSimulationPanel->setId("SimulationPanel");
161 mSimulationPanel->set_fixed_width(220);
162
163 // Scenes/Physics/Rendering buttons
164 new Label(mSimulationPanel, "Controls","sans-bold");
165 Widget* panelControls = new Widget(mSimulationPanel);
166 panelControls->set_layout(new BoxLayout(Orientation::Horizontal, Alignment::Middle, 0, 5));
167 ToolButton* buttonPlay = new ToolButton(panelControls, FA_PLAY);
168 buttonPlay->set_flags(Button::NormalButton);
169 buttonPlay->set_callback([&] {
170 mApp->playSimulation();
171 });
172 ToolButton* buttonPause = new ToolButton(panelControls, FA_PAUSE);
173 buttonPause->set_flags(Button::NormalButton);
174 buttonPause->set_callback([&] {
175 mApp->pauseSimulation();
176 });
177 ToolButton* buttonPlayStep = new ToolButton(panelControls, FA_STEP_FORWARD);
178 buttonPlayStep->set_flags(Button::NormalButton);
179 buttonPlayStep->set_callback([&] {
180 mApp->toggleTakeSinglePhysicsStep();
181 });
182 ToolButton* buttonRestart = new ToolButton(panelControls, FA_REDO);
183 buttonRestart->set_flags(Button::NormalButton);
184 buttonRestart->set_callback([&] {
185 mApp->restartSimulation();
186 });
187
188 // Scenes
189 std::vector<Scene*> scenes = mApp->getScenes();
190 std::vector<std::string> scenesNames;
191 for (uint i=0; i<scenes.size(); i++) {
192 scenesNames.push_back(scenes[i]->getName().c_str());
193 }
194 new Label(mSimulationPanel, "Scene","sans-bold");
195
196 mComboBoxScenes = new ComboBox(mSimulationPanel, scenesNames);
197 mComboBoxScenes->set_callback([&, scenes](int index) {
198 mApp->switchScene(scenes[index]);
199 });
200}
201
202void Gui::createSettingsPanel() {
203

Callers

nothing calls this directly

Calls 8

playSimulationMethod · 0.80
pauseSimulationMethod · 0.80
restartSimulationMethod · 0.80
getScenesMethod · 0.80
switchSceneMethod · 0.80
sizeMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected