Provides commonly used macros along with project wide typedefs.
More...
Go to the source code of this file.
|
| namespace | Muto |
| | The main namespace for the Muto engine.
|
| |
|
| #define | BIND_EVENT_FN(x) std::bind(&Application::x, this, std::placeholders::_1) |
| | Binds the given member function of the Application class as an event handler.
|
| |
| #define | BIT(x) (1 << x) |
| | Macro to shift 1 by x positions to create a bitmask.
|
| |
| #define | EVENT_CLASS_CATEGORY(category) virtual int GetCategoryFlags() const override { return category; } |
| | Macro to define event category in event subclasses.
|
| |
| #define | EVENT_CLASS_TYPE(type) |
| | Macro to define event type in event subclasses.
|
| |
| #define | MU_BIND_EVENT_FN(fn) [this](auto&&... args) -> decltype(auto) { return this->fn(std::forward<decltype(args)>(args)...); } |
| | Binds a member function as an event handler.
|
| |
|
| template<typename T > |
| using | Muto::Ref = std::shared_ptr< T > |
| | A smart pointer type representing shared ownership of an object.
|
| |
| template<typename T > |
| using | Muto::Scope = std::unique_ptr< T > |
| | A smart pointer type representing exclusive ownership of an object.
|
| |
|
| template<typename T , typename... Args> |
| constexpr Ref< T > | Muto::CreateRef (Args &&... args) |
| | Creates a Ref (shared_ptr) for the given type and constructor arguments.
|
| |
| template<typename T , typename... Args> |
| constexpr Scope< T > | Muto::CreateScope (Args &&... args) |
| | Creates a Scope (unique_ptr) for the given type and constructor arguments.
|
| |
Provides commonly used macros along with project wide typedefs.
- Author
- Damon S. Green II
◆ BIND_EVENT_FN
| #define BIND_EVENT_FN |
( |
|
x | ) |
std::bind(&Application::x, this, std::placeholders::_1) |
Binds the given member function of the Application class as an event handler.
- Parameters
-
| x | The member function to bind. |
◆ BIT
| #define BIT |
( |
|
x | ) |
(1 << x) |
Macro to shift 1 by x positions to create a bitmask.
- Parameters
-
| x | The number of positions to shift. |
- Returns
- The resulting bitmask.
- Note
- This macro is typically used for defining event categories.
- Warning
- Be cautious when using this macro with values greater than or equal to the number of bits in an integer, as it may lead to undefined behavior.
- Attention
- This macro is not type-safe; consider using constexpr functions or enum classes for better type safety.
◆ EVENT_CLASS_CATEGORY
| #define EVENT_CLASS_CATEGORY |
( |
|
category | ) |
virtual int GetCategoryFlags() const override { return category; } |
Macro to define event category in event subclasses.
- Parameters
-
| category | The event category to define. |
◆ EVENT_CLASS_TYPE
| #define EVENT_CLASS_TYPE |
( |
|
type | ) |
|
Value: static EventType GetStaticType() { return EventType::ET_##type; }\
virtual EventType GetEventType() const override { return GetStaticType(); }\
virtual const char* GetName() const override { return #type; }
Macro to define event type in event subclasses.
- Parameters
-
| type | The event type to define. |
25 { return EventType::ET_##type; }\
26 virtual EventType GetEventType()
const override {
return GetStaticType(); }\
27 virtual const char* GetName() const override { return #type; }
EventType
Enumeration of event types.
Definition Event.h:12
◆ MU_BIND_EVENT_FN
| #define MU_BIND_EVENT_FN |
( |
|
fn | ) |
[this](auto&&... args) -> decltype(auto) { return this->fn(std::forward<decltype(args)>(args)...); } |
Binds a member function as an event handler.
- Parameters
-
| fn | The member function to bind. |