Skip to content

API Overview

The ESEngine API is organized into several modules. This page provides an overview; detailed documentation is available in the Doxygen-generated reference.

API Modules

Core

Application lifecycle, logging, and fundamental types.

  • Application - Base class for games
  • ApplicationConfig - Startup configuration
  • ES_LOG_* - Logging macros

ECS

Entity-Component-System for game objects.

  • Registry - Entity/component container
  • Entity - Unique identifier type
  • View - Query iterator

Renderer

WebGL-based graphics.

  • Renderer - Drawing API
  • Texture - Image loading
  • Shader - Custom shaders

Platform

OS and browser abstraction.

  • Platform - Window/context
  • Input - Keyboard/mouse/touch

Key Classes

Application

The main entry point for games. Inherit and override lifecycle methods.

class Application {
public:
Application(const ApplicationConfig& config = {});
void run();
void quit();
protected:
virtual void onInit();
virtual void onUpdate(f32 deltaTime);
virtual void onRender();
virtual void onShutdown();
virtual void onTouch(TouchType type, const TouchPoint& point);
virtual void onKey(KeyCode key, bool pressed);
virtual void onResize(u32 width, u32 height);
Platform& getPlatform();
ecs::Registry& getRegistry();
};

Registry

Central ECS container for entities and components.

class Registry {
public:
// Entity management
Entity create();
void destroy(Entity entity);
bool valid(Entity entity) const;
// Component management
template<typename T, typename... Args>
T& emplace(Entity entity, Args&&... args);
template<typename T>
T& get(Entity entity);
template<typename T>
bool has(Entity entity) const;
// Queries
template<typename... Components>
View<Components...> view();
};

View

Iterator for querying entities with specific components.

template<typename... Components>
class View {
public:
// Range-based for loop
iterator begin();
iterator end();
// Structured bindings iteration
auto each();
// Direct component access
template<typename T>
T& get(Entity entity);
};

Type Aliases

ESEngine uses consistent type aliases throughout the codebase:

namespace esengine {
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using usize = size_t;
template<typename T>
using Unique = std::unique_ptr<T>;
template<typename T>
using Shared = std::shared_ptr<T>;
}

Logging Macros

ES_LOG_TRACE("Detailed debug info: {}", value);
ES_LOG_DEBUG("Debug message");
ES_LOG_INFO("General information");
ES_LOG_WARN("Warning message");
ES_LOG_ERROR("Error occurred: {}", errorMsg);

Assertions

ES_ASSERT(condition, "Message if condition is false");
ES_VERIFY(ptr != nullptr, "Pointer must not be null");

Doxygen Reference

For complete API documentation with all parameters, return types, and examples, see the Doxygen-generated reference.

Open API Documentation →

The Doxygen documentation includes:

  • All public classes and functions
  • Parameter descriptions
  • Code examples
  • Inheritance diagrams
  • Source code references