Gaming
Welcome to the Antara Gaming SDK documentation. This module-based software is programmed in C++ 17 and is designed for high-speed runtime execution.
The modules of the Antara Gaming SDK rely on other modules, such as Oracles
The antara::gaming::config
class provides a function to load customized configuration settings for the Antara Gaming SDK.
The load_configuration
function loads customizable configuration settings from a path and filename.
- If the parameter path does not exist the function attempts to create the directories of the given path
- If the configuration does not exist, the function creates a default configuration
- If the path and the name of the file exists, the function loads the configuration contents
template<typename TConfig>
TConfig antara::gaming::config::load_configuration(std::filesystem::path &&config_path, std::string filename)
Name | Type | Description |
---|---|---|
TConfig | typename | the type of template to load |
Name | Type | Description |
---|---|---|
config_path | std::filesystem::path | the path to the directory in which the configuration file is located |
filename | std::string | the name of the configuration file |
Name | Type | Description |
---|---|---|
TConfig | template | the template |
auto cfg = config::load_configuration<my_game::config>(std::filesystem::current_path() / "assets/config", "my_game.config.json");
The antara::gaming::core
class provides functions and information relevant to
the core Antara Gaming SDK library.
The version
function returns the current version of the Antara Gaming SDK.
The result of this function can be deduced at compile time.
#include <antara/gaming/core/version.hpp>
constexpr const char *antara::gaming::version()
Name | Type | Description |
---|---|---|
(none) |
Name | Type | Description |
---|---|---|
current version | const char * | the current version of the Antara Gaming SDK |
#include <iostream>
#include <antara/gaming/core/version.hpp>
void print_version() {
std::cout << antara::gaming::version() << std::endl;
}
The antara::gaming::ecs::system_manager
class provides methods to perform tasks such as the manipulation of systems, the addition, deletion, and update of systems, and the deactivation of a system.
The primary constructor function.
#include <antara/gaming/ecs/system.manager.hpp>
system_manager(entt::registry ®istry, bool subscribe_to_internal_events = true)
~system_manager()
Name | Type | Description |
---|---|---|
registry | entt::registry | an entity_registry object |
subscribe_to_internal_events | bool | whether to subscribe to default system_manager events |
Name | Type | Description |
---|---|---|
(none) | void |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager mgr{entity_registry};
}
Public member functions.
void receive_add_base_system(const ecs::event::add_base_system &evt)
Name | Type | Description |
---|---|---|
evt | ecs::event::add_base_system& |
Name | Type | Description |
---|---|---|
(none) | void |
The start
function informs the system manager instance that the developer's game is initiated and spinning.
This function allows for the execution of actions at the end of each frame. For example, an action could be the deletion of a sytem, or the addition of a new system which will continue to receive iterations and updates.
#include <antara/gaming/ecs/system.manager.hpp>
system_manager_instance.start();
Name | Type | Description |
---|---|---|
(none) |
Name | Type | Description |
---|---|---|
(none) | void |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
system_manager.start();
return 0;
}
The update
function updates a system-manager instance.
The logic of the function is designed to automatically manage the correct order of updates for the different types of systems the developer has added to their system-manager instance.
- If the developer's logic has not loaded any systems into the system_manager instance the function returns
0
- If the developer's logic marks a system for deletion, the function deletes the system is automatically at the end of the current loop tick
- If the developer's logic adds a system through an
ecs::event::add_base_system
event, the function automatically adds the system at the end of the current loop tick
#include <antara/gaming/ecs/system.manager.hpp>
std::size\_t nb\_systems\_updated = system\_manager.update();
Name | Type | Description |
---|---|---|
(none) |
Name | Type | Description |
---|---|---|
number of systems updated | std::size_t | the number of systems updated |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
system_manager.start();
// ... add 5 different systems here
std::size_t nb_systems_updated = system_manager.update();
if (nb_systems_updated != 5) {
std::cerr << "Expect 5 system updates from system_manager.update(), but received only " << nb_systems_updated << std::endl;
}
return 0;
}
The update_systems
function updates specific systems in a system_manager instance.
The update (listed above) function calls this update_systems
function multiple times each time the update
function executes.
The update_systems
function is useful when the developer wishes to manually perform an update of a specific system.
#include <antara/gaming/ecs/system.manager.hpp>
std::size\_t nb\_systems\_updated = system\_manager.update();
Name | Type | Description |
---|---|---|
(none) |
Name | Type | Description |
---|---|---|
number of systems updated | std::size_t | the number of systems updated |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
system_manager.start();
// ... add 5 different systems here
std::size_t nb_systems_updated = system_manager.update();
if (nb_systems_updated != 5) {
std::cerr << "Expect 5 system updates from system_manager.update(), but received only " << nb_systems_updated << std::endl;
}
return 0;
}
The get_system
function uses a template parameter to return a reference to a system.
template<typename TSystem>
const TSystem &get_system() const
Name | Type | Description |
---|---|---|
TSystem | (determined by the developer) | the TSystem type represents any type of valid template, as designed by the developer |
Name | Type | Description |
---|---|---|
TSystem | &TSystem | a reference to the template chosen by the developer |
An overloaded version of the get_system
function above.
This overloaded function accepts different parameters.
template<typename TSystem>
TSystem &get_system()
Name | Type | Description |
---|---|---|
TSystem | (determined by the developer) | the TSystem type represents any type of valid template, as designed by the developer |
Name | Type | Description |
---|---|---|
TSystem | &TSystem | a reference to the template chosen by the developer |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
system_manager.start();
// ... added 2 differents systems here (render_system, and a log_system)
auto& render_system = system_manager.get_system<game::render_system>();
const auto& log_system = system_manager.get_system<game::log_system>();
return 0;
}
The get_systems
function accepts multiple template parameters and returns multiple systems.
This function recursively calls the get_system function. Based on the logic of the different kinds of systems requested, this function updates the indicated systems in the correct order.
template<typename ...TSystems>
std::tuple<std::add_lvalue_reference_t<TSystems>...> get_systems()
Name | Type | Description |
---|---|---|
TSystem | std::tuple<std::add_lvalue_reference_t<TSystems> | a tuple containing multiple TSystems templates |
Name | Type | Description |
---|---|---|
TSystems | std::tuple<std::add_lvalue_reference_t<TSystems> | a reference to the template chosen by the developer |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
system_manager.start();
// ... added 2 different systems here (render_system, and a log_system)
auto& render_system = system_manager.get_system<game::render_system>();
const auto& log_system = system_manager.get_system<game::log_system>();
return 0;
}
An overloaded version of the get_systems function.
This function is marked as nodiscard.
template<typename ...TSystems>
std::tuple<std::add_lvalue_reference_t<std::add_const_t<TSystems>>...> get_systems() const
Name | Type | Description |
---|---|---|
tuple of TSystems | std::tuple<std::add_lvalue_reference_t<std::add_const_t<TSystems>>...> | a tuple containing multiple TSystems templates types |
Name | Type | Description |
---|---|---|
tuple of TSystems | std::tuple<std::add_lvalue_reference_t<std::add_const_t<TSystems>>...> | a tuple containing multiple references to TSystems templates |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
// ... added different systems here
// Called from a const context
auto &&[system_foo, system_bar] = system_manager.get_systems<system_foo, system_bar>();
// Called from a non const context
auto&&[system_foo_nc, system_bar_nc] = system_manager.get_systems<system_foo, system_bar>();
// Get it as a tuple
auto tuple_systems = system_manager.get_systems<system_foo, system_bar>();
return 0;
}
The has_system
function verifies whether or not a system is already registered in the system_manager.
template<typename TSystem>
bool has_system() const
Name | Type | Description |
---|---|---|
TSystem | (determined by the developer) | the system that needs to be verified |
Name | Type | Description |
---|---|---|
(variable) | bool | whether or not the indicated system is registered in the system manager instance |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
bool result = system_manager.has_system<my_game::render_system>();
if (!result) {
// Oh no, i don't have a rendering system.
}
return 0;
}
The has_systems
function verifies whether or not a list of systems is already registered in the system_manager.
This function recursively calls the has_system function.
This function is marked as nodiscard.
#include <antara/gaming/ecs/system.manager.hpp>
bool result = system_manager.has_systems<my_game::render_system, my_game::input_systems>();
Name | Type | Description |
---|---|---|
list of TSystems | template<typename ...TSystems> | the list of systems that needs to be verified |
Name | Type | Description |
---|---|---|
(variable) | bool | whether or not the indicated systems are registered in the system manager instance |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
bool result = system_manager.has_systems<my_game::render_system, my_game::input_systems>();
if (!result) {
// Oh no, atleast one of the systems is not present
}
return 0;
}
The has_systems
function verifies whether or not a list of systems is already registered in the system_manager.
template<typename ...TSystems>
bool has_systems() const
Name | Type | Description |
---|---|---|
list of TSystems | template<typename ...TSystems> | the list of systems that needs to be verified |
Name | Type | Description |
---|---|---|
(variable) | bool | whether or not the indicated systems are registered in the system manager instance |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
bool result = system_manager.has_systems<my_game::render_system, my_game::input_systems>();
if (!result) {
// Oh no, atleast one of the systems is not present
}
return 0;
}
The has_systems
function verifies whether or not a list of systems is already registered in the system_manager.
This function recursively calls the has_system function.
This function is marked as nodiscard.
#include <antara/gaming/ecs/system.manager.hpp>
bool result = system_manager.has_systems<my_game::render_system, my_game::input_systems>();
Name | Type | Description |
---|---|---|
list of TSystems | templat<typename ...TSystems> | the list of systems that needs to be verified |
Name | Type | Description |
---|---|---|
(variable) | bool | whether or not the indicated systems are registered in the system manager instance |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
bool result = system_manager.has_systems<my_game::render_system, my_game::input_systems>();
if (!result) {
// Oh no, atleast one of the systems is not present
}
return 0;
}
The has_systems
function verifies whether or not a list of systems is already registered in the system_manager.
This function recursively calls the has_system function.
This function is marked nodiscard.
template<typename ...TSystems>
bool has\_systems() const
Name | Type | Description |
---|---|---|
list of TSystems | template<typename ...TSystem> | the list of systems that needs to be verified |
Name | Type | Description |
---|---|---|
(variable) | bool | whether or not the indicated systems are loaded in the system-manager instance |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
bool result = system_manager.has_systems<my_game::render_system, my_game::input_systems>();
if (!result) {
// Oh no, atleast one of the systems is not present
}
return 0;
}
Themark_system
function marks a system for destruction at the next tick of the game loop.
template<typename TSystem>
bool mark_system()
Name | Type | Description |
---|---|---|
TSystem | TSystem | the system to mark for destruction |
Name | Type | Description |
---|---|---|
(variable) | bool | whether or not the system was successfully marked |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
bool result = system_manager.mark_system<my_game::render>();
if (!result) {
// Oh no the system has not been marked.
// Did you mark a system that is not present in the system_manager ?
}
return 0;
}
Themark_systems
function marks a system for destruction at the next tick of the game loop.
template<typename TSystem>
bool mark_system()
Name | Type | Description |
---|---|---|
TSystem | TSystem | the system to mark for destruction |
Name | Type | Description |
---|---|---|
(variable) | bool | whether or not the system was successfully marked |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
bool result = system_manager.mark_system<my_game::render>();
if (!result) {
// Oh no the system has not been marked.
// Did you mark a system that is not present in the system_manager ?
}
return 0;
}
The mark_systems
function marks a list of systems for destruction at the next tick of the game loop.
This function recursively calls the mark_system function.
This system is marked as nodiscard.
template<typename ...TSystems>
bool mark_systems()
Name | Type | Description |
---|---|---|
TSystems | TSystems | the systems to mark for destruction |
Name | Type | Description |
---|---|---|
(variable) | bool | whether or not the system was successfully marked |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
bool result = system_manager.mark_system<my_game::render>();
if (!result) {
// Oh no the system has not been marked.
// Did you mark a system that is not present in the system_manager ?
}
return 0;
}
The enable_system
function enables a system.
template<typename TSystem>
bool enable_system()
Name | Type | Description |
---|---|---|
TSystem | TSystem | the system to enable |
Name | Type | Description |
---|---|---|
(variable) | bool | whether or not the system was successfully enabled |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
bool result = system_manager.enable_system<my_game::input>();
if (!result) {
// Oh no, this system cannot be enabled.
// Did you enable a system that is not present in the system_manager ?
}
return 0;
}
The enable_systems
function enables a list of systems.
This function recursively calls the enable_system function.
template<typename ...TSystems>
bool enable_systems()
Name | Type | Description |
---|---|---|
TSystems | TSystems | the systems to enable |
Name | Type | Description |
---|---|---|
(variable) | bool | whether or not the systems were successfully enabled |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
bool result = system_manager.enable_systems<my_game::input, my_game::render>();
if (!result) {
// Oh no, atleast one of the requested systems cannot be enabled.
}
return 0;
}
The disable_system
function disables a system.
A disabled system is ignored during the game loop, but the system is not destroyed.
template<typename TSystem>
bool disable_system()
Name | Type | Description |
---|---|---|
TSystem | TSystem | the system to disable |
Name | Type | Description |
---|---|---|
(variable) | bool | whether or not the system was successfully disabled |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
bool result = system_manager.disable_system<my_game::input>();
if (!result) {
// Oh no the system_manager cannot disable this system.
}
return 0;
}
The disable_systems
function disables a list of systems.
This function recursively calls the disable_system function.
template<typename ...TSystems>
bool disable_systems()
Name | Type | Description |
---|---|---|
TSystems | TSystems | the systems to disable |
Name | Type | Description |
---|---|---|
(variable) | bool | whether or not the systems were successfully disabled |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
bool result = system_manager.disable_systems<my_game::input, my_game::render>();
if (!result) {
// Oh no, atleast one of the requested systems cannot be disabled.
}
return 0;
}
The nb_systems
function returns the number of systems registered in the system manager.
std::size_t nb_systems() const
Name | Type | Description |
---|---|---|
(none) |
Name | Type | Description |
---|---|---|
number of systems | std::size_t | the number of systems registered |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
// added 2 systems here
auto nb_systems = system_manager.nb_systems();
if (nb_systems) {
// Oh no, was expecting atleast 2 systems.
}
return 0;
}
The nb_systems
function is an overloaded version of the nb_systems
function. This version returns the system number of a certain type to register in the system manager.
std::size_t nb_systems(system_type sys_type) const
Name | Type | Description |
---|---|---|
sys_type | system_type | represents the type of systems |
Name | Type | Description |
---|---|---|
number of systems | std::size_t | the number of systems of a specified type |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
// added 2 systems of update type here
auto nb_systems = system_manager.nb_systems(system_type::pre_update);
if (nb_systems) {
// Oh no, was expecting atleast 2 systems of pre_update type.
}
return 0;
}
The create_system
function creates a system with the provided argument.
This function is a factory.
template<typename TSystem, typename ...TSystemArgs>
TSystem &create_system(TSystemArgs&&... args)
Name | Type | Description |
---|---|---|
TSystem | TSystem | represents the type of system to create |
TSystemArgs | (logic) | the arguments to create the constructed system |
Name | Type | Description |
---|---|---|
TSystem | TSystem | a reference to the created system |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
auto& foo_system = system_manager.create_system<my_system::foo>(); // you can send argument of the foo constructor here.
foo_system.update();
return 0;
}
template<typename TSystem, typename ...TSystemArgs>
void create_system_rt(TSystemArgs&&... args)
The load_systems
function loads many os systems.
This function recursively calls the create_system function.
template<typename ...TSystems, typename ...TArgs>
auto load_systems(TArgs&&... args)
Name | Type | Description |
---|---|---|
TSystems | TSystems | represents a list of systems to load |
Name | Type | Description |
---|---|---|
(variable) | (tuple) | a tuple of systems loaded |
#include <entt/entity/registry.hpp>
#include <entt/dispatcher/dispatcher.hpp>
#include <antara/gaming/ecs/system.manager.hpp>
int main()
{
entt::registry entity_registry;
entt::dispatcher& dispatcher{registry.set<entt::dispatcher>()};
antara::gaming::ecs::system_manager system_manager{entity_registry};
auto&& [foo_system, bar_system] = system_manager.load_systems<my_system::foo, my_system::bar>();
foo_system.update();
bar_system.update();
return 0;
}
using clock = std::chrono::steady_clock
Private typedefs.
syntactic sugar name for a chrono steady clock
using system_ptr = std::unique_ptr<base_system>
syntactic sugar name for a pointer to base_system
using system_array = std::vector<system_ptr>
syntactic sugar name for an array of system_ptr
using system_registry = std::array<system_array, system_type::size>
syntactic sugar name for a multidimensional array of system_array (pre_update, logic_update, post_update)
using systems_queue = std::queue<system_ptr>
syntactic sugar name for a queue of system pointer to add.
base*system &add_system*(system_ptr &&system, system_type sys_type)
The antara::gaming::event
class contains functions and other elements that are common in gaming.
struct key_pressed
The key_pressed
struct provides functions that execute when a user presses a key.
This class is automatically reflected for scripting systems such as Lua, Python.
The key_pressed
function is a constructor that takes arguments to associate a key with logic.
This is the principal constructor for key-press functions.
key_pressed(input::key key_, bool alt_, bool control_, bool shift_, bool system_)
Name | Type | Description |
---|---|---|
key_ | input::key | represents the keyboard key currently pressed |
alt_ | bool | true if the alt key on the keyboard is pressed |
control_ | bool | true if the control key on the keyboard is pressed |
shift_ | bool | true if the shift key on the keyboard is pressed |
system_ | bool | true if the system key on the keyboard is pressed |
Name | Type | Description |
---|---|---|
(none) |
#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);
}
The key_pressed
function that takes no arguments is the default constructor, provided for scripting-system convenience.
Please see the key_pressed | 1 function for more information.
key_pressed()
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.
The antara::gaming::event::key\_released
class provides functions and other elements that associate the release of a key with logic.
This class is automatically reflected for scripting systems such as Lua, Python.
The key_released
function is a constructor that takes arguments to associate a key with logic.
This is the principal constructor for key-release functions.
key_released(input::key key_, bool alt_, bool control_, bool shift_, bool system_)
Name | Type | Description |
---|---|---|
key_ | input::key | represents the keyboard key currently released |
alt_ | bool | true if the alt key on the keyboard is released |
control_ | bool | true if the control key on the keyboard is released |
shift_ | bool | true if the shift key on the keyboard is released |
system_ | bool | true if the system key on the keyboard is released |
Name | Type | Description |
---|---|---|
(none) |
#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);
}
The key_released
function that takes no arguments is the default constructor, provided for scripting-system convenience.
Please see the key_released | 1 function for more information.
key_released()
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.
The antara::gaming::event::quit_game
class provides functions and other methods to quit a game.
The quit_game
struct is an event that leaves a game and provides a return value.
This class is automatically reflected for scripting systems such as Lua, Python.
The quit_game
function is a constructor that takes arguments and quits the game.
This is the principal constructor for quit_game
functions.
quit_game(int return_value)
Name | Type | Description |
---|---|---|
return_value | int | the return value of the program when leaving the game |
Name | Type | Description |
---|---|---|
return_value | int | the return value of the program when leaving the game |
#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);
}
The quit_game
function that takes no arguments is the default constructor, provided for scripting-system convenience.
Please see the quit_game | 1 function for more information.
quit_game()
int return_value_
the return value of the program when leaving the game
constexpr const event::invoker_dispatcher<quit_game, int> invoker = {}
Static fields.
The antara::gaming::sfml
class provides functions and other elements for SFML-related (Simple and Fast Multimedia Library) logic purposes.
The antara::gaming::sfml::audio_system
class provides audio-related functions and other elements.
class audio_system : public antara::gaming::ecs::system<audio_system>
audio_system(entt::registry ®istry)
Name | Type | Description |
---|---|---|
registry | ent::registry | the entity_registry |
Name | Type | Description |
---|---|---|
return_value | int | the return value of the program when leaving the game |
The update
function destroys and clears the sounds when they are finished.
void update()
Name | Type | Description |
---|---|---|
(none) |
Name | Type | Description |
---|---|---|
(none) | void |
The antara::gaming::sfml::component_sound
struct contains sound and the sound's attributes (such as volume).
The sf::Sound sound
object is the SFML Sound instance and contains the sound data.