Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::EstellaContext Class Reference

#include <EstellaContext.hpp>

Public Member Functions

 EstellaContext ()
 ~EstellaContext ()
 EstellaContext (const EstellaContext &)=delete
EstellaContext & operator= (const EstellaContext &)=delete
bool init (int webglContextHandle)
 Initialize with an existing WebGL context handle.
bool init (int webglContextHandle, bool ownsContext)
bool init (Unique< GfxDevice > device)
 Initialize with an injected render backend.
void shutdown ()
 Shut down all subsystems and release resources.
bool isInitialized () const
 Check if the context is initialized.
RenderThread & renderThread ()
ServiceRegistry & services ()
template<typename T>
T & require ()
template<typename T>
T * tryGet ()
EngineState & state ()
const EngineState & state () const

Detailed Description

Definition at line 24 of file EstellaContext.hpp.

Constructor & Destructor Documentation

◆ EstellaContext() [1/2]

esengine::EstellaContext::EstellaContext ( )

Definition at line 54 of file EstellaContext.cpp.

Referenced by EstellaContext(), and operator=().

◆ ~EstellaContext()

esengine::EstellaContext::~EstellaContext ( )

Definition at line 92 of file EstellaContext.cpp.

References shutdown().

◆ EstellaContext() [2/2]

esengine::EstellaContext::EstellaContext ( const EstellaContext & )
delete

References EstellaContext().

Member Function Documentation

◆ init() [1/3]

bool esengine::EstellaContext::init ( int webglContextHandle)

Initialize with an existing WebGL context handle.

Parameters
webglContextHandleValid WebGL context (from emscripten_webgl_create_context)
Returns
True on success

Convenience for the GL backend: makes the context current and delegates to init(UniquePtr<GfxDevice>) with a GLDevice. Borrows the handle; its owner must keep it registered until shutdown.

Referenced by EMSCRIPTEN_BINDINGS().

◆ init() [2/3]

bool esengine::EstellaContext::init ( int webglContextHandle,
bool ownsContext )

Adopt a WebGL handle only when its creator explicitly transfers ownership.

◆ init() [3/3]

bool esengine::EstellaContext::init ( Unique< GfxDevice > device)

Initialize with an injected render backend.

Parameters
deviceA ready-to-use GfxDevice (e.g. a WebGPUDevice whose surface is already configured). The platform edge owns backend selection — exactly as the WebGL overload receives an externally created context handle — so this class needs no backend-specific code.
Returns
True on success

Definition at line 126 of file EstellaContext.cpp.

References ES_LOG_ERROR, and ES_LOG_WARN.

◆ isInitialized()

bool esengine::EstellaContext::isInitialized ( ) const
inline

Check if the context is initialized.

Definition at line 61 of file EstellaContext.hpp.

Referenced by EMSCRIPTEN_BINDINGS().

◆ operator=()

EstellaContext & esengine::EstellaContext::operator= ( const EstellaContext & )
delete

References EstellaContext().

◆ renderThread()

◆ require()

◆ services()

ServiceRegistry & esengine::EstellaContext::services ( )
inline

◆ shutdown()

void esengine::EstellaContext::shutdown ( )

Shut down all subsystems and release resources.

Definition at line 246 of file EstellaContext.cpp.

References ES_LOG_INFO, shutdown(), and tryGet().

Referenced by ~EstellaContext(), EMSCRIPTEN_BINDINGS(), and shutdown().

◆ state() [1/2]

◆ state() [2/2]

const EngineState & esengine::EstellaContext::state ( ) const
inline

Definition at line 74 of file EstellaContext.hpp.

◆ tryGet()


The documentation for this class was generated from the following files: