Files
Editor2D/include/DemoGame/PhysicsTweaker.hpp

47 lines
1.2 KiB
C++

#pragma once
#include <JUI/Widgets/Window.hpp>
#include "JUI/Widgets/LabeledSlider.hpp"
#include "JUI/Widgets/ListLayout.hpp"
namespace TestGame {
/// A window widget that displays physics variables as tunable sliders.
class PhysicsTweaker : public JUI::Window {
public:
Event<float> GravityChanged;
Event<float> AirResistanceChanged;
Event<float> MassChanged;
Event<float> AccelerationChanged;
Event<> PhysicsPaused;
Event<> PhysicsResumed;
Event<int> PhysicsStepped;
PhysicsTweaker() : JUI::Window() {
using namespace JUI::UDimLiterals;
this->Name("PhysicsTweaker");
this->Title("PhysicsParameters");
Size({300_px, 100_px});
Position({95_percent - 300_px, 95_percent - 200_px});
auto* layout = new JUI::VerticalListLayout(Content());
auto* grav_slider = new JUI::LabeledSlider(layout);
grav_slider->Minimum(0); grav_slider->Maximum(100);
}
explicit PhysicsTweaker(const JUI::Window& parent) : PhysicsTweaker() {
this->Parent(parent);
}
protected:
private:
};
}