Event.hpp

Namespaces

Name

Classes

Name

Source code

/*
** EPITECH PROJECT, 2022
** RTYPE
** File description:
** Event
*/

#pragma once

namespace ecs
{
    class Event {
      public:
        enum EventType {
            Null,
            Unknown,
            Quit,
            Move,
            MoveUp,
            MoveLeft,
            MoveDown,
            MoveRight,
            MoveStop,
            HitBox,
            Shoot,
            UIUp,
            UILeft,
            UIDown,
            UIRight,
            UIEnter,
        };
        Event() = delete;

        Event(EventType e) : _e(e) {}

        inline bool operator==(const Event other) const
        {
            if (_e == other._e)
                return true;
            return false;
        }

        inline bool operator==(const Event::EventType type) const
        {
            if (_e == type)
                return true;
            return false;
        }

        inline bool operator!=(const Event other) const { return _e != other._e; };

        inline bool operator!=(const Event::EventType type) const { return _e != type; };

        inline char serialize() const { return _e; }

      private:
        const EventType _e;
    };
} // namespace ecs

Updated on 2022-11-13 at 17:21:37 +0100

Last updated