antara::gaming::event

antara::gaming::event::key_pressed

struct key_pressed

triggered when pressing a key on the keyboard.

Note

This class is automatically reflected for scripting systems such as lua, python.

Public Functions

key_pressed(input::key key_, bool alt_, bool control_, bool shift_, bool system_)

Constructors.

constructor with args

Note

Principal Constructor.

Parameters
  • key_: represents the keyboard key currently pressed

  • alt_: is true if the alt key on the keyboard is pressed

  • control_: is true if the keyboard control key is pressed

  • shift_: is true if the keyboard shift_ key is pressed

  • system_: is true if the keyboard system key is pressed

Example:

#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/event/key.pressed.hpp>

int main()
{
    entt::registry entity_registry;
    entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
    dispatcher.trigger<key_pressed>(input::key::a, false, false, false, false);
}

key_pressed()

default constructor (for scripting systems convenience)

Public Members

antara::gaming::input::key key

Fields.

key pressed

bool alt = {false}

is alt pressed at the same time.

bool control = {false}

is ctrl pressed at the same time.

bool shift = {false}

is shift pressed at the same time.

bool system = {false}

is system pressed at the same time.

antara::gaming::event::key_released

struct key_released

triggered when releasing a key on the keyboard.

Note

This class is automatically reflected for scripting systems such as lua, python.

Public Functions

key_released(input::key key_, bool alt_, bool control_, bool shift_, bool system_)

Constructors.

constructor with args

Note

Principal Constructor.

Parameters
  • key_: represents the keyboard key currently released

  • alt_: is true if the alt key on the keyboard is released

  • control_: is true if the keyboard control key is released

  • shift_: is true if the keyboard shift_ key is released

  • system_: is true if the keyboard system key is released

Example:

#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/event/key_released.hpp>

int main()
{
    entt::registry entity_registry;
    entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
    dispatcher.trigger<key_released>(input::key::a, false, false, false, false);
}

key_released()

default constructor (for scripting systems convenience)

Public Members

input::key key

Fields.

key released

bool alt = {false}

is alt released at the same time.

bool control = {false}

is ctrl released at the same time.

bool shift = {false}

is shift released at the same time.

bool system = {false}

is system released at the same time.

antara::gaming::event::quit_game

struct quit_game

Event that allows us to leave a game with a return value.

Note

This class is automatically reflected for scripting systems such as lua, python.

Public Functions

quit_game(int return_value)

Constructors.

constructor with args

Note

Principal Constructor.

Parameters
  • return_value: The return value of the program when leaving the game

Example:

#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/event/quit_game.hpp>

int main()
{
    entt::registry entity_registry;
    entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
    dispatcher.trigger<quit_game>(0);
}

quit_game()

default constructor (for scripting systems convenience)

Public Members

int return_value_

Fields.

the return value of the program when leaving the game

Public Static Attributes

constexpr const event::invoker_dispatcher<quit_game, int> invoker = {}

Static fields.