2024-11-14 00:55:09 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "vmath.h"
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
namespace VISEQ::APP{
|
|
|
|
|
|
|
|
|
|
struct AppSettings{
|
|
|
|
|
int width;
|
|
|
|
|
int height;
|
|
|
|
|
float grid;
|
|
|
|
|
float bpm;
|
|
|
|
|
float fps;
|
|
|
|
|
float speed = 16.0f;
|
|
|
|
|
int gui_selected_midi_out;
|
|
|
|
|
};
|
2024-11-14 01:37:16 +01:00
|
|
|
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(AppSettings, width, height, grid, bpm, fps, speed, gui_selected_midi_out)
|
2024-11-14 00:55:09 +01:00
|
|
|
|
2024-11-14 23:21:04 +01:00
|
|
|
enum InteractionState {HOVER_CANVAS, HOVER_NODE, HOVER_CONNECTOR, ADD_NODES_MENU, DRAG_NODE, CONNECT_NODE, DRAW_SELECTION, SCALE_SELECTION, DELETE_SELECTED_NODES, COPY_SELECTED_NODES, PASTE_SELECTED_NODES};
|
|
|
|
|
|
2024-11-14 00:55:09 +01:00
|
|
|
class State{
|
|
|
|
|
public:
|
|
|
|
|
State(){}
|
|
|
|
|
State(State &state) = delete;
|
|
|
|
|
void operator=(const State &) = delete;
|
|
|
|
|
|
|
|
|
|
AppSettings settings;
|
2024-11-14 01:37:16 +01:00
|
|
|
|
2024-11-14 00:55:09 +01:00
|
|
|
Vec2Df raw_mouse;
|
2024-11-14 01:37:16 +01:00
|
|
|
Vec2Df screen_mouse;
|
2024-11-14 00:55:09 +01:00
|
|
|
Vec2Df mod_mouse;
|
|
|
|
|
|
2024-11-14 23:21:04 +01:00
|
|
|
InteractionState istate = HOVER_CANVAS;
|
|
|
|
|
|
2024-11-14 01:37:16 +01:00
|
|
|
int node_mode = 0;
|
2024-11-14 23:21:04 +01:00
|
|
|
|
2024-11-14 00:55:09 +01:00
|
|
|
inline static std::shared_ptr<State> instance;
|
|
|
|
|
static std::shared_ptr<State> get() {
|
|
|
|
|
if(!instance){
|
|
|
|
|
instance.reset(new State());
|
|
|
|
|
}
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|