forked from NaiJi/project-kyoku
Implement classic arrow sprite interface
parent
bbed8247ea
commit
09f74932ea
@ -0,0 +1,15 @@
|
|||||||
|
#include "notegraphicsentity.h"
|
||||||
|
|
||||||
|
NoteGraphicsEntity::NoteGraphicsEntity() :
|
||||||
|
_attached(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void NoteGraphicsEntity::attach() noexcept
|
||||||
|
{
|
||||||
|
_attached = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NoteGraphicsEntity::detach() noexcept
|
||||||
|
{
|
||||||
|
_attached = false;
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef NOTEGRAPHICSENTITY_H
|
||||||
|
#define NOTEGRAPHICSENTITY_H
|
||||||
|
|
||||||
|
#include <SFML/Graphics/Drawable.hpp>
|
||||||
|
#include <SFML/Graphics/Transformable.hpp>
|
||||||
|
|
||||||
|
class NoteGraphicsEntity : public sf::Drawable, public sf::Transformable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit NoteGraphicsEntity();
|
||||||
|
virtual ~NoteGraphicsEntity() = 0;
|
||||||
|
|
||||||
|
virtual void update() = 0;
|
||||||
|
|
||||||
|
virtual void attach() noexcept final;
|
||||||
|
virtual void detach() noexcept final;
|
||||||
|
|
||||||
|
virtual void onKeyPressed() = 0;
|
||||||
|
virtual void onKeyReleased() = 0;
|
||||||
|
|
||||||
|
virtual void show() = 0;
|
||||||
|
virtual void killAsExpired() = 0;
|
||||||
|
virtual void reset() = 0;
|
||||||
|
|
||||||
|
virtual bool isActive() const = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool _attached;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -1,21 +0,0 @@
|
|||||||
#include "notesprite.h"
|
|
||||||
|
|
||||||
NoteSprite::NoteSprite() :
|
|
||||||
_state(State::DETACHED),
|
|
||||||
_attached(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void NoteSprite::attach() noexcept
|
|
||||||
{
|
|
||||||
_attached = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NoteSprite::detach() noexcept
|
|
||||||
{
|
|
||||||
_attached = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NoteSprite::initState(State nextState) noexcept
|
|
||||||
{
|
|
||||||
_state = nextState;
|
|
||||||
}
|
|
@ -1,36 +0,0 @@
|
|||||||
#ifndef NOTESPRITE_H
|
|
||||||
#define NOTESPRITE_H
|
|
||||||
|
|
||||||
#include <SFML/Graphics/Drawable.hpp>
|
|
||||||
#include <SFML/Graphics/Transformable.hpp>
|
|
||||||
|
|
||||||
class NoteSprite : public sf::Drawable, public sf::Transformable
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
enum class State
|
|
||||||
{
|
|
||||||
APPEARING,
|
|
||||||
ACTIVE,
|
|
||||||
TAPPED,
|
|
||||||
DYING,
|
|
||||||
|
|
||||||
DETACHED
|
|
||||||
};
|
|
||||||
|
|
||||||
explicit NoteSprite();
|
|
||||||
virtual ~NoteSprite() = 0;
|
|
||||||
|
|
||||||
virtual void update() = 0;
|
|
||||||
|
|
||||||
virtual void attach() noexcept final;
|
|
||||||
virtual void detach() noexcept final;
|
|
||||||
|
|
||||||
virtual void initState(State nextState) noexcept final;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
State _state;
|
|
||||||
bool _attached;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // NOTESPRITE_H
|
|
Loading…
Reference in New Issue