Resize on hover taken out. ModNode introduced but needs a better ui approach.

This commit is contained in:
Sebastian
2024-12-13 00:30:31 +01:00
parent bc8c433e47
commit 7f2d16932f
5 changed files with 346 additions and 31 deletions
+28 -28
View File
@@ -259,11 +259,11 @@ 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;
}
/*if(hovering()) {*/
/* radius += radius < hover_radius ? 2 : 0;*/
/*} else {*/
/* radius -= radius > node_radius ? 2 : 0;*/
/*}*/
if(hovering() || selected) interact();
@@ -304,23 +304,23 @@ 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(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;
@@ -329,32 +329,32 @@ namespace VISEQ::GRAPH::NODES {
case 0:
value = (float)getNotes().gate/1000.0f;
offset_gate = MeasureText(std::format("{:.2f}", value).c_str(), 12);
DrawText(std::format("{:.2f}",value).c_str(), position.x-offset_gate/2.0f, position.y-5, 12, VS_COLOR_BLACK );
DrawText(std::format("{:.2f}",value).c_str(), position.x-offset_gate/2.0f, position.y-5, 12, WHITE );
break;
case 1:
value = (float)getCC().value;
offset_gate = MeasureText(std::format("{}", value).c_str(), 12);
DrawText(std::format("{}",value).c_str(), position.x-offset_gate/2.0f, position.y-5, 12, VS_COLOR_BLACK );
DrawText(std::format("{}",value).c_str(), position.x-offset_gate/2.0f, position.y-5, 12, WHITE );
break;
case 2:
value = (float)getPitchBend().value;
offset_gate = MeasureText(std::format("{}", value).c_str(), 12);
DrawText(std::format("{}",value).c_str(), position.x-offset_gate/2.0f, position.y-5, 12, VS_COLOR_BLACK );
DrawText(std::format("{}",value).c_str(), position.x-offset_gate/2.0f, position.y-5, 12, WHITE );
break;
}
} else {
switch(mode){
case 0:{
int offset = MeasureText(MIDI::Notes[(int)getNotes().note].c_str(), 12);
DrawText(MIDI::Notes[getNotes().note].c_str(), position.x-offset/2.0f, position.y-5, 12, VS_COLOR_BLACK );
DrawText(MIDI::Notes[getNotes().note].c_str(), position.x-offset/2.0f, position.y-5, 12, WHITE );
break;}
case 1:{
int offset = MeasureText(std::format("{}", getCC().control).c_str(), 12);
DrawText(std::format("{}", getCC().control).c_str(), position.x-offset/2.0f, position.y-5, 12, VS_COLOR_BLACK );
DrawText(std::format("{}", getCC().control).c_str(), position.x-offset/2.0f, position.y-5, 12, WHITE );
break;}
case 2:{
int offset = MeasureText(std::format("{}", getPitchBend().value).c_str(), 12);
DrawText(std::format("{}", getPitchBend().value).c_str(), position.x-offset/2.0f, position.y-5, 12, VS_COLOR_BLACK );
DrawText(std::format("{}", getPitchBend().value).c_str(), position.x-offset/2.0f, position.y-5, 12, WHITE );
break;}
}
}