2024-10-09 02:01:23 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2024-10-13 04:22:09 +02:00
|
|
|
#include <raylib.h>
|
2024-10-09 02:01:23 +02:00
|
|
|
#include "moveable.h"
|
|
|
|
|
|
2024-11-02 23:12:38 +01:00
|
|
|
#include "node.h"
|
|
|
|
|
#include "edge.h"
|
|
|
|
|
|
2024-11-03 03:48:49 +01:00
|
|
|
using namespace VISEQ::GRAPH;
|
2024-10-09 02:01:23 +02:00
|
|
|
|
2024-11-03 03:48:49 +01:00
|
|
|
namespace VISEQ::SIGNAL {
|
|
|
|
|
class Signal : public BASE::Movable{
|
|
|
|
|
public:
|
2024-10-13 04:22:09 +02:00
|
|
|
|
2024-11-04 01:00:59 +01:00
|
|
|
Signal() {}
|
2024-11-03 03:48:49 +01:00
|
|
|
Signal(Vec2Df position, float r, float _speed, Color color) : Movable(position, Vec2Df(0,0), _speed), radius(r), color(color) {}
|
|
|
|
|
|
2024-12-03 01:25:49 +01:00
|
|
|
NODES::WPTR_Node next;
|
|
|
|
|
NODES::WPTR_Node last;
|
|
|
|
|
EDGES::WPTR_Edge edge;
|
2024-10-24 21:05:05 +02:00
|
|
|
|
2024-12-03 01:25:49 +01:00
|
|
|
NODES::WPTR_Node start;
|
2024-10-09 02:01:23 +02:00
|
|
|
|
2024-11-03 03:48:49 +01:00
|
|
|
bool at_target = false;
|
2024-11-04 01:00:59 +01:00
|
|
|
bool run = true;
|
2024-10-09 02:01:23 +02:00
|
|
|
|
2024-11-04 01:00:59 +01:00
|
|
|
float radius = 8.0f;
|
2024-10-25 02:43:41 +02:00
|
|
|
|
2024-11-03 03:48:49 +01:00
|
|
|
float multiplier = 1.0f;
|
2024-10-22 03:07:11 +02:00
|
|
|
|
2024-11-03 03:48:49 +01:00
|
|
|
Color color;
|
2024-10-22 01:55:31 +02:00
|
|
|
|
2024-11-07 00:01:54 +01:00
|
|
|
bool ui_edit_speed = false;
|
|
|
|
|
|
2024-11-04 01:00:59 +01:00
|
|
|
int midi_note_offset = 0;
|
|
|
|
|
int midi_cc_offset = 0;
|
2024-12-03 01:25:49 +01:00
|
|
|
|
|
|
|
|
void reset(){
|
|
|
|
|
toStart();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void toStart(){
|
|
|
|
|
position = start.lock()->position;
|
|
|
|
|
}
|
2024-11-04 01:00:59 +01:00
|
|
|
|
2024-11-03 03:48:49 +01:00
|
|
|
void update(double t_delta){
|
|
|
|
|
// 120px / 16th = 1920px / whole note
|
|
|
|
|
// whole note = 2s at 120bpm
|
|
|
|
|
// 960px / s
|
2024-11-04 01:00:59 +01:00
|
|
|
if(run) position += direction.norm() * speed * multiplier * (float)t_delta / 1000000.0f;
|
2024-11-03 03:48:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void draw(Vec2Df mouse, Camera2D cam) {
|
|
|
|
|
DrawCircle(position.x, position.y, radius, color);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|