Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sprite_move_event.h
Go to the documentation of this file.
1 #ifndef SPRITE_MOVE_EVENT_H
2 #define SPRITE_MOVE_EVENT_H
3 #include "events/event.h"
4 #include <glm/glm.hpp>
5 
6 //= SCRIPTABLE
7 //= SCRIPTABLE BASES Event
8 
9 namespace Game {
13  class SpriteMoveEvent : public Events::Event {
14  private:
15  glm::vec2 velocity;
16  glm::vec2 next_position;
17  public:
18  //= BEGIN SCRIPTABLE
19 
26  SpriteMoveEvent(const glm::vec2& velocity, const glm::vec2& next_position) : Event(Events::EventType::SPRITE_MOVE), velocity(velocity), next_position(next_position) {}
35  static std::shared_ptr<SpriteMoveEvent> create(glm::vec2& velocity, const glm::vec2& next_position) { return std::make_shared<SpriteMoveEvent>(velocity, next_position); }
41  glm::vec2 getVelocity() const noexcept { return velocity; }
47  glm::vec2 getNextPosition() const noexcept { return next_position; }
48  //= END SCRIPTABLE
49  };
50 }
51 #endif
glm::vec2 getNextPosition() const noexcept
Gets the next position.
Definition: sprite_move_event.h:47
Class for event.
Definition: event.h:10
static std::shared_ptr< SpriteMoveEvent > create(glm::vec2 &velocity, const glm::vec2 &next_position)
SpriteMoveEvent factory function.
Definition: sprite_move_event.h:35
Class for sprite move event.
Definition: sprite_move_event.h:13
SpriteMoveEvent(const glm::vec2 &velocity, const glm::vec2 &next_position)
SpriteMoveEvent constructor.
Definition: sprite_move_event.h:26
EventType
Event type enum that is used when passing events.
Definition: event_type.h:12
glm::vec2 getVelocity() const noexcept
Gets the velocity.
Definition: sprite_move_event.h:41
Event(const EventType &type)
Event constructor.
Definition: event.h:21
Definition: event_type.h:23