more textures and ui refinements
@@ -7,7 +7,7 @@
|
|||||||
viewBox="0 0 512 512"
|
viewBox="0 0 512 512"
|
||||||
version="1.1"
|
version="1.1"
|
||||||
id="svg1"
|
id="svg1"
|
||||||
inkscape:export-filename="blocker_open.png"
|
inkscape:export-filename="blocker_closed.png"
|
||||||
inkscape:export-xdpi="24"
|
inkscape:export-xdpi="24"
|
||||||
inkscape:export-ydpi="24"
|
inkscape:export-ydpi="24"
|
||||||
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
|
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
@@ -27,9 +27,9 @@
|
|||||||
inkscape:deskcolor="#d1d1d1"
|
inkscape:deskcolor="#d1d1d1"
|
||||||
inkscape:document-units="px"
|
inkscape:document-units="px"
|
||||||
showguides="true"
|
showguides="true"
|
||||||
inkscape:zoom="1.6119415"
|
inkscape:zoom="0.80597077"
|
||||||
inkscape:cx="67.930503"
|
inkscape:cx="-42.805522"
|
||||||
inkscape:cy="246.59703"
|
inkscape:cy="129.65731"
|
||||||
inkscape:window-width="2560"
|
inkscape:window-width="2560"
|
||||||
inkscape:window-height="1414"
|
inkscape:window-height="1414"
|
||||||
inkscape:window-x="2560"
|
inkscape:window-x="2560"
|
||||||
@@ -60,28 +60,37 @@
|
|||||||
id="rect1"
|
id="rect1"
|
||||||
width="282.46313"
|
width="282.46313"
|
||||||
height="512"
|
height="512"
|
||||||
x="114.76843"
|
x="-1027.9529"
|
||||||
y="0"
|
y="0"
|
||||||
ry="141.23157" />
|
ry="141.23157" />
|
||||||
<circle
|
<circle
|
||||||
style="fill:#b4d273;fill-opacity:1"
|
style="fill:#b4d273;fill-opacity:1"
|
||||||
id="path2"
|
id="path2"
|
||||||
cx="-409.89764"
|
cx="256"
|
||||||
cy="256"
|
cy="256"
|
||||||
r="256" />
|
r="256" />
|
||||||
<rect
|
|
||||||
style="fill:#d6d6d6;fill-opacity:1;fill-rule:evenodd"
|
|
||||||
id="rect2"
|
|
||||||
width="419.79556"
|
|
||||||
height="45.092152"
|
|
||||||
x="-465.89786"
|
|
||||||
y="233.45387"
|
|
||||||
transform="rotate(-90.000013)" />
|
|
||||||
<circle
|
<circle
|
||||||
style="fill:#d6d6d6;fill-opacity:1;stroke-width:0.283738"
|
style="fill:#d6d6d6;fill-opacity:1;stroke-width:0.832073"
|
||||||
id="path2-7"
|
id="path2-7"
|
||||||
cx="256"
|
cx="256"
|
||||||
cy="256"
|
cy="256"
|
||||||
r="72.636879" />
|
r="213.01056" />
|
||||||
|
<rect
|
||||||
|
style="fill:#b4d273;fill-opacity:1;fill-rule:evenodd"
|
||||||
|
id="rect2"
|
||||||
|
width="45.621445"
|
||||||
|
height="300.92609"
|
||||||
|
x="233.18927"
|
||||||
|
y="105.53696"
|
||||||
|
ry="22.810722" />
|
||||||
|
<rect
|
||||||
|
style="fill:#b4d273;fill-opacity:1;fill-rule:evenodd"
|
||||||
|
id="rect2-6"
|
||||||
|
width="45.621445"
|
||||||
|
height="300.92609"
|
||||||
|
x="233.18927"
|
||||||
|
y="-406.46304"
|
||||||
|
ry="22.810722"
|
||||||
|
transform="rotate(90)" />
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 29 KiB |
@@ -1,5 +1,6 @@
|
|||||||
#include "app-manager.h"
|
#include "app-manager.h"
|
||||||
|
|
||||||
|
#include "datatypes.h"
|
||||||
#include "interaction-manager.h"
|
#include "interaction-manager.h"
|
||||||
#include "nlohmann/json.hpp"
|
#include "nlohmann/json.hpp"
|
||||||
#include "graph-manager.h"
|
#include "graph-manager.h"
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <raylib.h>
|
||||||
|
|
||||||
namespace VISEQ::APP{
|
namespace VISEQ::APP{
|
||||||
void AppManager::init(){
|
void AppManager::init(){
|
||||||
@@ -19,6 +21,25 @@ namespace VISEQ::APP{
|
|||||||
canvas->camera.zoom = 1.0f;
|
canvas->camera.zoom = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppManager::loadTextures(){
|
||||||
|
TEXTURES::tex_connector = LoadTexture("resources/textures/connector.png");
|
||||||
|
TEXTURES::tex_connector_hover = LoadTexture("resources/textures/connector_hover.png");
|
||||||
|
TEXTURES::tex_connector_pressed = LoadTexture("resources/textures/connector_pressed.png");
|
||||||
|
TEXTURES::tex_connector_connected = LoadTexture("resources/textures/connector_connected.png");
|
||||||
|
TEXTURES::tex_delete = LoadTexture("resources/textures/delete.png");
|
||||||
|
TEXTURES::tex_split = LoadTexture("resources/textures/split.png");
|
||||||
|
TEXTURES::tex_blocker_open = LoadTexture("resources/textures/blocker_open.png");
|
||||||
|
TEXTURES::tex_blocker_closed= LoadTexture("resources/textures/blocker_closed.png");
|
||||||
|
TEXTURES::tex_delete_hover = LoadTexture("resources/textures/delete_hover.png");
|
||||||
|
TEXTURES::tex_split_hover = LoadTexture("resources/textures/split_hover.png");
|
||||||
|
TEXTURES::tex_blocker_open_hover = LoadTexture("resources/textures/blocker_open_hover.png");
|
||||||
|
TEXTURES::tex_blocker_closed_hover = LoadTexture("resources/textures/blocker_closed_hover.png");
|
||||||
|
TEXTURES::tex_delete_pressed = LoadTexture("resources/textures/delete_pressed.png");
|
||||||
|
TEXTURES::tex_split_pressed = LoadTexture("resources/textures/split_pressed.png");
|
||||||
|
TEXTURES::tex_blocker_open_pressed = LoadTexture("resources/textures/blocker_open_pressed.png");
|
||||||
|
TEXTURES::tex_blocker_closed_pressed = LoadTexture("resources/textures/blocker_closed_pressed.png");
|
||||||
|
}
|
||||||
|
|
||||||
void AppManager::close(){
|
void AppManager::close(){
|
||||||
std::ofstream file("state.json");
|
std::ofstream file("state.json");
|
||||||
file << json(*this);
|
file << json(*this);
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ namespace VISEQ::APP {
|
|||||||
UI::AppUI ui;
|
UI::AppUI ui;
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
void loadTextures();
|
||||||
void close();
|
void close();
|
||||||
void startSignals();
|
void startSignals();
|
||||||
void loadState();
|
void loadState();
|
||||||
|
|||||||
@@ -12,12 +12,43 @@ inline bool ViButton(Vec2Df mp, float x, float y, float radius, Color color){
|
|||||||
return (Vector2Distance(mp, (Vector2){x,y}) < radius && IsMouseButtonPressed(MOUSE_BUTTON_LEFT));
|
return (Vector2Distance(mp, (Vector2){x,y}) < radius && IsMouseButtonPressed(MOUSE_BUTTON_LEFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool ViTexButton(Vec2Df mp, Vec2Df position, float rotation, float radius, Texture2D tex, Texture2D tex_hover, Texture2D tex_pressed, Color color){
|
||||||
|
float scale = (radius*2.0f) / (float)tex.width;
|
||||||
|
Vec2Df start_position = position - Vec2Df((tex.width*scale) / 2.0f, (tex.height*scale) / 2.0f);
|
||||||
|
Vec2Df center_pos = start_position.rotateAround(position, rotation);
|
||||||
|
bool hover = Vector2Distance(mp, position) < radius;
|
||||||
|
bool pressed = hover && IsMouseButtonPressed(MOUSE_BUTTON_LEFT);
|
||||||
|
|
||||||
|
if(!hover && !pressed) DrawTexturePro(tex, Rectangle(0.0, 0.0, tex.width, tex.height), Rectangle(center_pos.x, center_pos.y, tex.width*scale, tex.height*scale), Vec2Df(0.0f,tex.height*scale/2.0f), rotation, color);
|
||||||
|
if(hover) DrawTexturePro(tex_hover, Rectangle(0.0, 0.0, tex.width, tex.height), Rectangle(center_pos.x, center_pos.y, tex.width*scale, tex.height*scale), Vec2Df(0.0f,tex.height*scale/2.0f), rotation, color);
|
||||||
|
if(pressed) DrawTexturePro(tex_pressed, Rectangle(0.0, 0.0, tex.width, tex.height), Rectangle(center_pos.x, center_pos.y, tex.width*scale, tex.height*scale), Vec2Df(0.0f,tex.height*scale/2.0f), rotation, color);
|
||||||
|
|
||||||
|
return pressed;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool ViTexButton(Vec2Df mp, Vec2Df position, float rotation, float radius, Texture2D tex, Texture2D tex_hover, Color color){
|
||||||
|
float scale = (radius*2.0f) / (float)tex.width;
|
||||||
|
Vec2Df start_position = position - Vec2Df((tex.width*scale) / 2.0f, (tex.height*scale) / 2.0f);
|
||||||
|
Vec2Df center_pos = start_position.rotateAround(position, rotation);
|
||||||
|
bool hover = Vector2Distance(mp, position) < radius;
|
||||||
|
bool pressed = hover && IsMouseButtonPressed(MOUSE_BUTTON_LEFT);
|
||||||
|
|
||||||
|
if(!hover) DrawTexturePro(tex, Rectangle(0.0, 0.0, tex.width, tex.height), Rectangle(center_pos.x, center_pos.y, tex.width*scale, tex.height*scale), Vec2Df(0.0f,tex.height*scale/2.0f), rotation, color);
|
||||||
|
if(hover) DrawTexturePro(tex_hover, Rectangle(0.0, 0.0, tex.width, tex.height), Rectangle(center_pos.x, center_pos.y, tex.width*scale, tex.height*scale), Vec2Df(0.0f,tex.height*scale/2.0f), rotation, color);
|
||||||
|
|
||||||
|
return pressed;
|
||||||
|
}
|
||||||
|
|
||||||
inline bool ViTexButton(Vec2Df mp, Vec2Df position, float rotation, float radius, Texture2D tex, Color color){
|
inline bool ViTexButton(Vec2Df mp, Vec2Df position, float rotation, float radius, Texture2D tex, Color color){
|
||||||
float scale = (radius*2.0f) / (float)tex.width;
|
float scale = (radius*2.0f) / (float)tex.width;
|
||||||
Vec2Df start_position = position - Vec2Df((tex.width*scale) / 2.0f, (tex.height*scale) / 2.0f);
|
Vec2Df start_position = position - Vec2Df((tex.width*scale) / 2.0f, (tex.height*scale) / 2.0f);
|
||||||
Vec2Df center_pos = start_position.rotateAround(position, rotation);
|
Vec2Df center_pos = start_position.rotateAround(position, rotation);
|
||||||
|
bool hover = Vector2Distance(mp, position) < radius;
|
||||||
|
bool pressed = hover && IsMouseButtonPressed(MOUSE_BUTTON_LEFT);
|
||||||
|
|
||||||
DrawTexturePro(tex, Rectangle(0.0, 0.0, tex.width, tex.height), Rectangle(center_pos.x, center_pos.y, tex.width*scale, tex.height*scale), Vec2Df(0.0f,tex.height*scale/2.0f), rotation, color);
|
DrawTexturePro(tex, Rectangle(0.0, 0.0, tex.width, tex.height), Rectangle(center_pos.x, center_pos.y, tex.width*scale, tex.height*scale), Vec2Df(0.0f,tex.height*scale/2.0f), rotation, color);
|
||||||
return (Vector2Distance(mp, position) < radius && IsMouseButtonPressed(MOUSE_BUTTON_LEFT));
|
|
||||||
|
return pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool ViButton(Vec2Df mp, Vec2Df position, float radius, Color color){
|
inline bool ViButton(Vec2Df mp, Vec2Df position, float radius, Color color){
|
||||||
|
|||||||
@@ -3,10 +3,12 @@
|
|||||||
#include "connectable.h"
|
#include "connectable.h"
|
||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
#include "graph-item.h"
|
#include "graph-item.h"
|
||||||
|
#include "helper.h"
|
||||||
//#include "interaction-event.h"
|
//#include "interaction-event.h"
|
||||||
#include "raymath.h"
|
#include "raymath.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "vmath.h"
|
#include "vmath.h"
|
||||||
|
#include "button.h"
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@@ -27,6 +29,7 @@ namespace VISEQ::GRAPH {
|
|||||||
float radius = 8.0f;
|
float radius = 8.0f;
|
||||||
float orbit = 20.0f;
|
float orbit = 20.0f;
|
||||||
Vec2Df center_position;
|
Vec2Df center_position;
|
||||||
|
Vec2Df parent_position;
|
||||||
|
|
||||||
GraphItemType getType() override{
|
GraphItemType getType() override{
|
||||||
return GraphItemType::CONNECTOR;
|
return GraphItemType::CONNECTOR;
|
||||||
@@ -46,7 +49,9 @@ namespace VISEQ::GRAPH {
|
|||||||
|
|
||||||
void setPosition(Vec2Df pos) override {
|
void setPosition(Vec2Df pos) override {
|
||||||
center_position = pos;
|
center_position = pos;
|
||||||
|
parent_position = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOrbit(float r) {
|
void setOrbit(float r) {
|
||||||
orbit = r;
|
orbit = r;
|
||||||
}
|
}
|
||||||
@@ -71,14 +76,25 @@ namespace VISEQ::GRAPH {
|
|||||||
|
|
||||||
void draw() override {
|
void draw() override {
|
||||||
BASE::Connectable::draw();
|
BASE::Connectable::draw();
|
||||||
float opacity = 150.0f - Clamp(position.dist(SCREEN_MOUSE), 0.0f, 150.0f);
|
float opacity = Clamp((400.0f - Clamp(position.dist(SCREEN_MOUSE), 0.0f, 400.0f)) / 400.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
if(hovering()){
|
float rotation;
|
||||||
DrawCircle(position.x, position.y, 8.0f, (Color){108, 203, 237, 255});
|
if(partner.expired()) rotation = HELPER::GetRotation(parent_position, SCREEN_MOUSE) + 90.0f;
|
||||||
} else {
|
if(!partner.expired()) {
|
||||||
DrawCircle(position.x, position.y, 8.0f, (Color){108, 153, 187, (unsigned char)opacity});
|
rotation = HELPER::GetRotation(position, partner.lock()->position) + 90.0f;
|
||||||
|
opacity = 1.0f;
|
||||||
}
|
}
|
||||||
|
if(connecting) opacity = 1.0f;
|
||||||
|
|
||||||
|
if(partner.expired() && !connecting) ViTexButton(SCREEN_MOUSE, position, rotation, 8.0f,
|
||||||
|
TEXTURES::tex_connector, TEXTURES::tex_connector_hover, TEXTURES::tex_connector_pressed,
|
||||||
|
ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity));
|
||||||
|
|
||||||
|
if(!partner.expired() || connecting) ViTexButton(SCREEN_MOUSE, position, rotation, 8.0f,
|
||||||
|
TEXTURES::tex_connector_connected, TEXTURES::tex_connector_hover,
|
||||||
|
ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,13 +23,32 @@
|
|||||||
|
|
||||||
#include "nlohmann/json.hpp"
|
#include "nlohmann/json.hpp"
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
#include <raylib.h>
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "libremidi/libremidi.hpp"
|
#include "libremidi/libremidi.hpp"
|
||||||
|
|
||||||
#define RANGE_FILTER(L) std::ranges::views::filter(L)
|
#define RANGE_FILTER(L) std::ranges::views::filter(L)
|
||||||
|
|
||||||
|
namespace VISEQ::TEXTURES {
|
||||||
|
inline Texture2D tex_connector;
|
||||||
|
inline Texture2D tex_connector_hover;
|
||||||
|
inline Texture2D tex_connector_pressed;
|
||||||
|
inline Texture2D tex_connector_connected;
|
||||||
|
inline Texture2D tex_delete;
|
||||||
|
inline Texture2D tex_split;
|
||||||
|
inline Texture2D tex_blocker_open;
|
||||||
|
inline Texture2D tex_blocker_closed;
|
||||||
|
inline Texture2D tex_delete_hover;
|
||||||
|
inline Texture2D tex_split_hover;
|
||||||
|
inline Texture2D tex_blocker_open_hover;
|
||||||
|
inline Texture2D tex_blocker_closed_hover;
|
||||||
|
inline Texture2D tex_delete_pressed;
|
||||||
|
inline Texture2D tex_split_pressed;
|
||||||
|
inline Texture2D tex_blocker_open_pressed;
|
||||||
|
inline Texture2D tex_blocker_closed_pressed;
|
||||||
|
}
|
||||||
|
|
||||||
namespace VISEQ::GRAPH::NODES {
|
namespace VISEQ::GRAPH::NODES {
|
||||||
enum Distribution {GEOMETRIC, ROUNDROBIN, RANDOM};
|
enum Distribution {GEOMETRIC, ROUNDROBIN, RANDOM};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,13 +30,6 @@ namespace VISEQ::GRAPH{
|
|||||||
return shared_from_this();
|
return shared_from_this();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphManager::loadTextures(){
|
|
||||||
tex_delete = LoadTexture("resources/textures/delete.png");
|
|
||||||
tex_split = LoadTexture("resources/textures/split.png");
|
|
||||||
tex_blocker_open = LoadTexture("resources/textures/blocker_open.png");
|
|
||||||
tex_blocker_closed= LoadTexture("resources/textures/blocker_closed.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
int GraphManager::getNodesSize(){
|
int GraphManager::getNodesSize(){
|
||||||
return nodes.size();
|
return nodes.size();
|
||||||
}
|
}
|
||||||
@@ -352,7 +345,6 @@ namespace VISEQ::GRAPH{
|
|||||||
void GraphManager::update(){
|
void GraphManager::update(){
|
||||||
if(!remove_edges.empty()) removeEdges();
|
if(!remove_edges.empty()) removeEdges();
|
||||||
if(!split_edges.empty()) splitEdges();
|
if(!split_edges.empty()) splitEdges();
|
||||||
if(tex_delete.width == 0 && IsWindowReady()) loadTextures();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphManager::drawEdges(Vec2Df mouse_pos, Camera2D cam){
|
void GraphManager::drawEdges(Vec2Df mouse_pos, Camera2D cam){
|
||||||
@@ -362,13 +354,16 @@ namespace VISEQ::GRAPH{
|
|||||||
float v1_v2_distance = v1_position.dist(&v2_position);
|
float v1_v2_distance = v1_position.dist(&v2_position);
|
||||||
|
|
||||||
if(v1_v2_distance < 100) c->switches_offset = v1_v2_distance/2.3f;
|
if(v1_v2_distance < 100) c->switches_offset = v1_v2_distance/2.3f;
|
||||||
Vec2Df from_to_handle = c->start.lock()->position - ((c->start.lock()->position - c->end.lock()->position)).norm()*40.0f; //.norm() * (c->start.lock()->radius + c->switches_offset);
|
Vec2Df from_to_handle = c->start.lock()->position - ((c->start.lock()->position - c->end.lock()->position)).norm()*45.0f; //.norm() * (c->start.lock()->radius + c->switches_offset);
|
||||||
Vec2Df to_from_handle = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position)).norm()*40.0f; //.norm() * (c->end.lock()->radius + c->switches_offset);
|
Vec2Df to_from_handle = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position)).norm()*45.0f; //.norm() * (c->end.lock()->radius + c->switches_offset);
|
||||||
Vec2Df middle_handle_2 = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position)).norm()*60.0f;
|
Vec2Df middle_handle_2 = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position)).norm()*65.0f;
|
||||||
Vec2Df middle_handle = c->start.lock()->position - ((c->start.lock()->position - c->end.lock()->position)).norm()*60.0f;
|
Vec2Df middle_handle = c->start.lock()->position - ((c->start.lock()->position - c->end.lock()->position)).norm()*65.0f;
|
||||||
Vec2Df center_handle = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position))*0.5f;
|
Vec2Df center_handle = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position))*0.5f;
|
||||||
Vec2Df flip_handle = middle_handle + (v1_position - v2_position).norm().orth() * (v1_v2_distance < 120.0f ? Clamp((120.0f - v1_v2_distance)*0.2, 0.f, 20.f) : 1.0f);
|
//Vec2Df flip_handle = middle_handle + (v1_position - v2_position).norm().orth() * (v1_v2_distance < 120.0f ? Clamp((120.0f - v1_v2_distance)*0.2, 0.f, 20.f) : 1.0f);
|
||||||
Vec2Df flip_handle_2 = middle_handle_2 + (v1_position - v2_position).norm().orth() * (v1_v2_distance < 120.0f ? Clamp((120.0f - v1_v2_distance)*-0.2, -20.f, 0.f) : 1.0f);
|
//Vec2Df flip_handle_2 = middle_handle_2 + (v1_position - v2_position).norm().orth() * (v1_v2_distance < 120.0f ? Clamp((120.0f - v1_v2_distance)*-0.2, -20.f, 0.f) : 1.0f);
|
||||||
|
|
||||||
|
Vec2Df delete_position = center_handle + (c->start.lock()->position - c->end.lock()->position).norm().orth() * 12.0f;
|
||||||
|
Vec2Df split_position = center_handle - (c->start.lock()->position - c->end.lock()->position).norm().orth() * 12.0f;
|
||||||
|
|
||||||
// Dynamic opacity by distance to mouse
|
// Dynamic opacity by distance to mouse
|
||||||
unsigned char opacity = 150.0f - Clamp(center_handle.dist(mouse_pos), 0.0f, 130.0f);
|
unsigned char opacity = 150.0f - Clamp(center_handle.dist(mouse_pos), 0.0f, 130.0f);
|
||||||
@@ -418,30 +413,30 @@ namespace VISEQ::GRAPH{
|
|||||||
|
|
||||||
if(!c->start.lock()->picked_up && !c->end.lock()->picked_up){
|
if(!c->start.lock()->picked_up && !c->end.lock()->picked_up){
|
||||||
// On/Off switches on both sides
|
// On/Off switches on both sides
|
||||||
Texture2D tex_forward;
|
|
||||||
Texture2D tex_backward;
|
|
||||||
|
|
||||||
if(c->pass_forward) tex_forward = tex_blocker_open;
|
if(ViTexButton(mouse_pos, from_to_handle, HELPER::GetRotation(from_to_handle, to_from_handle) + 90.0f, 8.0f,
|
||||||
if(!c->pass_forward) tex_forward = tex_blocker_closed;
|
c->pass_forward ? TEXTURES::tex_blocker_open : TEXTURES::tex_blocker_closed,
|
||||||
|
c->pass_forward ? TEXTURES::tex_blocker_open_hover : TEXTURES::tex_blocker_closed_hover,
|
||||||
|
c->pass_forward ? TEXTURES::tex_blocker_open_pressed : TEXTURES::tex_blocker_closed_pressed,
|
||||||
|
ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_from_normalized))) c->pass_forward = !c->pass_forward;
|
||||||
|
|
||||||
if(c->pass_backward) tex_backward = tex_blocker_open;
|
if(ViTexButton(mouse_pos, to_from_handle, HELPER::GetRotation(to_from_handle, from_to_handle) + 90.0f, 8.0f,
|
||||||
if(!c->pass_backward) tex_backward = tex_blocker_closed;
|
c->pass_backward ? TEXTURES::tex_blocker_open : TEXTURES::tex_blocker_closed,
|
||||||
if(IsWindowReady()){
|
c->pass_backward ? TEXTURES::tex_blocker_open_hover : TEXTURES::tex_blocker_closed_hover,
|
||||||
|
c->pass_backward ? TEXTURES::tex_blocker_open_pressed : TEXTURES::tex_blocker_closed_pressed,
|
||||||
|
ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_to_normalized))) c->pass_backward = !c->pass_backward;
|
||||||
|
|
||||||
if(ViTexButton(mouse_pos, from_to_handle, HELPER::GetRotation(from_to_handle, to_from_handle), 8.0f, tex_forward, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_from_normalized))) c->pass_forward = !c->pass_forward;
|
if(ViTexButton(mouse_pos, split_position, HELPER::GetRotation(from_to_handle, to_from_handle) + 90.0f, 8.0f,
|
||||||
|
TEXTURES::tex_split, TEXTURES::tex_split_hover, TEXTURES::tex_split_pressed, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_normalized) )) splitEdge(c);
|
||||||
if(ViTexButton(mouse_pos, to_from_handle, HELPER::GetRotation(to_from_handle, from_to_handle), 8.0f, tex_backward, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_to_normalized))) c->pass_backward = !c->pass_backward;
|
|
||||||
|
|
||||||
if(ViTexButton(mouse_pos, center_handle, HELPER::GetRotation(from_to_handle, to_from_handle) + 90.0f, 8.0f, tex_split, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_normalized) )) splitEdge(c);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(c->start.lock()->getNodeType() == NodeType::CONFIGNODE || c->end.lock()->getNodeType() == NodeType::CONFIGNODE){
|
if(c->start.lock()->getNodeType() == NodeType::CONFIGNODE || c->end.lock()->getNodeType() == NodeType::CONFIGNODE){
|
||||||
DrawLine(v1_position.x, v1_position.y, v2_position.x, v2_position.y, VS_COLOR_BLUE);
|
DrawLine(v1_position.x, v1_position.y, v2_position.x, v2_position.y, VS_COLOR_BLUE);
|
||||||
}
|
}
|
||||||
if(IsWindowReady()){
|
if(IsWindowReady()){
|
||||||
if(ViTexButton(mouse_pos, middle_handle, HELPER::GetRotation(from_to_handle, to_from_handle), 8.0f, tex_delete, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_from_normalized) )) removeEdge(c);
|
if(ViTexButton(mouse_pos, delete_position, HELPER::GetRotation(from_to_handle, to_from_handle), 8.0f,
|
||||||
if(ViTexButton(mouse_pos, middle_handle_2, HELPER::GetRotation(from_to_handle, to_from_handle), 8.0f, tex_delete, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_to_normalized) )) removeEdge(c);
|
TEXTURES::tex_delete, TEXTURES::tex_delete_hover, TEXTURES::tex_delete_pressed,
|
||||||
|
ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_normalized) )) removeEdge(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ namespace VISEQ::GRAPH {
|
|||||||
GraphManager() {}
|
GraphManager() {}
|
||||||
|
|
||||||
std::shared_ptr<GraphManager> getPtr();
|
std::shared_ptr<GraphManager> getPtr();
|
||||||
void loadTextures();
|
|
||||||
int getNodesSize();
|
int getNodesSize();
|
||||||
void createMidiNode(Vec2Df position);
|
void createMidiNode(Vec2Df position);
|
||||||
void createConfigNode(Vec2Df position);
|
void createConfigNode(Vec2Df position);
|
||||||
@@ -85,11 +84,6 @@ namespace VISEQ::GRAPH {
|
|||||||
|
|
||||||
friend void from_json(const json& j, std::shared_ptr<GraphManager>& G);
|
friend void from_json(const json& j, std::shared_ptr<GraphManager>& G);
|
||||||
friend void to_json(json& j, const std::shared_ptr<GraphManager>& G);
|
friend void to_json(json& j, const std::shared_ptr<GraphManager>& G);
|
||||||
|
|
||||||
Texture2D tex_delete;
|
|
||||||
Texture2D tex_split;
|
|
||||||
Texture2D tex_blocker_open;
|
|
||||||
Texture2D tex_blocker_closed;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,13 +52,15 @@ int main(){
|
|||||||
app.init();
|
app.init();
|
||||||
app.ui.init();
|
app.ui.init();
|
||||||
|
|
||||||
|
app.loadTextures();
|
||||||
|
|
||||||
app.loadState();
|
app.loadState();
|
||||||
|
|
||||||
app.startSignals();
|
app.startSignals();
|
||||||
|
|
||||||
while(!WindowShouldClose()){
|
while(!WindowShouldClose()){
|
||||||
app.update();
|
app.update();
|
||||||
app.draw();
|
if(IsWindowReady()) app.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
app.close();
|
app.close();
|
||||||
|
|||||||