42 lines
777 B
C++
42 lines
777 B
C++
#pragma once
|
|
|
|
#include <raylib.h>
|
|
|
|
#include "datatypes.h"
|
|
#include "moveable.h"
|
|
|
|
class Signal : public Movable{
|
|
public:
|
|
|
|
Signal();
|
|
Signal(float x, float y, float r, float _speed, Color color) : Movable(Vec2D<float>(x, y), Vec2D<float>(0,0), _speed), radius(r), color(color) {}
|
|
|
|
int id = 0;
|
|
|
|
int next;
|
|
int last;
|
|
|
|
int start;
|
|
|
|
bool at_target = false;
|
|
int target_node_id = 1;
|
|
int source_node_id = 0;
|
|
|
|
float radius;
|
|
|
|
float multiplier = 1.0f;
|
|
|
|
Color color;
|
|
|
|
void update(double t_delta){
|
|
// 120px / 16th = 1920px / whole note
|
|
// whole note = 2s at 120bpm
|
|
// 960px / s
|
|
position += direction.norm() * speed * multiplier * (float)t_delta / 1000000.0f;
|
|
}
|
|
|
|
void draw(Vec2D<float> *mouse, Camera2D *cam) {
|
|
DrawCircle(position.x, position.y, radius, color);
|
|
}
|
|
};
|