better state logic, more features, rewritten timing of signals and more crashes

This commit is contained in:
Sebastian
2024-10-25 02:43:41 +02:00
parent 95e762cb8b
commit f2f852e8dc
8 changed files with 334 additions and 291 deletions
+8 -7
View File
@@ -10,7 +10,7 @@ class Signal : public Movable{
public:
Signal();
Signal(float x, float y, float r, float s, Color color) : Movable(Vec2D<float>(x, y), Vec2D<float>(0,0), s), radius(r), color(color) {}
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;
@@ -25,17 +25,18 @@ class Signal : public Movable{
float radius;
float multiplier = 1.0f;
Color color;
void update(int fps){
void update(int 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) {
position += direction.norm() * speed;
DrawCircle(position.x, position.y, radius, color);
}
};