shiva
Search…
shiva::event
On this page you will find information about the different events that can be sent and received in shiva

Purpose

The purpose of this module is to give users the opportunity to interact through events in their program, whether in C++ or in a scripting language.

Events

Event Name
Description
trigger an event that add a system in the system manager
triggers an event after the complete loading of plugged systems
triggers an event after the complete loading resource of a scene or program
triggers an event that indicates that an uncorrectable error has occurred
quit_game
triggers an event that indicates the end of the program
triggers an event that indicates the beginning of the program
triggers an event if the user presses a key on his keyboard
triggers an event if the user release a key on his keyboard
triggers an event that indicates the change from one scene to another
All events are default constructible.

add_base_system

Constructor
Example
add_base_system(std::unique_ptr<shiva::ecs::base_system> system_ptr_ = nullptr) noexcept
#include <memory>
#include <shiva/event/add_base_system.hpp>
#include "conrete_system.hpp"
shiva::entt::dispatcher dispatcher;
dispatcher.trigger<shiva::event::add_base_system>(
std::make_unique<concrete_system>(...));

after_load_systems_plugins

Constructor
Example
This event has no constructor
#include <memory>
#include <shiva/event/after_load_systems_plugins.hpp>
shiva::entt::dispatcher dispatcher;
dispatcher.trigger<shiva::event::after_load_systems_plugins>();
This event is already triggered by the system_manager in the function load_plugins().
We recommend that you do not trigger this event unless you use your own system manager.

after_load_resources

Constructor
Example
This event has no constructor
#include <memory>
#include <shiva/event/after_load_resources.hpp>
shiva::entt::dispatcher dispatcher;
dispatcher.trigger<shiva::event::after_load_resources>();
You can find a more concrete example in the source code here

fatal_error_occured

Constructor
Example
fatal_error_occured(std::error_code ec) noexcept;
#include <memory>
#include <system_error>
#include <shiva/event/fatal_error_occured.hpp>
shiva::entt::dispatcher dispatcher;
dispatcher.trigger<shiva::event::fatal_error_occured>(std::make_error_code(std::errc::result_out_of_range));
You can find a more concrete example in the source code here

quit_game

Constructor
Example
quit_game(int return_value) noexcept;
#include <memory>
#include <system_error>
#include <shiva/event/quit_game.hpp>
shiva::entt::dispatcher dispatcher;
dispatcher.trigger<shiva::event::quit_game>(0);
You can find a more concrete example in the source code here

start_game

Constructor
Example
This event has no constructor
#include <memory>
#include <system_error>
#include <shiva/event/start_game.hpp>
shiva::entt::dispatcher dispatcher;
dispatcher.trigger<shiva::event::start_game>();
You can find a more concrete example in the source code here

key_pressed

Constructor
Example
key_pressed(shiva::input::keyboard::TKey key) noexcept;
#include <memory>
#include <system_error>
#include <shiva/event/key_pressed.hpp>
shiva::entt::dispatcher dispatcher;
dispatcher.trigger<shiva::event::key_pressed>(shiva::input::keyboard::TKey::A);
You can find more information about input here
You can find a more concrete example in the source code here

key_released

Constructor
Example
key_released(shiva::input::keyboard::TKey key) noexcept;
#include <memory>
#include <system_error>
#include <shiva/event/key_released.hpp>
shiva::entt::dispatcher dispatcher;
dispatcher.trigger<shiva::event::key_released>(shiva::input::keyboard::TKey::A);

change_scene

Constructor
Example
change_scene(const char* scene_name_ = nullptr) noexcept;
#include <memory>
#include <system_error>
#include <shiva/event/change_scene.hpp>
shiva::entt::dispatcher dispatcher;
dispatcher.trigger<shiva::event::change_scene>("game_scene");
Copy link
On this page
Purpose
Events
add_base_system
after_load_systems_plugins
after_load_resources
fatal_error_occured
quit_game
start_game
key_pressed
key_released
change_scene