json serialization beginnings, but still much to do
This commit is contained in:
+8
-4
@@ -5,7 +5,7 @@
|
||||
#include "raymath.h"
|
||||
#include <map>
|
||||
|
||||
#define R 14.0f
|
||||
#define RADIUS 14.0f
|
||||
|
||||
struct NodeMidiOut{
|
||||
int i;
|
||||
@@ -13,12 +13,14 @@ struct NodeMidiOut{
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(NodeMidiOut, i, name, enabled)
|
||||
|
||||
class MidiNode : public Node{
|
||||
|
||||
public:
|
||||
|
||||
MidiNode() {}
|
||||
MidiNode(Vec2D<float> position) : Node(position) {}
|
||||
MidiNode(Vec2Df position) : Node(position) {}
|
||||
|
||||
NodeType nodeType = NodeType::MIDINODE;
|
||||
|
||||
@@ -81,7 +83,7 @@ class MidiNode : public Node{
|
||||
return midi_gate;
|
||||
}
|
||||
|
||||
void draw(Vec2D<float> mouse, Camera2D cam) override {
|
||||
void draw(Vec2Df mouse, Camera2D cam) override {
|
||||
last = time;
|
||||
time = GetTime();
|
||||
if(time - start >= (float)midi_gate / 1000.0f){
|
||||
@@ -155,7 +157,7 @@ class MidiNode : public Node{
|
||||
}
|
||||
}
|
||||
|
||||
Vec2D<float> connector = position - ((position - mouse)).norm() * (radius + R);
|
||||
Vec2Df connector = position - ((position - mouse)).norm() * (radius + RADIUS);
|
||||
float opacity = 150.0f - Clamp(position.dist(mouse), 0.0f, 150.0f);
|
||||
|
||||
if(hover_connect){
|
||||
@@ -166,3 +168,5 @@ class MidiNode : public Node{
|
||||
if(highlighted) DrawCircleLinesV(position, radius+2, (Color){255, 0, 0, 200});
|
||||
}
|
||||
};
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(MidiNode, id, nodeType, send_note, send_cc, send_pc, send_pitch_bend, midi_outs, mode, midi_note_channel, midi_note, midi_velocity, midi_gate, midi_cc_channel, midi_cc, midi_cc_value, midi_pc_channel, midi_pc, midi_pc_value, midi_pitch_bend_channel, midi_pitch_bend)
|
||||
|
||||
Reference in New Issue
Block a user