Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
EngineContext.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
3#pragma once
4
5
6#include "../core/Types.hpp"
9
10namespace esengine {
11
19public:
20 static EngineContext& instance();
21
22 EngineContext(const EngineContext&) = delete;
24
25 EstellaContext& context() { return context_; }
26
27 ServiceRegistry& services() { return context_.services(); }
28
29 template<typename T>
30 T& require() { return context_.require<T>(); }
31
32 template<typename T>
33 T* tryGet() { return context_.tryGet<T>(); }
34
35 EngineState& state() { return context_.state(); }
36 const EngineState& state() const { return context_.state(); }
37
38 void shutdown() { context_.shutdown(); }
39
40private:
41 EngineContext() = default;
42 ~EngineContext() = default;
43
44 EstellaContext context_;
45};
46
47} // namespace esengine
48
Instance-based engine context for estella renderer.
Typed service locator for engine subsystems.
Core type definitions and utilities for ESEngine.
Legacy singleton wrapper around EstellaContext.
EstellaContext & context()
ServiceRegistry & services()
const EngineState & state() const
EngineContext(const EngineContext &)=delete
EngineContext & operator=(const EngineContext &)=delete
static EngineContext & instance()
Typed service locator for engine subsystems.