all of the changes
This commit is contained in:
37
include/FluidSim/Desktop/DesktopUi.hpp
Normal file
37
include/FluidSim/Desktop/DesktopUi.hpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include "FluidSim/Scenario.hpp"
|
||||
#include "FluidSim/DynoCurve.hpp"
|
||||
#include "FluidSim/Desktop/PedalControl.hpp"
|
||||
#include "FluidSim/Desktop/EngineRenderer3D.hpp"
|
||||
#include <SFML/Graphics.hpp>
|
||||
namespace fluidsim::port::desktop {
|
||||
struct PlaybackInfo {
|
||||
float pedal_target{},load{};
|
||||
double speed{1};
|
||||
std::size_t buffered{},capacity{};
|
||||
std::uint64_t underruns{};
|
||||
bool auto_gain{},time_warp{};
|
||||
};
|
||||
struct WorkspaceLayout {
|
||||
sf::FloatRect sidebar,viewport,chart,inspector,pedal;
|
||||
static WorkspaceLayout calculate(sf::Vector2u size);
|
||||
};
|
||||
class DesktopUi {
|
||||
public:
|
||||
float pedal() const {return pedal_.value();}
|
||||
void nudge_pedal(float amount) {pedal_.set(pedal_.value()+amount);}
|
||||
void update_pedal(float dt,bool raise,bool lower) {if(!pedal_drag_)pedal_.advance(dt,raise,lower);}
|
||||
bool handle_event(const sf::Event&,sf::Vector2u);
|
||||
void draw(sf::RenderWindow&,const sf::Font*,const ScenarioSnapshot&,const PlaybackInfo&);
|
||||
private:
|
||||
DynoCurve dyno_;
|
||||
EngineRenderer3D renderer_;
|
||||
OrbitCamera camera_;
|
||||
bool three_d_{true},camera_fitted_{},pan_drag_{},pedal_drag_{};
|
||||
PedalControl pedal_;
|
||||
sf::Vector2f pan_{};
|
||||
sf::Vector2i previous_mouse_{};
|
||||
bool dragging_{};
|
||||
float zoom_{1};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user