#include <stellarlib/stellarlib.hpp>
#include <SDL3/SDL_log.h>
#include <memory>
#include <optional>
#include <string>
#include <vector>
using namespace stellarlib;
namespace
{
{
public:
[[nodiscard]]
constexpr scene2() noexcept
{
SDL_Log("%p: constructor", static_cast<const void *>(this));
}
[[nodiscard]]
constexpr scene2(const scene2 &) noexcept = delete;
[[nodiscard]]
constexpr scene2(scene2 &&) noexcept = delete;
constexpr auto operator=(const scene2 &) noexcept
-> scene2 & = delete;
constexpr auto operator=(scene2 &&) noexcept
-> scene2 & = delete;
constexpr ~scene2() noexcept final
{
SDL_Log("%p: destructor", static_cast<const void *>(this));
}
private:
constexpr void begin([[maybe_unused]]
app::context &ctx)
noexcept final
{
SDL_Log("%p: begin", static_cast<const void *>(this));
}
[[nodiscard]]
constexpr auto update([[maybe_unused]]
app::context &ctx)
noexcept
-> std::optional<std::unique_ptr<app::scene>> final
{
SDL_Log("%p: update", static_cast<const void *>(this));
return nullptr;
}
constexpr void end([[maybe_unused]]
app::context &ctx)
noexcept final
{
SDL_Log("%p: end", static_cast<const void *>(this));
}
};
{
public:
[[nodiscard]]
constexpr scene1() noexcept
{
SDL_Log("%p: constructor", static_cast<const void *>(this));
}
[[nodiscard]]
constexpr scene1(const scene1 &) noexcept = delete;
[[nodiscard]]
constexpr scene1(scene1 &&) noexcept = delete;
constexpr auto operator=(const scene1 &) noexcept
-> scene1 & = delete;
constexpr auto operator=(scene1 &&) noexcept
-> scene1 & = delete;
constexpr ~scene1() noexcept final
{
SDL_Log("%p: destructor", static_cast<const void *>(this));
}
private:
constexpr void begin([[maybe_unused]]
app::context &ctx)
noexcept final
{
SDL_Log("%p: begin", static_cast<const void *>(this));
}
[[nodiscard]]
-> std::optional<std::unique_ptr<app::scene>> final
{
SDL_Log("%p: update", static_cast<const void *>(this));
return std::make_unique<scene2>();
}
constexpr void end([[maybe_unused]]
app::context &ctx)
noexcept final
{
SDL_Log("%p: end", static_cast<const void *>(this));
}
};
}
auto app::init(
const std::vector<std::string> &args)
-> std::optional<info>
{
SDL_Log("%s", args.front().c_str());
return {{
.metadata = {
.name = "scenes",
.version = "0.1.0",
.identifier = "org.stellarlib.scenes",
.creator = "Domán Zana",
.copyright = "Copyright (C) 2025-2026 Domán Zana",
.url = "https://zanadoman.github.io/stellarlib/examples_2scenes_8cpp-example.html",
.type = "application"
},
.clock = {
.target_frequency = 60.0F,
.max_delta = 0.05F
},
.window = {
.title = "scenes"
},
.entry = std::make_unique<scene1>()
}};
}
Application context.
Definition context.hpp:51
Application scene interface.
Definition scene.hpp:39
auto init(const std::vector< std::string > &args) -> std::optional< info >
External entry point (implement this for interactive applications).
Definition healthcheck.cpp:72