Gaming

Introduction

Welcome to the Antara Gaming SDK documentation. This module-based software is programmed in C++ 17 and is designed for high-speed runtime execution.

config

The antara::gaming::config class provides a function to load customized configuration settings for the Antara Gaming SDK.

load_configuration

Public Function

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

Usage Pattern

template<typename TConfig>

TConfig antara::gaming::config::load_configuration(std::filesystem::path &&config_path, std::string filename)

Template Parameters

NameTypeDescription
TConfigtypenamethe type of template to load

Function Parameters

NameTypeDescription
config_pathstd::filesystem::paththe path to the directory in which the configuration file is located
filenamestd::stringthe name of the configuration file

Response

NameTypeDescription
TConfigtemplatethe template

📌 Example

auto cfg = config::load_configuration<my_game::config>(std::filesystem::current_path() / "assets/config", "my_game.config.json");

core

The antara::gaming::core class provides functions and information relevant to the core Antara Gaming SDK library.

version

Public Function

The version function returns the current version of the Antara Gaming SDK.

Usage Pattern

#include <antara/gaming/core/version.hpp>

constexpr const char *antara::gaming::version()

Function Parameters

NameTypeDescription
(none)

Response

NameTypeDescription
current versionconst char *the current version of the Antara Gaming SDK

📌 Example

#include <iostream>
#include <antara/gaming/core/version.hpp>

void print_version() {
    std::cout << antara::gaming::version() << std::endl;
}

ecs::system_manager

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.

system_manager

Public Function

The primary constructor function.

Usage Pattern

#include <antara/gaming/ecs/system.manager.hpp>

system_manager(entt::registry &registry, bool subscribe_to_internal_events = true)

Destructor

~system_manager()

Function Parameters

NameTypeDescription
registryentt::registryan entity_registry object
subscribe_to_internal_eventsboolwhether to subscribe to default system_manager events

Response

NameTypeDescription
(none)void

📌 Example

#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};
}

receive_add_base_system

Public Function

Public member functions.

Usage Pattern

void receive_add_base_system(const ecs::event::add_base_system &evt)

Function Parameters

NameTypeDescription
evtecs::event::add_base_system&

Response

NameTypeDescription
(none)void

start

Public Function

The start function informs the system manager instance that the developer’s game is initiated and spinning.

Usage Pattern

#include <antara/gaming/ecs/system.manager.hpp>

system_manager_instance.start();

Function Parameters

NameTypeDescription
(none)

Response

NameTypeDescription
(none)void

📌 Example

#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;
}

update

Public Function

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

Usage Pattern

#include <antara/gaming/ecs/system.manager.hpp>

std::size\_t nb\_systems\_updated = system\_manager.update();

Function Parameters

NameTypeDescription
(none)

Response

NameTypeDescription
number of systems updatedstd::size_tthe number of systems updated

📌 Example

#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;
}

update_systems

Public Function

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.

Usage Pattern

#include <antara/gaming/ecs/system.manager.hpp>

std::size\_t nb\_systems\_updated = system\_manager.update();

Function Parameters

NameTypeDescription
(none)

Response

NameTypeDescription
number of systems updatedstd::size_tthe number of systems updated

📌 Example

#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;
}

get_system | 1

Public Function

The get_system function uses a template parameter to return a reference to a system.

Usage Pattern

template<typename TSystem>
const TSystem &get_system() const

Function and Template Type

NameTypeDescription
TSystem(determined by the developer)the TSystem type represents any type of valid template, as designed by the developer

Response

NameTypeDescription
TSystem&TSystema reference to the template chosen by the developer

get_system | 2

Public Function

An overloaded version of the get_system function above.

This overloaded function accepts different parameters.

Usage Pattern

template<typename TSystem>

TSystem &get_system()

Function and Template Type

NameTypeDescription
TSystem(determined by the developer)the TSystem type represents any type of valid template, as designed by the developer

Response

NameTypeDescription
TSystem&TSystema reference to the template chosen by the developer

📌 Example

#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;
}

get_systems | 1

Public Function

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.

Usage Pattern

template<typename ...TSystems>
std::tuple<std::add_lvalue_reference_t<TSystems>...> get_systems()

Function and Template Type

NameTypeDescription
TSystemstd::tuple<std::add_lvalue_reference_t<TSystems>a tuple containing multiple TSystems templates

Response

NameTypeDescription
TSystemsstd::tuple<std::add_lvalue_reference_t<TSystems>a reference to the template chosen by the developer

📌 Example

#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;
}

get_systems | 2

Public Function

An overloaded version of the get_systems function.

Usage Pattern

template<typename ...TSystems>
std::tuple<std::add_lvalue_reference_t<std::add_const_t<TSystems>>...> get_systems() const

Function and Template Type

NameTypeDescription
tuple of TSystemsstd::tuple<std::add_lvalue_reference_t<std::add_const_t<TSystems>>…>a tuple containing multiple TSystems templates types

Response

