Files
viseq/src/signal.h
T

59 lines
1.0 KiB
C++
Raw Normal View History

2024-10-09 02:01:23 +02:00
#pragma once
#include <raylib.h>
2024-10-09 02:01:23 +02:00
#include "moveable.h"
#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:
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;
bool run = true;
2024-10-09 02:01:23 +02:00
float radius = 8.0f;
2024-11-03 03:48:49 +01:00
float multiplier = 1.0f;
2024-11-03 03:48:49 +01:00
Color color;
2024-11-07 00:01:54 +01:00
bool ui_edit_speed = false;
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-03 03:48:49 +01:00
void update(double t_delta){
// 120px / 16th = 1920px / whole note
// whole note = 2s at 120bpm
// 960px / s
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);
}
};
}