# Tutorial: Getting Started

# Introduction

This tutorial covers the installation and initiation of the Antara Gaming Software Development Kit (SDK).

# Prerequisites

# Getting Started

The following instructions create an installation of the Antara Gaming SDK that is useful for development and testing purposes.

# Build

Execute the following commands in the terminal to build the project.

mkdir build ## bash or powershell
cd build ## bash or powershell
## Release or Debug are available
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=your_path_to_your_clang++ ../ #Linux / Osx
cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 16 2019" -A x64 -T "ClangCl" -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe" ../ #Windows
## We can even use Ninja for Windows / Linux / OSX
## On Windows you may want to open x64 Visual Studio Terminal Prompt for using Ninja
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=path_to_clang++ -DCMAKE_C_COMPILER=path_to_clang ../
## Build (Debug / Release available)
cmake --build . --config Debug

There are also additional options with the CMake that allows to activate certain features of the SDK:

# CMake Options

(Please use the scroll bar at the bottom of the table to view all table cells.)

Name Description How to enable it Notes
USE_SFML_ANTARA_WRAPPER Enable the SFML module of the SDK -DUSE_SFML_ANTARA_WRAPPER=ON Requires SFML dependencies on Linux
USE_IMGUI_ANTARA_WRAPPER Enable the IMGUI Support for the SDK -DUSE_IMGUI_ANTARA_WRAPPER=ON
ENABLE_BLOCKCHAIN_MODULES Enable the Blockchain modules for the SDK (need additional dependencies) -DENABLE_BLOCKCHAIN_MODULES=ON
ANTARA_BUILD_DOCS Enable the build of the documentation for the SDK -DANTARA_BUILD_DOCS=ON Require Sphinx And Doxygen
USE_LUA_ANTARA_WRAPPER Enable the lua module for the SDK -DUSE_LUA_ANTARA_WRAPPER=ON
USE_ASAN Enable the Address Sanitizer for the Unit tests of the SDK -DUSE_ASAN=ON Cannot be mixed with USE_TSAN and USE_UBSAN
USE_UBSAN Enable the Undefined Behavior Sanitizer for the Unit tests of the SDK -DUSE_UBSAN=ON Cannot be mixed with USE_TSAN and USE_ASAN
USE_TSAN Enable the Undefined Behavior Sanitizer for the Unit tests of the SDK -DUSE_TSAN=ON Cannot be mixed with USE_UBSAN and USE_ASAN
BUILD_WITH_APPIMAGE Enable the AppImage auto-generation on Linux for bundle an executable builded with the SDK -DBUILD_WITH_APPIMAGE=ON Work’s only on Linux.
ENABLE_HTML_COMPILATION Enable the HTML Compilation on Emscripten for an executable builded with the SDK -DENABLE_HTML_COMPILATION=ON Work’s only on Emscripten
COVERAGE_CLION_TOOLS Enable the Coverage inside CLion IDE -DCOVERAGE_CLION_TOOLS=ON Work’s only with CLion IDE and Require ENABLE_COVERAGE
ANTARA_BUILD_EXAMPLES Enable the example of the SDK. -DANTARA_BUILD_EXAMPLES=ON Some examples need mix of options such as USE_SFML_ANTARA_WRAPPER + ANTARA_BUILD_EXAMPLES
ANTARA_BUILD_UNIT_TESTS Enable the unit tests of the SDK. -DANTARA_BUILD_UNIT_TESTS=ON Some examples need mix of options such as USE_LUA_ANTARA_WRAPPER + ANTARA_BUILD_UNIT_TESTS
USE_BOX2D_ANTARA_WRAPPER Enable the Box2D modules of the SDK. -DUSE_BOX2D_ANTARA_WRAPPER=ON
ENABLE_COVERAGE Enable the coverage macros for the SDK. -DENABLE_COVERAGE=ON

# Initiating the Project

Installation is not necessary.

Simply use the CMake fetch_content command to use the project.

# Running Tests

(This section assumes that the reader has compiled the Antara Gaming SDK with the option to perform unit tests enabled.)

Unit tests are located in the following folders.

  • Linux/OSX: bin/unit_tests
  • Windows: bin/unit_tests/%CMAKE_BUILD_TYPE%

# Deployment

(This section is still in development.)

# Quick Example

# CMakeLists.txt

Create a basic CMakeLists.txt. This allows the SDK to compile source code.

##! Uncomment those lines if you use the gaming sdk as an external project
#if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
#    set(LINUX TRUE)
#endif ()
#include(FetchContent)
#FetchContent_Declare(
#        antara-gaming-sdk
#        URL https://github.com/KomodoPlatform/antara-gaming-sdk/archive/master.zip
#)
#FetchContent_MakeAvailable(antara-gaming-sdk)
#init_apple_env()
add_executable(quick_and_dirty quick_and_dirty.cpp)
target_link_libraries(quick_and_dirty PUBLIC antara::world)

# A Cpp File with Necessary Primitives

Create a cpp file with the primitives necessary to launch the intended game.

#include <iostream>
#include <antara/gaming/core/safe.refl.hpp>
#include <antara/gaming/world/world.app.hpp>
class example_system final : public antara::gaming::ecs::post_update_system<example_system>
{
public:
    example_system(entt::registry& entity_registry) noexcept : system(entity_registry)
    {
        //! Here you can initialize your system, adding entities etc
    }
    void update() noexcept final
    {
        //! Your game logic here
        nb_iteration += 1;
        std::cout << "nb_iteration: " << nb_iteration << "\n";
        if (nb_iteration == 10ull) {
            std::cout << "Maximum iteration reached, leaving game now\n";
            this->dispatcher_.trigger<antara::gaming::event::quit_game>(0);
        }
    }
private:
    std::size_t nb_iteration{0ull};
};
REFL_AUTO(type(example_system));
class my_world_example : public antara::gaming::world::app
{
public:
    my_world_example() noexcept
    {
        this->system_manager_.create_system<example_system>(); //! Here we load our system to use it.
    }
};
int main()
{
    my_world_example world;
    return world.run();
}

# SDK Components