SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
Event.hpp File Reference
#include <Core/OSDef.hpp>
#include <string>
#include <functional>
#include <unordered_map>
#include <vector>
#include <Events/Delegate.hpp>

Go to the source code of this file.

Classes

class  Sleak::Event
class  Sleak::EventDispatcher

Namespaces

namespace  Sleak
 Root namespace for everything the engine exposes.

Macros

#define BIND_FUNC_0(Function, class_name)
#define BIND_FUNC_1(Function, class_name)
#define BIND_FUNC_2(Function, class_name)
#define BIND_FUNC_3(Function, class_name)
#define BIND_LAMBDA(fn)
#define EVENT_CLASS_CATEGORY(category)
#define EVENT_CLASS_TYPE(type)
#define GET_DISPATCHER   Sleak::EventDispatcher::GetInstance()

Enumerations

enum class  Sleak::EventCategory {
  Sleak::EventCategory::None = (1 << 0) , Sleak::EventCategory::Application = (1 << 1) , Sleak::EventCategory::Input = (1 << 2) , Sleak::EventCategory::Keyboard = (1 << 3) ,
  Sleak::EventCategory::Mouse = (1 << 4) , Sleak::EventCategory::MouseButton = (1 << 5)
}
enum class  Sleak::EventType {
  Sleak::EventType::Unknown = 0 , Sleak::EventType::WindowOpen , Sleak::EventType::WindowClose , Sleak::EventType::WindowResize ,
  Sleak::EventType::WindowFullscreen , Sleak::EventType::WindowFocus , Sleak::EventType::WindowLostFocus , Sleak::EventType::WindowMoved ,
  Sleak::EventType::Tick , Sleak::EventType::Update , Sleak::EventType::Render , Sleak::EventType::KeyPressed ,
  Sleak::EventType::KeyReleased , Sleak::EventType::KeyTyped , Sleak::EventType::MousePressed , Sleak::EventType::MouseReleased ,
  Sleak::EventType::MouseMoved , Sleak::EventType::MouseScrolled
}

Functions

template<typename T, typename... Args>
void Sleak::DispatchEvent (Args &&... args)
 Constructs a T from args and dispatches it through EventDispatcher.
std::ostream & Sleak::operator<< (std::ostream &os, const Event &e)

Macro Definition Documentation

◆ BIND_FUNC_0

#define BIND_FUNC_0 ( Function,
class_name )
Value:
std::bind(&class_name::Function, this)

Definition at line 13 of file Event.hpp.

◆ BIND_FUNC_1

#define BIND_FUNC_1 ( Function,
class_name )
Value:
std::bind(&class_name::Function, this, std::placeholders::_1)

Definition at line 14 of file Event.hpp.

◆ BIND_FUNC_2

#define BIND_FUNC_2 ( Function,
class_name )
Value:
std::bind(&class_name::Function, this, std::placeholders::_2)

Definition at line 15 of file Event.hpp.

◆ BIND_FUNC_3

#define BIND_FUNC_3 ( Function,
class_name )
Value:
std::bind(&class_name::Function, this, std::placeholders::_3)

Definition at line 16 of file Event.hpp.

◆ BIND_LAMBDA

#define BIND_LAMBDA ( fn)
Value:
[this](auto&&... args) -> decltype(auto) { return this->fn(std::forward<decltype(args)>(args)...); }

Definition at line 12 of file Event.hpp.

◆ EVENT_CLASS_CATEGORY

#define EVENT_CLASS_CATEGORY ( category)
Value:
virtual int GetCategoryFlags() const override \
{ return static_cast<int>(category); }

Definition at line 56 of file Event.hpp.

◆ EVENT_CLASS_TYPE

#define EVENT_CLASS_TYPE ( type)
Value:
static EventType GetStaticType() \
{ \
return EventType::type;\
}\
virtual EventType GetEventType() const override \
{\
return GetStaticType();\
}\
virtual const char* GetName() const override \
{\
return #type;\
}

Definition at line 42 of file Event.hpp.

◆ GET_DISPATCHER

#define GET_DISPATCHER   Sleak::EventDispatcher::GetInstance()

Definition at line 18 of file Event.hpp.