#define BREAKPOINT __asm__("int $3")
--template<typename T>
- inline const T * const& coalesce(const void * &p1, const void * &p2)
-inline const T * const& coalesce(const T * const &p1, const T * const &p2)
--{
- return ((p1 == nullptr) ? reinterpret_cast<T*>(p2) : p1);
- return ((p1 == nullptr) ? p2 : p1);
--}
++#define coalesce(v1, v2) ((v1 != nullptr) ? v1 : v2)
/**
* Creates a coordinate of integers.
en.each<Position, Direction>([dt](entityx::Entity entity, Position &position, Direction &direction) {
position.x += direction.x * dt;
position.y += direction.y * dt;
-
+
+ if (entity.has_component<Animate>() && entity.has_component<Sprite>()) {
- if (direction.x) {
++ if (direction.x) {
+ entity.component<Sprite>().get()->sprite = entity.component<Animate>().get()->nextFrame();
+ } else {
+ entity.component<Sprite>().get()->sprite = entity.component<Animate>().get()->firstFrame();
+ }
+ }
if (entity.has_component<Dialog>() && entity.component<Dialog>()->talking) {
direction.x = 0;
} else {
0.0, 1.0,
1.0, 1.0,
1.0, 0.0};
-
+
- if (entity.has_component<Animate>()) {
- sprite.sprite = entity.component<Animate>().get()->nextFrame();
- }
++ if (entity.has_component<Animate>())
++ sprite.sprite = entity.component<Animate>()->nextFrame();
+
for (auto &S : sprite.sprite) {
float width = HLINES(S.first.size.x);
float height = HLINES(S.first.size.y);