CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::AnyInputEvent Class Reference

A type that describes any possible event type. More...

#include <CeresEngine/Input/InputEvent.hpp>

Public Member Functions

 AnyInputEvent () noexcept=default
 Creates a new empty event.
 
 AnyInputEvent (const KeyEvent &event) noexcept
 Creates a new event with a KeyEvent struct.
 
 AnyInputEvent (const MouseEvent &event) noexcept
 Creates a new event with a MouseEvent struct.
 
 AnyInputEvent (const TextEvent &event) noexcept
 Creates a new event with a TextEvent struct.
 
 AnyInputEvent (const AnyInputEvent &)=default
 
AnyInputEventoperator= (const AnyInputEvent &)=default
 
 AnyInputEvent (AnyInputEvent &&) noexcept=default
 
AnyInputEventoperator= (AnyInputEvent &&) noexcept=default
 
 ~AnyInputEvent () noexcept=default
 
PlatformWindowgetWindow () const noexcept
 The platform window that triggered the input event, if any.
 
bool isValid () const noexcept
 Checks if the event is valid.
 
 operator bool () const noexcept
 Checks if the event is valid.
 
InputEventType getEventType () const noexcept
 Returns the type of the event represented by this AnyEvent structure.
 
template<typename T >
bool is () const noexcept
 Checks if the event is of type T.
 
template<typename T >
const Tas () const noexcept
 Gets the event as a concrete event of type T.
 
template<typename T >
Tas () noexcept
 Gets the event as a concrete event of type T.
 
bool isKeyEvent () const noexcept
 Checks if the event is of type KeyEvent.
 
const KeyEventasKeyEvent () const noexcept
 Gets the event as a concrete event of type KeyEvent.
 
KeyEventasKeyEvent () noexcept
 Gets the event as a concrete event of type KeyEvent.
 
bool isMouseEvent () const noexcept
 Checks if the event is of type MouseEvent.
 
const MouseEventasMouseEvent () const noexcept
 Gets the event as a concrete event of type MouseEvent.
 
MouseEventasMouseEvent () noexcept
 Gets the event as a concrete event of type MouseEvent.
 
bool isTextEvent () const noexcept
 Checks if the event is of type TextEvent.
 
const TextEventasTextEvent () const noexcept
 Gets the event as a concrete event of type TextEvent.
 
TextEventasTextEvent () noexcept
 Gets the event as a concrete event of type TextEvent.
 

Private Types

using Variant = Variant< std::monostate, KeyEvent, MouseEvent, TextEvent >
 The variant type used to store the event types.
 

Private Attributes

Variant mData
 The variant type used to store the event types.
 

Detailed Description

A type that describes any possible event type.

Member Typedef Documentation

◆ Variant

The variant type used to store the event types.

Constructor & Destructor Documentation

◆ AnyInputEvent() [1/6]

CeresEngine::AnyInputEvent::AnyInputEvent ( )
defaultnoexcept

Creates a new empty event.

◆ AnyInputEvent() [2/6]

CeresEngine::AnyInputEvent::AnyInputEvent ( const KeyEvent event)
inlinenoexcept

Creates a new event with a KeyEvent struct.

◆ AnyInputEvent() [3/6]

CeresEngine::AnyInputEvent::AnyInputEvent ( const MouseEvent event)
inlinenoexcept

Creates a new event with a MouseEvent struct.

◆ AnyInputEvent() [4/6]

CeresEngine::AnyInputEvent::AnyInputEvent ( const TextEvent event)
inlinenoexcept

Creates a new event with a TextEvent struct.

◆ AnyInputEvent() [5/6]

CeresEngine::AnyInputEvent::AnyInputEvent ( const AnyInputEvent )
default

◆ AnyInputEvent() [6/6]

CeresEngine::AnyInputEvent::AnyInputEvent ( AnyInputEvent &&  )
defaultnoexcept

◆ ~AnyInputEvent()

CeresEngine::AnyInputEvent::~AnyInputEvent ( )
defaultnoexcept

Member Function Documentation

◆ as() [1/2]

template<typename T >
const T & CeresEngine::AnyInputEvent::as ( ) const
inlinenoexcept

Gets the event as a concrete event of type T.

◆ as() [2/2]

template<typename T >
T & CeresEngine::AnyInputEvent::as ( )
inlinenoexcept

Gets the event as a concrete event of type T.

◆ asKeyEvent() [1/2]

const KeyEvent & CeresEngine::AnyInputEvent::asKeyEvent ( ) const
inlinenoexcept

Gets the event as a concrete event of type KeyEvent.

◆ asKeyEvent() [2/2]

KeyEvent & CeresEngine::AnyInputEvent::asKeyEvent ( )
inlinenoexcept

Gets the event as a concrete event of type KeyEvent.

◆ asMouseEvent() [1/2]

const MouseEvent & CeresEngine::AnyInputEvent::asMouseEvent ( ) const
inlinenoexcept

Gets the event as a concrete event of type MouseEvent.

◆ asMouseEvent() [2/2]

MouseEvent & CeresEngine::AnyInputEvent::asMouseEvent ( )
inlinenoexcept

Gets the event as a concrete event of type MouseEvent.

◆ asTextEvent() [1/2]

const TextEvent & CeresEngine::AnyInputEvent::asTextEvent ( ) const
inlinenoexcept

Gets the event as a concrete event of type TextEvent.

◆ asTextEvent() [2/2]

TextEvent & CeresEngine::AnyInputEvent::asTextEvent ( )
inlinenoexcept

Gets the event as a concrete event of type TextEvent.

◆ getEventType()

InputEventType CeresEngine::AnyInputEvent::getEventType ( ) const
noexcept

Returns the type of the event represented by this AnyEvent structure.

◆ getWindow()

PlatformWindow * CeresEngine::AnyInputEvent::getWindow ( ) const
noexcept

The platform window that triggered the input event, if any.

Some synthetic events can have a ´nullptr´ window.

◆ is()

template<typename T >
bool CeresEngine::AnyInputEvent::is ( ) const
inlinenoexcept

Checks if the event is of type T.

◆ isKeyEvent()

bool CeresEngine::AnyInputEvent::isKeyEvent ( ) const
inlinenoexcept

Checks if the event is of type KeyEvent.

◆ isMouseEvent()

bool CeresEngine::AnyInputEvent::isMouseEvent ( ) const
inlinenoexcept

Checks if the event is of type MouseEvent.

◆ isTextEvent()

bool CeresEngine::AnyInputEvent::isTextEvent ( ) const
inlinenoexcept

Checks if the event is of type TextEvent.

◆ isValid()

bool CeresEngine::AnyInputEvent::isValid ( ) const
noexcept

Checks if the event is valid.

If not valid, none of it's accessors can be used to convert the AnyEvent into a concrete event type.

◆ operator bool()

CeresEngine::AnyInputEvent::operator bool ( ) const
inlineexplicitnoexcept

Checks if the event is valid.

If not valid, none of it's accessors can be used to convert the AnyEvent into a concrete event type.

◆ operator=() [1/2]

AnyInputEvent & CeresEngine::AnyInputEvent::operator= ( AnyInputEvent &&  )
defaultnoexcept

◆ operator=() [2/2]

AnyInputEvent & CeresEngine::AnyInputEvent::operator= ( const AnyInputEvent )
default

Member Data Documentation

◆ mData

Variant CeresEngine::AnyInputEvent::mData
private

The variant type used to store the event types.


The documentation for this class was generated from the following file: