-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathState.h
More file actions
34 lines (27 loc) · 737 Bytes
/
State.h
File metadata and controls
34 lines (27 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef PHYSSIN_STATE_H
#define PHYSSIN_STATE_H
#include "SFML/Graphics.hpp"
struct State : sf::Drawable {
sf::Vector2f pos, speed;
float angle = 0, sp1Length = 0, sp2Length = 0, w = 0;
State* add(const State& state){
pos += state.pos;
speed += state.speed;
angle += state.angle;
sp1Length += state.sp1Length;
sp2Length += state.sp2Length;
w += state.w;
return this;
}
State* mul(const float k){
pos *= k;
speed *= k;
angle *= k;
sp1Length *= k;
sp2Length *= k;
w *= k;
return this;
}
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
};
#endif //PHYSSIN_STATE_H