Vector UI on its way!
This commit is contained in:
+79
-33
@@ -1,17 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "button.h"
|
||||
#include "config-node.h"
|
||||
#include "control-node.h"
|
||||
#include "datatypes.h"
|
||||
#include "edge.h"
|
||||
#include "node-handle.h"
|
||||
#include "node.h"
|
||||
#include "raylib.h"
|
||||
#include "raymath.h"
|
||||
#include "state.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <random>
|
||||
|
||||
namespace VISEQ::APP::UI{
|
||||
class AppUI;
|
||||
@@ -29,8 +27,13 @@ namespace VISEQ::GRAPH::NODES {
|
||||
MIDI::MidiPitchBend midiPitchBend;
|
||||
MIDI::MidiAftertouch midiAftertouch;
|
||||
MIDI::MidiPolyPressure midiPolyPressure;
|
||||
|
||||
std::vector<APP::UI::ButtonRound> channelButtons;
|
||||
|
||||
std::vector<std::shared_ptr<NodeHandle<int>>> midiNoteHandles;
|
||||
std::vector<std::shared_ptr<NodeHandle<int>>> midiCCHandles;
|
||||
std::vector<std::shared_ptr<NodeHandle<int>>> midiPCHandles;
|
||||
std::vector<std::shared_ptr<NodeHandle<int>>> midiPitchBendHandles;
|
||||
std::vector<std::shared_ptr<NodeHandle<int>>> midiAftertouchHandles;
|
||||
std::vector<std::shared_ptr<NodeHandle<int>>> midiPolyPressureHandles;
|
||||
|
||||
public:
|
||||
|
||||
@@ -67,11 +70,29 @@ namespace VISEQ::GRAPH::NODES {
|
||||
float last = 0;
|
||||
|
||||
void init(){
|
||||
channelButtons.clear();
|
||||
for(int i = 0; i < 16; ++i){
|
||||
channelButtons.emplace_back(position, 4.0f, VS_COLOR_YELLOW);
|
||||
channelButtons.back().hover_color = VS_COLOR_PINK;
|
||||
}
|
||||
midiNoteHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiNote.note, position, VS_COLOR_GREEN, "NOTE"));
|
||||
midiNoteHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiNote.channel, position, VS_COLOR_PINK, "CHANNEL", 0, 15, 40, 150));
|
||||
midiNoteHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiNote.gate, position, VS_COLOR_RED, "GATE", 0, 30000, 40, 300));
|
||||
midiNoteHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiNote.velocity, position, VS_COLOR_PURPLE, "VELOCITY"));
|
||||
|
||||
|
||||
midiCCHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiCC.control, position, VS_COLOR_SUN, "CONTROL"));
|
||||
midiCCHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiCC.channel, position, VS_COLOR_PINK, "CHANNEL", 0, 15, 40, 150));
|
||||
midiCCHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiCC.value, position, VS_COLOR_GREEN, "VALUE"));
|
||||
|
||||
midiPCHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiPC.program, position, VS_COLOR_SUN, "PROGRAM"));
|
||||
midiPCHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiPC.channel, position, VS_COLOR_PINK, "CHANNEL", 0, 15, 40, 150));
|
||||
midiPCHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiPC.value, position, VS_COLOR_GREEN, "VALUE"));
|
||||
|
||||
midiPitchBendHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiPitchBend.channel, position, VS_COLOR_PINK, "CHANNEL", 0, 15, 40, 150));
|
||||
midiPitchBendHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiPitchBend.value, position, VS_COLOR_GREEN, "VALUE", -8192, 8192, 40, 300));
|
||||
|
||||
midiAftertouchHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiAftertouch.channel, position, VS_COLOR_PINK, "CHANNEL", 0, 15, 40, 150));
|
||||
midiAftertouchHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiAftertouch.value, position, VS_COLOR_GREEN, "VALUE"));
|
||||
|
||||
midiPolyPressureHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiPolyPressure.channel, position, VS_COLOR_PINK, "CHANNEL", 0, 15, 40, 150));
|
||||
midiPolyPressureHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiPolyPressure.value, position, VS_COLOR_GREEN, "VALUE"));
|
||||
midiPolyPressureHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiPolyPressure.note, position, VS_COLOR_SUN, "NOTE"));
|
||||
}
|
||||
|
||||
std::shared_ptr<MidiNode> getPtr(){
|
||||
@@ -156,6 +177,24 @@ namespace VISEQ::GRAPH::NODES {
|
||||
void update() override {
|
||||
Node::update();
|
||||
mode = state->node_mode;
|
||||
for(auto mh : midiNoteHandles){
|
||||
mh->update(position);
|
||||
}
|
||||
for(auto mh : midiCCHandles){
|
||||
mh->update(position);
|
||||
}
|
||||
for(auto mh : midiPCHandles){
|
||||
mh->update(position);
|
||||
}
|
||||
for(auto mh : midiPitchBendHandles){
|
||||
mh->update(position);
|
||||
}
|
||||
for(auto mh : midiAftertouchHandles){
|
||||
mh->update(position);
|
||||
}
|
||||
for(auto mh : midiPolyPressureHandles){
|
||||
mh->update(position);
|
||||
}
|
||||
}
|
||||
|
||||
void modMidiNote(int incr){
|
||||
@@ -263,11 +302,36 @@ namespace VISEQ::GRAPH::NODES {
|
||||
|
||||
void draw(Vec2Df mouse, Camera2D cam) override {
|
||||
Node::draw();
|
||||
/*if(hovering()) {*/
|
||||
/* radius += radius < hover_radius ? 2 : 0;*/
|
||||
/*} else {*/
|
||||
/* radius -= radius > node_radius ? 2 : 0;*/
|
||||
/*}*/
|
||||
for(auto mh : midiNoteHandles){
|
||||
if(mode == 0) mh->unlock();
|
||||
else mh->lock();
|
||||
mh->draw();
|
||||
}
|
||||
for(auto mh : midiCCHandles){
|
||||
if(mode == 1) mh->unlock();
|
||||
else mh->lock();
|
||||
mh->draw();
|
||||
}
|
||||
for(auto mh : midiPCHandles){
|
||||
if(mode == 2) mh->unlock();
|
||||
else mh->lock();
|
||||
mh->draw();
|
||||
}
|
||||
for(auto mh : midiPitchBendHandles){
|
||||
if(mode == 3) mh->unlock();
|
||||
else mh->lock();
|
||||
mh->draw();
|
||||
}
|
||||
for(auto mh : midiAftertouchHandles){
|
||||
if(mode == 4) mh->unlock();
|
||||
else mh->lock();
|
||||
mh->draw();
|
||||
}
|
||||
for(auto mh : midiPolyPressureHandles){
|
||||
if(mode == 5) mh->unlock();
|
||||
else mh->lock();
|
||||
mh->draw();
|
||||
}
|
||||
|
||||
if(hovering() || selected) interact();
|
||||
|
||||
@@ -308,24 +372,6 @@ namespace VISEQ::GRAPH::NODES {
|
||||
|
||||
if(selected) DrawCircleLinesV(position, radius+8, (Color){158, 255, 210, 255});
|
||||
|
||||
/*if(hovering()){*/
|
||||
/* for(int i = 0; i < 16; ++i){*/
|
||||
/* channelButtons.at(i).position = position.orbitAtAngle(radius - 6.0f, DEG2RAD * (360.0f/16.0f)*i);*/
|
||||
/* Color col = VS_COLOR_YELLOW;*/
|
||||
/* if(mode == 0 && midiNote.channel == i) col = VS_COLOR_PINK;*/
|
||||
/* if(mode == 1 && midiCC.channel == i) col = VS_COLOR_PINK;*/
|
||||
/* if(mode == 2 && midiPitchBend.channel == i) col = VS_COLOR_PINK;*/
|
||||
/* channelButtons.at(i).color = col;*/
|
||||
/* channelButtons.at(i).draw();*/
|
||||
/* if(channelButtons.at(i).hovering()) DrawCenteredText(std::format("{}", i+1), position + (Vec2Df){0,10.0f}, 8, VS_COLOR_WHITE);*/
|
||||
/* if(channelButtons.at(i).clicked()) {*/
|
||||
/* if(mode == 0) midiNote.channel = i;*/
|
||||
/* if(mode == 1) midiCC.channel = i;*/
|
||||
/* if(mode == 2) midiPitchBend.channel = i;*/
|
||||
/* }*/
|
||||
/* }*/
|
||||
/*}*/
|
||||
|
||||
if(KEYS_DOWN.alt){
|
||||
float value = 0;
|
||||
int offset_gate = 0;
|
||||
|
||||
Reference in New Issue
Block a user