QuasarEngine
Cross-platform 3D engine and editor
Loading...
Searching...
No Matches
Quasar::KeyPressedEvent Class Referencefinal

Sent when a key is pressed, and again at regular intervals while it is held down. More...

#include <quasar/events/KeyEvent.h>

Inheritance diagram for Quasar::KeyPressedEvent:
Quasar::EventOf< EventType::KeyPressed, EventCategory::Input|EventCategory::Keyboard > Quasar::Event

Public Member Functions

 KeyPressedEvent (Key key, bool repeat=false)
 Creates the event.
Key GetKey () const
 Returns the pressed key.
bool IsRepeat () const
 Returns true if the event comes from the key being held down, false for the first press.
std::string ToString () const override
 Returns the event with its key code, for example "KeyPressed: 87 (repeat)".
Public Member Functions inherited from Quasar::EventOf< EventType::KeyPressed, EventCategory::Input|EventCategory::Keyboard >
EventType GetType () const override
 Returns the type of the event.
EventCategory GetCategories () const override
 Returns all the categories of the event.
Public Member Functions inherited from Quasar::Event
const char * GetName () const
 Returns the name of the type of the event, for example "KeyPressed".
bool IsInCategory (EventCategory category) const
 Returns true if the event belongs to the given category.
bool IsHandled () const
 Returns true if the event was handled.
void SetHandled (bool handled)
 Marks the event as handled, or not handled.

Additional Inherited Members

Static Public Member Functions inherited from Quasar::EventOf< EventType::KeyPressed, EventCategory::Input|EventCategory::Keyboard >
static constexpr EventType GetStaticType ()
 Returns the type of this event class.
Protected Member Functions inherited from Quasar::Event
 Event ()=default
 Creates an event that is not handled.

Detailed Description

Sent when a key is pressed, and again at regular intervals while it is held down.

Use it for actions and shortcuts. To read text typed by the user, use KeyTypedEvent instead.

Constructor & Destructor Documentation

◆ KeyPressedEvent()

Quasar::KeyPressedEvent::KeyPressedEvent ( Key key,
bool repeat = false )
inlineexplicit

Creates the event.

Parameters
keyThe pressed key.
repeatTrue if the event comes from the key being held down, false for the first press.

Member Function Documentation

◆ ToString()

std::string Quasar::KeyPressedEvent::ToString ( ) const
inlineoverridevirtual

Returns the event with its key code, for example "KeyPressed: 87 (repeat)".

Reimplemented from Quasar::Event.


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