game/mario/mario_visitor.hpp

62 lines
1.2 KiB
C++

#ifndef MARIO_VISITOR_H
#define MARIO_VISITOR_H
#include "../sdlpp/sdlpp_visitor.hpp"
#include "../sdlpp/sdlpp_geometry.hpp"
class MarioVisitor : public SDLPP::Visitor {
public:
MarioVisitor() {}
virtual void visit( const SDLPP::RenderObject &obj ) override;
bool isOnGround() {
return onGround;
}
bool isDead() {
return death;
}
bool isStopped() {
return stop;
}
double newXPos() {
return newX;
}
virtual void setFromId( uint64_t id ) override {
from = id;
}
virtual uint64_t getFromId() override {
return from;
}
virtual void setVisitorType( uint64_t type ) override {
_type = type;
}
virtual uint64_t getVisitorType() override {
return _type;
}
bool canGoLeft() {
return !left;
}
bool canGoRight() {
return !right;
}
double getGroundY() {
return groundY;
}
bool topBlock() {
return top_hit;
}
private:
bool onGround = false;
double groundY = 0;
bool death = false;
bool stop = false;
double newX;
uint64_t from = -1;
bool left = false;
bool right = false;
uint64_t _type = 0;
bool top_hit = false;
};
#endif