Skip to content

API Reference ​

This document provides a high-level conceptual reference for the PixelRoot32 Game Engine public API.

Source of Truth: The Markdown files in this directory are high-level conceptual guides. For detailed, method-level documentation (signatures, parameter descriptions, return values), the C++ header files (include/**/*.h) serve as the single source of truth.

Note: For the most up-to-date and comprehensive API documentation with examples and cross-references, visit the official documentation.

Table of Contents ​

The API documentation has been split into modular conceptual guides for easier maintenance. Click on a topic to jump to the detailed documentation.

Core Reference ​

TopicDescription
ConfigurationBuild flags, modular compilation, constants
Math ModuleScalar, Vector2, MathUtil, PRNG
Core ModuleEngine, Entity, Scene, SceneManager
Physics ModuleCollisionSystem, PhysicsActor, RigidActor, collision helpers
Graphics ModuleRenderer, sprites, tilemaps, particles, Camera2D
UI ModuleUI system, touch widgets, layouts
Audio ModuleAudioEngine, MusicPlayer, music tracks, sound profiles
Input ModuleInputManager, TouchManager, touch calibration
Networking ModuleNetSession, NetCounter, NetTransport, ESP-NOW and loopback transports
Persistence ModuleIKeyValueStore, ISlotStore, RecordCodec, PersistenceService, NVS, microSD, host-file and memory stores
Platform AbstractionsLogging, PlatformMemory, hardware capabilities

Quick Reference by Feature ​

Basic Setup ​

cpp
// Include the engine
#include "core/Engine.h"

int main() {
    // Configure display
    pixelroot32::graphics::DisplayConfig config;
    config.type = pixelroot32::graphics::DisplayType::ST7789;
    config.physicalWidth = 240;
    config.physicalHeight = 240;
    config.logicalWidth = 240;
    config.logicalHeight = 240;

    // Create engine
    pixelroot32::core::Engine engine(std::move(config));
    engine.init();

    // Run game loop
    engine.run();

    return 0;
}

Scene Creation ​

cpp
#include "core/Scene.h"

class MyScene : public pixelroot32::core::Scene {
public:
    void init() override {
        // Initialize scene
    }

    void update(unsigned long deltaTime) override {
        // Update game logic
    }

    void draw(pixelroot32::graphics::Renderer& renderer) override {
        renderer.beginFrame();
        // Draw everything
        renderer.endFrame();
    }
};

Module Availability ​

Some modules are optional and can be disabled to save memory:

ModuleMacroDefault
AudioPIXELROOT32_ENABLE_AUDIOEnabled
PhysicsPIXELROOT32_ENABLE_PHYSICSEnabled
UI SystemPIXELROOT32_ENABLE_UI_SYSTEMEnabled
ParticlesPIXELROOT32_ENABLE_PARTICLESEnabled
Touch InputPIXELROOT32_ENABLE_TOUCHDisabled
Networking (ESP-NOW)PIXELROOT32_ENABLE_NETWORKINGDisabled
Persistence (save data)PIXELROOT32_ENABLE_PERSISTENCEDisabled
Save slots on microSD (ESP32)PIXELROOT32_ENABLE_SD_STORAGEDisabled
2bpp SpritesPIXELROOT32_ENABLE_2BPP_SPRITESDisabled
4bpp SpritesPIXELROOT32_ENABLE_4BPP_SPRITESDisabled
Tile AnimationsPIXELROOT32_ENABLE_TILE_ANIMATIONSEnabled
Static tilemap FB cache (4bpp)PIXELROOT32_ENABLE_STATIC_TILEMAP_FB_CACHEEnabled (PlatformDefaults.h)
Dirty RegionsPIXELROOT32_ENABLE_DIRTY_REGIONSDisabled
Debug OverlayPIXELROOT32_ENABLE_DEBUG_OVERLAYDisabled

Released under the MIT License.