Vesper 0.5.1
Vesper is short form for the Latin word for "Bat", as Vesper is designed to be small, lightweight, and easily handle things like particles and flocking behaviors in accordance with the nature of bats. \n It is meant to be a particle simulation, VFX editor, and CAN be used secondarily as a small game engine.
GitHub | Vesper Updates | Creator
Loading...
Searching...
No Matches
Defines_Macros.h File Reference

Provides commonly used macros along with project wide typedefs. More...

Go to the source code of this file.

Namespaces

namespace  Vesper
 TEMPORARY.

Macros

#define BIT(x)
 Macro to shift 1 by x positions to create a bitmask.
#define VZ_BIND_EVENT_FN(fn)
 Binds a member function as an event handler.
#define BIND_EVENT_FN(x)
 Binds the given member function of the Application class as an event handler.
#define EVENT_CLASS_TYPE(type)
 Macro to define event type in event subclasses.
#define EVENT_CLASS_CATEGORY(category)
 Macro to define event category in event subclasses.

Typedefs

template<typename T>
using Vesper::Scope = std::unique_ptr<T>
 A smart pointer type representing exclusive ownership of an object.
template<typename T>
using Vesper::Ref = std::shared_ptr<T>
 A smart pointer type representing shared ownership of an object.

Functions

template<typename T, typename... Args>
constexpr Scope< T > Vesper::CreateScope (Args &&... args)
 Creates a Scope (unique_ptr) for the given type and constructor arguments.
template<typename T, typename... Args>
constexpr Ref< T > Vesper::CreateRef (Args &&... args)
 Creates a Ref (shared_ptr) for the given type and constructor arguments.

Detailed Description

Provides commonly used macros along with project wide typedefs.

Author
Damon S. Green II

Macro Definition Documentation

◆ BIND_EVENT_FN

#define BIND_EVENT_FN ( x)
Value:
std::bind(&Application::x, this, std::placeholders::_1)

Binds the given member function of the Application class as an event handler.

Parameters
xThe member function to bind.

◆ BIT

#define BIT ( x)
Value:
(1 << x)

Macro to shift 1 by x positions to create a bitmask.

Parameters
xThe 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)
Value:
virtual int GetCategoryFlags() const override { return category; }

Macro to define event category in event subclasses.

Parameters
categoryThe event category to define.

◆ 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; }

Macro to define event type in event subclasses.

Parameters
typeThe event type to define.
25#define EVENT_CLASS_TYPE(type) static EventType GetStaticType() { return EventType::##type; }\
26 virtual EventType GetEventType() const override { return GetStaticType(); }\
27 virtual const char* GetName() const override { return #type; }

◆ VZ_BIND_EVENT_FN

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

Binds a member function as an event handler.

Parameters
fnThe member function to bind.