game/mario/visitors/bounce_visitor.hpp

35 lines
720 B
C++

#ifndef BOUNCE_VISITOR_HPP
#define BOUNCE_VISITOR_HPP
#include "../../sdlpp/sdlpp_visitor.hpp"
#include "../../sdlpp/sdlpp_geometry.hpp"
class BounceVisitor : public SDLPP::Visitor {
public:
BounceVisitor() = default;
void visit( const SDLPP::RenderObject &obj ) override;
void setFromId( uint64_t id ) override {
from = id;
}
uint64_t getFromId() const override {
return from;
}
void setVisitorType( uint64_t type ) override {
_type = type;
}
uint64_t getVisitorType() const override {
return _type;
}
bool canBounce() const {
return hits < 2;
}
private:
int hits = 0;
uint64_t from{};
uint64_t _type{};
};
#endif