NameTypeDescription
tuple of TSystemsstd::tuple<std::add_lvalue_reference_t<std::add_const_t<TSystems>>…>a tuple containing multiple references to TSystems templates

📌 Example

#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;
}

has_system

Public Function

The has_system function verifies whether or not a system is already registered in the system_manager.

Usage Pattern

template<typename TSystem>
bool has_system() const

Template Type

NameTypeDescription
TSystem(determined by the developer)the system that needs to be verified

Response

NameTypeDescription
(variable)boolwhether or not the indicated system is registered in the system manager instance

📌 Example

#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;
}

has_systems | 1

Public Function

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.

Usage Pattern

#include <antara/gaming/ecs/system.manager.hpp>

bool result = system_manager.has_systems<my_game::render_system, my_game::input_systems>();

Template Type

NameTypeDescription
list of TSystemstemplate<typename …TSystems>the list of systems that needs to be verified

Response

NameTypeDescription
(variable)boolwhether or not the indicated systems are registered in the system manager instance

📌 Example

#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;
}

has_systems | 2

Public Function

The has_systems function verifies whether or not a list of systems is already registered in the system_manager.

Usage Pattern

template<typename ...TSystems>
bool has_systems() const

Template Type

NameTypeDescription
list of TSystemstemplate<typename …TSystems>the list of systems that needs to be verified

Response

NameTypeDescription
(variable)boolwhether or not the indicated systems are registered in the system manager instance

📌 Example

#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;
}

has_systems | 3

Public Function

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.

Usage Pattern

#include <antara/gaming/ecs/system.manager.hpp>

bool result = system_manager.has_systems<my_game::render_system, my_game::input_systems>();

Template Type

NameTypeDescription
list of TSystemstemplat<typename …TSystems>the list of systems that needs to be verified

Response

NameTypeDescription
(variable)boolwhether or not the indicated systems are registered in the system manager instance

📌 Example

#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;
}

has_systems | 4

Public Function

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.

Usage Pattern

template<typename ...TSystems>
bool has\_systems() const

Template Type

NameTypeDescription
list of TSystemstemplate<typename …TSystem>the list of systems that needs to be verified

Response

NameTypeDescription
(variable)boolwhether or not the indicated systems are loaded in the system-manager instance

📌 Example

#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;
}

mark_system

Public Function

Themark_system function marks a system for destruction at the next tick of the game loop.

Usage Pattern

template<typename TSystem>
bool mark_system()

Template Type

NameTypeDescription
TSystemTSystemthe system to mark for destruction

Response

NameTypeDescription
(variable)boolwhether or not the system was successfully marked

📌 Example

#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;
}

mark_systems | 1

Public Function

Themark_systems function marks a system for destruction at the next tick of the game loop.

Usage Pattern

template<typename TSystem>
bool mark_system()

Template Type

NameTypeDescription
TSystemTSystemthe system to mark for destruction

Response

NameTypeDescription
(variable)boolwhether or not the system was successfully marked

📌 Example

#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;
}

mark_systems | 2

Public Function

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.

Usage Pattern

template<typename ...TSystems>
bool mark_systems()

Template Type

NameTypeDescription
TSystemsTSystemsthe systems to mark for destruction

Response

NameTypeDescription
(variable)boolwhether or not the system was successfully marked

📌 Example

#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;
}

enable_system

Public Function

The enable_system function enables a system.

Usage Pattern

template<typename TSystem>
bool enable_system()

Template Type

NameTypeDescription
TSystemTSystemthe system to enable

Response

NameTypeDescription
(variable)boolwhether or not the system was successfully enabled

📌 Example

#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;
}

enable_systems

Public Function

The enable_systems function enables a list of systems.

This function recursively calls the enable_system function.

Usage Pattern

template<typename ...TSystems>
bool enable_systems()

Template Type

NameTypeDescription
TSystemsTSystemsthe systems to enable

Response

NameTypeDescription
(variable)boolwhether or not the systems were successfully enabled

📌 Example

#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;
}

disable_system

Public Function

The disable_system function disables a system.

A disabled system is ignored during the game loop, but the system is not destroyed.

Usage Pattern

template<typename TSystem>
bool disable_system()

Template Type

NameTypeDescription
TSystemTSystemthe system to disable

Response

NameTypeDescription
(variable)boolwhether or not the system was successfully disabled

📌 Example

#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;
}

disable_systems

Public Function

The disable_systems function disables a list of systems.

This function recursively calls the disable_system function.

Usage Pattern

template<typename ...TSystems>
bool disable_systems()

Template Type

NameTypeDescription
TSystemsTSystemsthe systems to disable

Response

NameTypeDescription
(variable)boolwhether or not the systems were successfully disabled

📌 Example

#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;
}

nb_systems | 1

Public Function

The nb_systems function returns the number of systems registered in the system manager.

Usage Pattern

std::size_t nb_systems() const

Template Type

NameTypeDescription
(none)

Response

NameTypeDescription
number of systemsstd::size_tthe number of systems registered

📌 Example

#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;
}

nb_systems | 2

Public Function

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.

Usage Pattern

std::size_t nb_systems(system_type sys_type) const

Template Type

NameTypeDescription
sys_typesystem_typerepresents the type of systems

Response

NameTypeDescription
number of systemsstd::size_tthe number of systems of a specified type

📌 Example

#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;
}

create_system

Public Function

The create_system function creates a system with the provided argument.

This function is a factory.

Usage Pattern

template<typename TSystem, typename ...TSystemArgs>
TSystem &create_system(TSystemArgs&&... args)

Template Type

NameTypeDescription
TSystemTSystemrepresents the type of system to create
TSystemArgs(logic)the arguments to create the constructed system

Response

NameTypeDescription
TSystemTSystema reference to the created system

📌 Example

#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;
}

create_system_rt

Public Function

Usage Pattern

template<typename TSystem, typename ...TSystemArgs>
void create_system_rt(TSystemArgs&&... args)

load_systems

Public Function

The load_systems function loads many os systems.

This function recursively calls the create_system function.

Usage Pattern

template<typename ...TSystems, typename ...TArgs>
auto load_systems(TArgs&&... args)

Template Type

NameTypeDescription
TSystemsTSystemsrepresents a list of systems to load

Response

NameTypeDescription
(variable)(tuple)a tuple of systems loaded

📌 Example

#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;
}

clock

Private Type

Usage Pattern

using clock = std::chrono::steady_clock

system_ptr

Private Type

Usage Pattern

using system_ptr = std::unique_ptr<base_system>

system_array

Private Type

Usage Pattern

using system_array = std::vector<system_ptr>

system_registry

Private Type

Usage Pattern

using system_registry = std::array<system_array, system_type::size>

systems_queue

Private Type

using systems_queue = std::queue<system_ptr>

add_system_

Private Function

Usage Pattern

base*system &add_system*(system_ptr &&system, system_type sys_type)

entity_registry_

Private Data Members

event::key*

The antara::gaming::event class contains functions and other elements that are common in gaming.

event::key_pressed

struct key_pressed

The key_pressed struct provides functions that execute when a user presses a key.

Public Functions

key_pressed | 1

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.

Usage Pattern
key_pressed(input::key key_, bool alt_, bool control_, bool shift_, bool system_)
Template Type
NameTypeDescription
key_input::keyrepresents the keyboard key currently pressed
alt_booltrue if the alt key on the keyboard is pressed
control_booltrue if the control key on the keyboard is pressed
shift_booltrue if the shift key on the keyboard is pressed
system_booltrue if the system key on the keyboard is pressed
Response
NameTypeDescription
(none)
📌 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 | 2

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.

Usage Pattern
key_pressed()

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.

event::key_released

The antara::gaming::event::key\_released class provides functions and other elements that associate the release of a key with logic.

Public Functions

key_released

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.

Usage Pattern
key_released(input::key key_, bool alt_, bool control_, bool shift_, bool system_)
Template Type
NameTypeDescription
key_input::keyrepresents the keyboard key currently released
alt_booltrue if the alt key on the keyboard is released
control_booltrue if the control key on the keyboard is released
shift_booltrue if the shift key on the keyboard is released
system_booltrue if the system key on the keyboard is released
Response
NameTypeDescription
(none)
📌 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 | 2

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.

Usage Pattern
key_released()

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.

event::quit_game

The antara::gaming::event::quit_game class provides functions and other methods to quit a game.

quit_game

The quit_game struct is an event that leaves a game and provides a return value.

Public Functions

quit_game | 1

The quit_game function is a constructor that takes arguments and quits the game.

This is the principal constructor for quit_game functions.

Usage Pattern
quit_game(int return_value)
Template Type
NameTypeDescription
return_valueintthe return value of the program when leaving the game
Response
NameTypeDescription
return_valueintthe 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 | 2

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.

Usage Pattern
quit_game()

Public Members

return_value_
Usage Pattern
int return_value_
Fields.

the return value of the program when leaving the game

Public Static Attributes

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

Static fields.

sfml

The antara::gaming::sfml class provides functions and other elements for SFML-related (Simple and Fast Multimedia Library) logic purposes.

sfml::audio_system

The antara::gaming::sfml::audio_system class provides audio-related functions and other elements.

Usage Pattern
class audio_system : public antara::gaming::ecs::system<audio_system>

Public Functions

audio_system
Usage Pattern
audio_system(entt::registry &registry)
Function Parameters
NameTypeDescription
registryent::registrythe entity_registry
Response
NameTypeDescription
return_valueintthe return value of the program when leaving the game
update

The update function destroys and clears the sounds when they are finished.

Usage Pattern
void update()
Function Parameters
NameTypeDescription
(none)
Response
NameTypeDescription
(none)void

sfml::component_sound

The antara::gaming::sfml::component_sound struct contains sound and the sound’s attributes (such as volume).

Public Members

sound

The sf::Sound sound object is the SFML Sound instance and contains the sound data.