mitiru

Top-level engine surface. Entry-point helpers (`Run`), core configuration (`EngineConfig`), the game loop (`Game`), scenes (`Scene`, `MultiSceneManager`), the event bus, the localization manager, and other engine-wide primitives.

Top-level engine surface. Entry-point helpers (`Run`), core configuration (`EngineConfig`), the game loop (`Game`), scenes (`Scene`, `MultiSceneManager`), the event bus, the localization manager, and other engine-wide primitives.

NameKindItems
BinaryWriterclass13
BinaryReaderclass13
Clockclass8
CommandResultstruct2
ScriptLinestruct2
CommandScriptclass12
CommandResultstruct6
CommandDefstruct8
CommandSystemclass20
Backendenum8
DisplayModeenum2
EngineConfigstruct46
EngineCommandsclass1
InputEventTypeenum5
AudioEventTypeenum4
GameStateEventTypeenum7
WindowResizeEventstruct2
SceneChangeEventstruct2
InputEventstruct4
AudioEventstruct2
GameStateEventstruct2
EventBusclass12
FrameTimerclass12
Sizestruct3
Gameclass16
GameLoopConfigstruct3
GamePluginclass21
GameSettingsclass3
JobPriorityenum3
JobHandleclass3
JobSystemclass16
Languagestruct3
LocalizationManagerclass12
AllocationInfostruct5
LeakInfostruct4
MemoryBudgetstruct2
MemoryProfilerclass18
AppConfigstruct6
IGameSceneclass5
MitiruAppclass16
SceneEntrystruct5
MultiSceneManagerclass20
NoLockstruct2
MutexLockstruct2
ObjectPoolclass12
PrefabDefstruct6
PrefabLibraryclass17
Randomclass13
ITraitstruct4
MeshTraitstruct5
LightTraitstruct7
CameraTraitstruct6
PhysicsTraitstruct11
ScriptTraitstruct5
AudioTraitstruct7
CustomTraitstruct5
Nodestruct20
Sceneclass28
JsonTypeenum14
JsonValueclass23
JsonWriterclass18
JsonReaderclass16
ISerializableclass3
SerializationRegistryclass7
ServiceRegistryclass12
Signalclass132
FrameBudgetclass15
FrameBudgetScopeclass6
LogEntrystruct5
LogViewerclass19
FrameBreakdownstruct8
MemoryBreakdownstruct6
ScopeTimerclass6
ProfilerConnectionclass15
SectionTimingstruct8
FrameDatastruct2
ProfilerGUIclass16
ColorFlashclass6
FadeDirectionenum3
Fadeclass9
TrailPointstruct2
Trailclass9
InputCommandTypeenum5
InputCommandstruct5
InputInjectorclass4
GamepadButtonIdenum14
BindingTypeenum4
InputBindingstruct6
InputStateProviderstruct7
InputMapperclass15
InputFramestruct3
ReplayDatastruct6
InputRecorderclass5
InputReplayerclass9
MouseButtonenum3
InputStateclass26
KeyCodeenum107
TouchPhaseenum4
SwipeDirectionenum4
TouchPointstruct5
GestureConfigstruct7
PinchInfostruct3
RotateInfostruct3
TouchInputManagerclass19
MouseWheelAxisenum2
Win32Inputclass16
ObserveServerConfigstruct5
ObserveServerclass12
SnapshotDatastruct7
PlatformTypeenum7
IPlatformclass3
IWindowclass9
OsTypeenum5
CpuArchenum6
AvailableBackendsstruct8
AvailableWindowBackendsstruct4
PlatformInfostruct7
WindowBackendenum5
EmscriptenPlatformclass2
EmscriptenWindowclass10
GlfwInputConfigstruct8
GlfwJoystickStatestruct5
GlfwScrollStatestruct3
GlfwInputclass12
GlfwVulkanSurfaceDescstruct2
SurfaceCreateResultstruct4
GlfwVulkanSurfaceclass2
GlfwGraphicsModeenum2
GlfwWindowclass19
HeadlessWindowclass7
HeadlessPlatformclass2
AudioSampleFormatenum2
AudioDeviceConfigstruct9
ObtainedAudioFormatstruct5
Sdl2Audioclass13
Sdl2InputConfigstruct7
GamepadStatestruct4
MouseWheelStatestruct3
Sdl2Inputclass12
Sdl2Windowclass18
Win32Platformclass3
Win32Windowclass28
AaRendererclass5
FontRendererclass13
GradientStopstruct3
LinearGradientstruct2
RadialGradientstruct4
ConicGradientstruct4
GradientRendererclass6
TextRendererclass6
FilterModeenum4
TextureFilterstruct17
RoundedRectParamsstruct13
UiShapeRendererclass5
UiShapeCacheclass49
Nodeclass21
SpriteNodeclass3
LabelNodeclass3
TimerNodeclass9
EngineBridgeContextstruct8
EngineCallbacksstruct22
EngineHttpServerclass9
EngineCallbacksstruct22
EngineHttpServerclass16
IssueSeverityenum2
IssueTypeenum6
DrawIssuestruct3
FrameStatsstruct6
DrawCallValidatorclass21
TestResultstruct4
GameTeststruct2
TestHarnessclass5

Free functions and typedefs

inline void Run(Game& game, const EngineConfig& config = {})
template <typename T> void Run(const char* title = "Mitiru Game", int width = 1280, int height = 720)
class BinaryWriter 13
explicit BinaryWriter(const std::string& path)
[[nodiscard]] bool isOpen() const
void writeU8(uint8_t v)
void writeU16(uint16_t v)
void writeU32(uint32_t v)
void writeI32(int32_t v)
void writeF32(float v)
void writeBool(bool v)
void writeString(const std::string& s)
void writeVec3(const float v[3])
void writeRaw(const void* data, size_t size)
[[nodiscard]] std::streampos beginBlock()
void endBlock(std::streampos blockStart)
class BinaryReader 13
explicit BinaryReader(const std::string& path)
[[nodiscard]] bool isOpen() const
[[nodiscard]] uint32_t version() const
[[nodiscard]] uint8_t readU8()
[[nodiscard]] uint16_t readU16()
[[nodiscard]] uint32_t readU32()
[[nodiscard]] int32_t readI32()
[[nodiscard]] float readF32()
[[nodiscard]] bool readBool()
[[nodiscard]] std::string readString()
void readVec3(float out[3])
[[nodiscard]] uint32_t readBlockSize()
void skip(uint32_t bytes)
class Clock 8
explicit Clock(float targetTps = 60.0f, bool deterministic = false) noexcept
[[nodiscard]] float tick() noexcept
[[nodiscard]] std::uint64_t frameNumber() const noexcept
[[nodiscard]] float elapsed() const noexcept
[[nodiscard]] float targetTps() const noexcept
[[nodiscard]] float fixedDt() const noexcept
[[nodiscard]] bool isDeterministic() const noexcept
void reset() noexcept
struct CommandResult 2
bool success = false
std::string message
struct ScriptLine 2
std::string raw
int lineNumber = 0
class CommandScript 12
using EchoHandler = std::function<void(const std::string&)>;
using WaitHandler = std::function<void(float)>;
bool loadFromFile(const std::string& path)
void loadFromString(const std::string& text)
[[nodiscard]] std::vector<CommandResult> execute(CommandSystem& cmdSystem)
void setEchoHandler(EchoHandler handler)
void setWaitHandler(WaitHandler handler)
void setVariable(const std::string& name, const std::string& value)
[[nodiscard]] std::string getVariable(const std::string& name) const
[[nodiscard]] std::size_t lineCount() const noexcept
[[nodiscard]] const std::string& sourcePath() const noexcept
using CommandArg = std::variant<std::monostate, bool, int, float, std::string>;
struct CommandResult 6
bool success = true
std::string message
std::vector<std::string> output
static CommandResult ok(const std::string& msg = {})
static CommandResult ok(const std::string& msg, const std::vector<std::string>& lines)
static CommandResult fail(const std::string& msg)
struct CommandDef 8
std::string name
std::string category
std::string description
std::string usage
std::vector<std::string> argNames
std::vector<std::string> argTypes
std::vector<bool> argRequired
std::function<CommandResult(const std::vector<CommandArg>&)> execute
class CommandSystem 20
void registerCommand(const CommandDef& def)
CommandResult execute(const std::string& name, const std::vector<CommandArg>& args = {})
CommandResult executeString(const std::string& commandLine)
[[nodiscard]] const std::vector<CommandDef>& commands() const noexcept
[[nodiscard]] std::vector<const CommandDef*> commandsInCategory( const std::string& category) const
[[nodiscard]] std::vector<std::string> categories() const
[[nodiscard]] const CommandDef* findCommand(const std::string& name) const
[[nodiscard]] std::vector<std::string> autocomplete(const std::string& prefix) const
[[nodiscard]] std::vector<const CommandDef*> fuzzySearch(const std::string& query) const
void pushHistory(const std::string& line)
[[nodiscard]] const std::vector<std::string>& history() const noexcept
void clearHistory() noexcept
std::vector<CommandResult> executeBatch(const std::string& multiLineScript)
void beginRecording(const std::string& macroName)
void endRecording()
void playMacro(const std::string& macroName)
[[nodiscard]] const std::vector<std::string>& getMacro(const std::string& name) const
[[nodiscard]] std::vector<std::string> macroNames() const
[[nodiscard]] bool isRecording() const noexcept
[[nodiscard]] std::size_t commandCount() const noexcept
enum Backend 8
Auto
Dx11
Dx12
Vulkan
OpenGL
WebGL
WebGPU
Null
enum DisplayMode 2
Windowed
BorderlessFullscreen
struct EngineConfig 46
enum `FontAtlas : std::uint32_t` { None = 0, Ascii = 1u << 0, Hiragana = 1u << 1, Katakana = 1u << 2, CjkPunctuation = 1u << 3, Fullwidth = 1u << 4, CommonKanji = 1u << 5, Latin = Ascii, Kana = Ascii | Hiragana | Katakana, Japanese = Ascii | Hiragana | Katakana | CjkPunctuation | Fullwidth | CommonKanji }
std::string title = "Mitiru Game"
int windowWidth = 1920
int windowHeight = 1080
bool useLogicalWindowSize = false
DisplayMode displayMode = DisplayMode::Windowed
bool vsync = true
int targetFps = 0
bool headless = false
bool deterministic = false
std::uint64_t randomSeed = 42
float targetTps = 60.0f
gfx::Backend gfxBackend = gfx::Backend::Auto
bool enableObserver = true
int observePort = 0
bool enableDiffTracking = false
bool enableCausalTracking = false
bool enableTemporalValidation = false
bool enableUIValidation = false
bool enableHttpApi = false
int httpApiPort = 8090
bool imguiVisibleOnStart = false
std::string fontPath
bool skipDefaultFont = false
FontAtlas fontAtlasRanges = FontAtlas::Japanese
bool enableCef = true
std::string cefLogPath
std::string cefStartUrl
int cefRemoteDebuggingPort = 0
std::vector<std::string> cefAdditionalAssetDirs
float masterVolume = 1.0f
float bgmVolume = 0.8f
float seVolume = 1.0f
float voiceVolume = 1.0f
std::string language = "ja"
std::map<std::string, int> keyBindings
bool persistSettings = false
std::string settingsFileName = "settings.json"
bool autoTestMode = false
int autoTestFrames = 60
std::string autoTestOutputDir = "."
bool autoTestExitAfter = true
[[nodiscard]] inline std::string argString( const std::vector<CommandArg>& args, std::size_t idx, const std::string& defaultVal = {})
[[nodiscard]] inline int argInt( const std::vector<CommandArg>& args, std::size_t idx, int defaultVal = 0)
[[nodiscard]] inline float argFloat( const std::vector<CommandArg>& args, std::size_t idx, float defaultVal = 0.0f)
[[nodiscard]] inline bool argBool( const std::vector<CommandArg>& args, std::size_t idx, bool defaultVal = false)
class EngineCommands 1
static void registerAll(CommandSystem& cmd, Engine& engine)
enum InputEventType : uint8_t 5
KeyDown = 0
KeyUp
MouseDown
MouseUp
MouseMove
enum AudioEventType : uint8_t 4
Play = 0
Stop
Pause
Resume
enum GameStateEventType : uint8_t 7
Started = 0
Paused
Resumed
Saved
Loaded
Custom
using SubscriptionId = uint64_t;
struct WindowResizeEvent 2
int width = 0
int height = 0
struct SceneChangeEvent 2
std::string fromScene
std::string toScene
struct InputEvent 4
InputEventType type = InputEventType::KeyDown
int key = 0
float mouseX = 0.0f
float mouseY = 0.0f
struct AudioEvent 2
AudioEventType type = AudioEventType::Play
int trackId = -1
struct GameStateEvent 2
GameStateEventType type = GameStateEventType::Custom
std::string data
class EventBus 12
EventBus() = default
EventBus(const EventBus&) = delete
EventBus& operator=(const EventBus&) = delete
EventBus(EventBus&&) = delete
EventBus& operator=(EventBus&&) = delete
template <typename EventType> SubscriptionId subscribe(std::function<void(const EventType&)> handler)
void unsubscribe(SubscriptionId subscriptionId)
template <typename EventType> void publish(const EventType& event)
template <typename EventType> void publishDeferred(const EventType& event)
void processDeferred()
template <typename EventType> [[nodiscard]] std::size_t subscriberCount() const
void clear()
class FrameTimer 12
explicit FrameTimer( std::size_t smoothFrames = DEFAULT_SMOOTH_FRAMES, float maxDelta = DEFAULT_MAX_DELTA) noexcept
[[nodiscard]] float tick() noexcept
[[nodiscard]] float getFps() const noexcept
[[nodiscard]] std::uint64_t getFrameCount() const noexcept
[[nodiscard]] float getSmoothedDelta() const noexcept
void setFixedDeltaTime(float dt) noexcept
[[nodiscard]] float getFixedDeltaTime() const noexcept
[[nodiscard]] float getAccumulator() const noexcept
[[nodiscard]] bool consumeFixedStep() noexcept
void setMaxDelta(float maxDelta) noexcept
[[nodiscard]] float getMaxDelta() const noexcept
void reset() noexcept
struct Size 3
int width = 0
int height = 0
[[nodiscard]] constexpr bool operator==(const Size&) const noexcept = default
class Game 16
virtual ~Game() = default
virtual void onExit()
virtual void update(float dt) = 0
virtual void draw(Screen& screen) = 0
[[nodiscard]] virtual Size layout(int outsideWidth, int outsideHeight) = 0
void setInputState(const InputState* input) noexcept
void setRenderer3D(render::IRenderer3D* renderer) noexcept
void setEngine(Engine* engine) noexcept
[[nodiscard]] Engine* engine() noexcept
[[nodiscard]] const Engine* engine() const noexcept
[[nodiscard]] Scene& scene() noexcept
[[nodiscard]] const Scene& scene() const noexcept
bool loadScene(const std::string& path)
bool saveScene(const std::string& path) const
template <typename UpdateFn, typename RenderFn, typename QuitFn> std::uint64_t runGameLoop( const GameLoopConfig& config, UpdateFn&& updateFn, RenderFn&& renderFn, QuitFn&& shouldQuitFn)
template <typename UpdateFn, typename RenderFn> std::uint64_t runGameLoopFrames( const GameLoopConfig& config, std::uint64_t maxFrames, UpdateFn&& updateFn, RenderFn&& renderFn)
struct GameLoopConfig 3
float targetFps = 60.0f
float fixedDeltaTime = 1.0f / 60.0f
int maxFrameSkip = 5
class GamePlugin 21
other.m_handle = nullptr
other.m_createFn = nullptr
other.m_destroyFn = nullptr
other.m_nameFn = nullptr
other.m_loadTime = 0
GamePlugin() = default
~GamePlugin()
GamePlugin(const GamePlugin&) = delete
GamePlugin& operator=(const GamePlugin&) = delete
GamePlugin(GamePlugin&& other) noexcept
} GamePlugin& operator=(GamePlugin&& other) noexcept
bool load(const std::string& path)
void unload()
bool reload()
[[nodiscard]] Game* createGame()
void destroyGame(Game* game)
[[nodiscard]] std::string gameName() const
[[nodiscard]] bool isLoaded() const noexcept
[[nodiscard]] const std::string& dllPath() const noexcept
[[nodiscard]] std::uint64_t lastModified() const
[[nodiscard]] bool isModified() const
class GameSettings 3
[[nodiscard]] static std::filesystem::path resolvePath( const std::string& appName, const std::string& fileName = "settings.json")
static bool loadInto(EngineConfig& config)
static bool saveFrom(const EngineConfig& config)
enum JobPriority 3
High
Normal
Low
class JobHandle 3
JobHandle() noexcept
[[nodiscard]] bool isComplete() const noexcept
void wait() const
class JobSystem 16
JobSystem() noexcept = default
~JobSystem()
JobSystem(const JobSystem&) = delete
JobSystem& operator=(const JobSystem&) = delete
JobSystem(JobSystem&&) = delete
JobSystem& operator=(JobSystem&&) = delete
void init(int threadCount = 0)
[[nodiscard]] bool isInitialized() const noexcept
[[nodiscard]] int threadCount() const noexcept
[[nodiscard]] JobHandle schedule(std::function<void()> job, JobPriority priority = JobPriority::Normal)
[[nodiscard]] JobHandle schedule(std::function<void()> job, const JobHandle& dependency, JobPriority priority = JobPriority::Normal)
[[nodiscard]] JobHandle scheduleParallel( std::size_t itemCount, std::size_t batchSize, std::function<void(std::size_t, std::size_t)> func)
void wait(const JobHandle& handle)
[[nodiscard]] bool isComplete(const JobHandle& handle) const noexcept
void shutdown()
using TranslationTable = std::map<std::string, std::map<std::string, std::string>>;
struct Language 3
std::string code
std::string name
std::string fontPath
class LocalizationManager 12
bool loadTranslationsFromString(std::string_view jsonString)
bool loadTranslations(std::string_view jsonPath)
void setLanguage(std::string_view code)
[[nodiscard]] const std::string& currentLanguage() const noexcept
[[nodiscard]] std::string t(std::string_view key) const
[[nodiscard]] std::string t(std::string_view key, std::string_view language) const
[[nodiscard]] bool hasKey(std::string_view key) const
[[nodiscard]] const std::vector<Language>& availableLanguages() const noexcept
template <typename... Args> [[nodiscard]] std::string tf(std::string_view key, Args&&... args) const
[[nodiscard]] std::string tp(std::string_view key, int count) const
[[nodiscard]] std::string fontForLanguage(std::string_view code) const
[[nodiscard]] const TranslationTable& translations() const noexcept
struct AllocationInfo 5
const void* ptr = nullptr
std::size_t size = 0
std::string tag
std::uint64_t frameNumber = 0
std::uint64_t timestamp = 0
struct LeakInfo 4
const void* ptr = nullptr
std::size_t size = 0
std::string tag
std::uint64_t frameNumber = 0
struct MemoryBudget 2
std::size_t maxBytes = 0
std::size_t currentBytes = 0
class MemoryProfiler 18
explicit MemoryProfiler(std::size_t historySize = kDefaultHistorySize) noexcept
void trackAllocation(const void* ptr, std::size_t size, const std::string& tag = "default")
void trackDeallocation(const void* ptr)
[[nodiscard]] std::size_t getCurrentUsage() const noexcept
[[nodiscard]] std::size_t getPeakUsage() const noexcept
[[nodiscard]] std::size_t getUsageByTag(const std::string& tag) const
[[nodiscard]] std::vector<AllocationInfo> getAllocations() const
[[nodiscard]] std::vector<LeakInfo> detectLeaks() const
void setBudget(const std::string& tag, std::size_t maxBytes)
[[nodiscard]] bool isOverBudget(const std::string& tag) const
void advanceFrame() noexcept
[[nodiscard]] std::vector<AllocationInfo> getHistory() const
[[nodiscard]] std::uint64_t allocationCount() const noexcept
[[nodiscard]] std::uint64_t deallocationCount() const noexcept
[[nodiscard]] std::size_t activeAllocationCount() const noexcept
[[nodiscard]] std::unordered_map<std::string, std::size_t> tagUsageMap() const
void reset()
void drawOverlay(Screen& screen) const
struct AppConfig 6
std::string windowTitle = "Mitiru Game"
int width = 1280
int height = 720
gfx::Backend gfxBackend = gfx::Backend::Null
bool vsync = true
float fixedTimestep = 1.0f / 60.0f
class IGameScene 5
virtual ~IGameScene() = default
virtual void onInit(MitiruApp& app) = 0
virtual void onUpdate(float dt) = 0
virtual void onDraw() = 0
virtual void onShutdown() = 0
class MitiruApp 16
explicit MitiruApp(const AppConfig& config = {})
~MitiruApp() = default
MitiruApp(const MitiruApp&) = delete
MitiruApp& operator=(const MitiruApp&) = delete
MitiruApp(MitiruApp&&) noexcept = default
MitiruApp& operator=(MitiruApp&&) noexcept = default
[[nodiscard]] bool init()
void run(IGameScene& scene)
void shutdown()
[[nodiscard]] IWindow* getWindow() const noexcept
[[nodiscard]] gfx::IDevice* getDevice() const noexcept
[[nodiscard]] FrameTimer& getTimer() noexcept
[[nodiscard]] const FrameTimer& getTimer() const noexcept
[[nodiscard]] const AppConfig& getConfig() const noexcept
void setWindow(IWindow* window) noexcept
void setDevice(gfx::IDevice* device) noexcept
struct SceneEntry 5
std::string name
std::string filePath
std::unique_ptr<Scene> scene
SceneEntry() = default
explicit SceneEntry(const std::string& sceneName)
class MultiSceneManager 20
int openScene(const std::string& name)
void closeScene(int index)
void setActiveScene(int index)
[[nodiscard]] int activeSceneIndex() const noexcept
[[nodiscard]] Scene& activeScene()
[[nodiscard]] const Scene& activeScene() const
[[nodiscard]] Scene* activeScenePtr() noexcept
[[nodiscard]] Scene& sceneAt(int index)
[[nodiscard]] const Scene& sceneAt(int index) const
[[nodiscard]] int sceneCount() const noexcept
[[nodiscard]] bool empty() const noexcept
[[nodiscard]] const std::string& sceneName(int index) const
[[nodiscard]] const std::string& scenePath(int index) const
void renameScene(int index, const std::string& name)
int duplicateScene(int index)
[[nodiscard]] bool isSceneDirty(int index) const
bool saveScene(int index, const std::string& path)
int loadScene(const std::string& path)
void saveAll(const std::string& dirPath)
[[nodiscard]] int findByName(const std::string& name) const
struct NoLock 2
void lock() noexcept
void unlock() noexcept
struct MutexLock 2
void lock()
void unlock()
class ObjectPool 12
explicit ObjectPool(std::size_t capacity)
~ObjectPool()
ObjectPool(const ObjectPool&) = delete
ObjectPool& operator=(const ObjectPool&) = delete
ObjectPool(ObjectPool&&) = delete
ObjectPool& operator=(ObjectPool&&) = delete
[[nodiscard]] T* acquire()
void release(T* ptr) noexcept
[[nodiscard]] bool owns(const T* ptr) const noexcept
[[nodiscard]] std::size_t capacity() const noexcept
[[nodiscard]] std::size_t available() const noexcept
[[nodiscard]] std::size_t activeCount() const noexcept
struct PrefabDef 6
std::string name
std::string category
std::string description
std::vector<Node> nodes
[[nodiscard]] std::size_t nodeCount() const noexcept
[[nodiscard]] bool empty() const noexcept
class PrefabLibrary 17
void registerPrefab(PrefabDef def)
void createFromNode(const Scene& scene, int nodeId, const std::string& name, const std::string& category = "")
int instantiate(Scene& scene, const std::string& prefabName, int parentId = -1) const
[[nodiscard]] bool hasPrefab(const std::string& name) const
[[nodiscard]] const PrefabDef* getPrefab(const std::string& name) const
[[nodiscard]] std::vector<std::string> prefabNames() const
[[nodiscard]] std::vector<std::string> prefabsInCategory( const std::string& category) const
[[nodiscard]] std::vector<std::string> categories() const
[[nodiscard]] std::size_t count() const noexcept
void removePrefab(const std::string& name)
void clear()
[[nodiscard]] std::string toJson(const std::string& prefabName) const
[[nodiscard]] std::string toJsonAll() const
bool saveToFile(const std::string& prefabName, const std::string& path) const
void saveAllToFile(const std::string& dirPath) const
void loadFromJson(const std::string& json)
void loadFromFile(const std::string& path)
class Random 13
explicit Random(uint32_t seed = 42) noexcept
void setSeed(uint32_t seed) noexcept
[[nodiscard]] uint32_t next() noexcept
[[nodiscard]] int nextInt(int min, int max) noexcept
[[nodiscard]] float nextFloat(float min = 0.0f, float max = 1.0f) noexcept
[[nodiscard]] bool nextBool(float probability = 0.5f) noexcept
[[nodiscard]] int pick(int size) noexcept
using TraitJson = nlohmann::json;
using SceneDocument = Scene;
using SceneNodeData = Node;
inline TraitJson parseTraitJson(const std::string& s) noexcept
inline void readFloatArray(const TraitJson& j, const char* key, float* out, int count)
inline TraitJson floatArray(const float* in, int count)
struct ITrait 4
virtual ~ITrait() = default
[[nodiscard]] virtual std::string traitType() const = 0
[[nodiscard]] virtual std::string toJson() const = 0
virtual void fromJson(const std::string& json) = 0
struct MeshTrait : ITrait 5
std::string meshPath
std::string materialName
[[nodiscard]] std::string traitType() const override
[[nodiscard]] std::string toJson() const override
void fromJson(const std::string& json) override
struct LightTrait : ITrait 7
std::string lightType = "directional"
float intensity = 1.0f
float range = 10.0f
float spotAngle = 45.0f
[[nodiscard]] std::string traitType() const override
[[nodiscard]] std::string toJson() const override
void fromJson(const std::string& json) override
struct CameraTrait : ITrait 6
float fov = 60.0f
float nearClip = 0.1f
float farClip = 1000.0f
[[nodiscard]] std::string traitType() const override
[[nodiscard]] std::string toJson() const override
void fromJson(const std::string& json) override
struct PhysicsTrait : ITrait 11
std::string bodyType = "dynamic"
float mass = 1.0f
float friction = 0.5f
float restitution = 0.3f
std::string colliderType = "box"
bool isTrigger = false
int collisionLayer = 0
int collisionMask = 0x7FFFFFFF
[[nodiscard]] std::string traitType() const override
[[nodiscard]] std::string toJson() const override
void fromJson(const std::string& json) override
struct ScriptTrait : ITrait 5
std::string scriptPath
std::map<std::string, std::string> variables
[[nodiscard]] std::string traitType() const override
[[nodiscard]] std::string toJson() const override
void fromJson(const std::string& json) override
struct AudioTrait : ITrait 7
std::string audioPath
float volume = 1.0f
bool loop = false
bool spatial = false
[[nodiscard]] std::string traitType() const override
[[nodiscard]] std::string toJson() const override
void fromJson(const std::string& json) override
struct CustomTrait : ITrait 5
std::string customType
std::map<std::string, std::string> properties
[[nodiscard]] std::string traitType() const override
[[nodiscard]] std::string toJson() const override
void fromJson(const std::string& ) override
struct Node 20
int id = -1
std::string name
int parentId = -1
bool visible = true
bool locked = false
std::vector<std::shared_ptr<ITrait>> traits
template<typename T> [[nodiscard]] T* getTrait()
template<typename T> [[nodiscard]] const T* getTrait() const
template<typename T, typename... Args> T& addTrait(Args&&... args)
template<typename T> [[nodiscard]] bool hasTrait() const
void removeTrait(const std::string& traitTypeName)
[[nodiscard]] std::string type() const
[[nodiscard]] std::string meshPath() const
[[nodiscard]] std::string materialName() const
[[nodiscard]] std::string lightType() const
[[nodiscard]] const float* lightColor() const
[[nodiscard]] float* lightColor()
[[nodiscard]] float lightIntensity() const
[[nodiscard]] const std::map<std::string, std::string>& properties() const
[[nodiscard]] std::map<std::string, std::string>& propertiesMut()
class Scene 28
int addNode(const std::string& name, int parent = -1)
int addNode(const Node& node)
void removeNode(int id)
[[nodiscard]] Node* getNode(int id)
[[nodiscard]] const Node* getNode(int id) const
[[nodiscard]] const std::vector<Node>& nodes() const noexcept
[[nodiscard]] std::size_t nodeCount() const noexcept
[[nodiscard]] int findByName(const std::string& name) const
[[nodiscard]] std::vector<int> findByTrait(const std::string& traitTypeName) const
[[nodiscard]] std::vector<int> findByType(const std::string& typeName) const
[[nodiscard]] std::vector<int> rootNodes() const
[[nodiscard]] std::vector<int> children(int parentId) const
int duplicateNode(int id)
int createEmpty(const std::string& name, int parent = -1)
int addMesh(const std::string& name, const std::string& meshPath, int parent = -1)
int addLight(const std::string& name, const std::string& lt = "directional", int parent = -1)
int addCamera(const std::string& name, int parent = -1)
int createMesh(const std::string& name, const std::string& meshPath, int parent = -1)
int createLight(const std::string& name, const std::string& lt, int parent = -1)
int createCamera(const std::string& name, int parent = -1)
[[nodiscard]] std::string toJson() const
bool fromJson(const std::string& json)
bool saveToFile(const std::string& path) const
bool loadFromFile(const std::string& path)
[[nodiscard]] bool isDirty() const noexcept
void clearDirty() noexcept
[[nodiscard]] std::string snapshot() const
void restore(const std::string& snap)
enum JsonType : std::uint8_t 14
Null
Bool
Int
Float
String
Array
Object
template <> inline bool JsonReader::read<bool>(const std::string& key, const bool& def) const
template <> inline int JsonReader::read<int>(const std::string& key, const int& def) const
template <> inline float JsonReader::read<float>(const std::string& key, const float& def) const
template <> inline std::string JsonReader::read<std::string>(const std::string& key, const std::string& def) const
template <> inline sgc::Vec2f JsonReader::read<sgc::Vec2f>(const std::string& key, const sgc::Vec2f& def) const
template <> inline sgc::Colorf JsonReader::read<sgc::Colorf>(const std::string& key, const sgc::Colorf& def) const
template <> inline sgc::Rectf JsonReader::read<sgc::Rectf>(const std::string& key, const sgc::Rectf& def) const
class JsonValue 23
JsonValue() = default
explicit JsonValue(bool v)
explicit JsonValue(int v)
explicit JsonValue(float v)
explicit JsonValue(double v)
explicit JsonValue(std::string v)
explicit JsonValue(std::string_view v)
explicit JsonValue(const char* v)
[[nodiscard]] JsonType type() const noexcept
[[nodiscard]] bool isNull() const noexcept
[[nodiscard]] bool asBool(bool def = false) const noexcept
[[nodiscard]] int asInt(int def = 0) const noexcept
[[nodiscard]] float asFloat(float def = 0.0f) const noexcept
[[nodiscard]] const std::string& asString(const std::string& def = s_empty) const noexcept
void pushBack(JsonValue val)
[[nodiscard]] std::size_t arraySize() const noexcept
[[nodiscard]] const JsonValue& at(std::size_t index) const
[[nodiscard]] const std::vector<JsonValue>& asArray() const noexcept
void set(const std::string& key, JsonValue val)
[[nodiscard]] bool has(const std::string& key) const
[[nodiscard]] const JsonValue& get(const std::string& key) const
[[nodiscard]] const std::unordered_map<std::string, JsonValue>& asObject() const noexcept
[[nodiscard]] std::string toJson(int indent = 0) const
class JsonWriter 18
JsonWriter() = default
void beginObject()
void endObject()
void beginArray(const std::string& key)
void endArray()
void write(const std::string& key, bool value)
void write(const std::string& key, int value)
void write(const std::string& key, float value)
void write(const std::string& key, const std::string& value)
void write(const std::string& key, std::string_view value)
void write(const std::string& key, const sgc::Vec2f& v)
void writeVec3(const std::string& key, float x, float y, float z)
void write(const std::string& key, const sgc::Colorf& c)
void write(const std::string& key, const sgc::Rectf& r)
template <typename T> void writeVector(const std::string& key, const std::vector<T>& vec)
template <typename T> void writeMap(const std::string& key, const std::unordered_map<std::string, T>& map)
[[nodiscard]] const JsonValue& root() const noexcept
[[nodiscard]] std::string toJson(int indent = 2) const
class JsonReader 16
explicit JsonReader(const JsonValue& value)
[[nodiscard]] bool has(const std::string& key) const
[[nodiscard]] bool readBool(const std::string& key, bool def = false) const
[[nodiscard]] int readInt(const std::string& key, int def = 0) const
[[nodiscard]] float readFloat(const std::string& key, float def = 0.0f) const
[[nodiscard]] std::string readString(const std::string& key, const std::string& def = "") const
[[nodiscard]] sgc::Vec2f readVec2(const std::string& key, const sgc::Vec2f& def = {}) const
[[nodiscard]] sgc::Colorf readColor(const std::string& key, const sgc::Colorf& def = {1.0f, 1.0f, 1.0f, 1.0f}) const
[[nodiscard]] sgc::Rectf readRect(const std::string& key, const sgc::Rectf& def = {}) const
[[nodiscard]] std::vector<int> readIntVector(const std::string& key) const
[[nodiscard]] std::vector<float> readFloatVector(const std::string& key) const
[[nodiscard]] std::vector<std::string> readStringVector(const std::string& key) const
[[nodiscard]] std::unordered_map<std::string, std::string> readStringMap( const std::string& key) const
template <typename T> [[nodiscard]] T read(const std::string& key, const T& def = T{}) const
[[nodiscard]] JsonReader subReader(const std::string& key) const
[[nodiscard]] const JsonValue& value() const noexcept
class ISerializable 3
virtual ~ISerializable() = default
virtual void serialize(JsonWriter& writer) const = 0
virtual void deserialize(JsonReader& reader) = 0
class SerializationRegistry 7
using FactoryFunc = std::function<std::unique_ptr<ISerializable>()>;
[[nodiscard]] static SerializationRegistry& instance()
template <typename T> void registerType(const std::string& name)
void registerFactory(const std::string& name, FactoryFunc factory)
[[nodiscard]] std::unique_ptr<ISerializable> createFromJson( const std::string& name, const JsonValue& json) const
[[nodiscard]] bool isRegistered(const std::string& name) const
void clear()
class ServiceRegistry 12
ServiceRegistry() = default
ServiceRegistry(const ServiceRegistry&) = delete
ServiceRegistry& operator=(const ServiceRegistry&) = delete
ServiceRegistry(ServiceRegistry&&) = delete
ServiceRegistry& operator=(ServiceRegistry&&) = delete
template <typename T> void registerService(std::shared_ptr<T> service)
template <typename T> [[nodiscard]] T* get() const
template <typename T> [[nodiscard]] bool has() const
template <typename T> bool unregister()
void clear()
[[nodiscard]] std::size_t size() const
[[nodiscard]] bool empty() const
class Signal 132
using Slot = std::function<void(Args...)>;
using SlotId = uint32_t;
SlotId connect(Slot slot)
void disconnect(SlotId id)
void disconnectAll()
void emit(Args... args) const
[[nodiscard]] int connectionCount() const noexcept
MITIRU_INLINE mitiru::Engine::~Engine()
MITIRU_INLINE CefContext* mitiru::Engine::cefContext() noexcept
MITIRU_INLINE void mitiru::Engine::setWorld(ecs::MitiruWorld* world) noexcept
MITIRU_INLINE void mitiru::Engine::setSceneManager(scene::MitiruSceneManager* mgr) noexcept
MITIRU_INLINE mitiru::audio::IAudioEngine* mitiru::Engine::audioEngine() noexcept
MITIRU_INLINE float mitiru::Engine::masterVolume() const noexcept
MITIRU_INLINE float mitiru::Engine::bgmVolume() const noexcept
MITIRU_INLINE float mitiru::Engine::seVolume() const noexcept
MITIRU_INLINE float mitiru::Engine::voiceVolume() const noexcept
MITIRU_INLINE const mitiru::EngineConfig& mitiru::Engine::config() const noexcept
MITIRU_INLINE mitiru::EngineConfig& mitiru::Engine::mutableConfig() noexcept
MITIRU_INLINE void mitiru::Engine::setTemporalChecker(validate::TemporalInvariantChecker* checker) noexcept
MITIRU_INLINE void mitiru::Engine::setDiffTracker(observe::StructuredDiff* tracker) noexcept
MITIRU_INLINE void mitiru::Engine::setCausalChain(observe::CausalChain* chain) noexcept
MITIRU_INLINE mitiru::render::PostProcessManager* mitiru::Engine::postProcess() noexcept
MITIRU_INLINE const mitiru::render::PostProcessManager* mitiru::Engine::postProcess() const noexcept
MITIRU_INLINE void mitiru::Engine::requestStop() noexcept
MITIRU_INLINE std::uint64_t mitiru::Engine::frameNumber() const noexcept
MITIRU_INLINE mitiru::InputInjector& mitiru::Engine::inputInjector() noexcept
MITIRU_INLINE const mitiru::InputState& mitiru::Engine::inputState() const noexcept
MITIRU_INLINE const mitiru::Screen* mitiru::Engine::screen() const noexcept
MITIRU_INLINE mitiru::Screen* mitiru::Engine::screen() noexcept
MITIRU_INLINE mitiru::server::EngineHttpServer* mitiru::Engine::httpServer() noexcept
MITIRU_INLINE void mitiru::Engine::setCommandSystem(CommandSystem* cmd) noexcept
MITIRU_INLINE const mitiru::Clock* mitiru::Engine::clock() const noexcept
MITIRU_INLINE void mitiru::Engine::setGameFlag(const std::string& key, const std::string& value)
MITIRU_INLINE std::string mitiru::Engine::getGameFlag(const std::string& key) const
MITIRU_INLINE float mitiru::Engine::clampVol(float v) noexcept
MITIRU_INLINE void mitiru::Engine::saveBmp(const std::string& path, const std::vector<std::uint8_t>& pixels, int w, int h)
MITIRU_INLINE void mitiru::Engine::savePng(const std::string& path, const std::vector<std::uint8_t>& pixels, int w, int h)
MITIRU_INLINE void mitiru::Engine::setAudioEngine(std::shared_ptr<audio::IAudioEngine> engine) noexcept
MITIRU_INLINE void mitiru::Engine::setMasterVolume(float v) noexcept
MITIRU_INLINE void mitiru::Engine::setBgmVolume(float v) noexcept
MITIRU_INLINE void mitiru::Engine::setSeVolume(float v) noexcept
MITIRU_INLINE void mitiru::Engine::setVoiceVolume(float v) noexcept
MITIRU_INLINE void mitiru::Engine::applyVolumes() noexcept
MITIRU_INLINE void mitiru::Engine::saveAutoTestScreenshot(const std::string& outputDir)
MITIRU_INLINE void mitiru::Engine::saveAutoTestReport( const std::string& outputDir, const EngineConfig& config)
MITIRU_INLINE void mitiru::Engine::initializeCef(const EngineConfig& config)
MITIRU_INLINE std::vector<std::uint8_t> mitiru::Engine::capture() const
MITIRU_INLINE void mitiru::Engine::tickOneFrame()
MITIRU_INLINE bool mitiru::Engine::tickInputPollPhase()
MITIRU_INLINE void mitiru::Engine::tickMouseScalingPhase()
MITIRU_INLINE void mitiru::Engine::tickFixedUpdatePhase()
MITIRU_INLINE void mitiru::Engine::tickRenderPhase()
MITIRU_INLINE void mitiru::Engine::tickPresentPhase()
MITIRU_INLINE void mitiru::Engine::tickCefComposite()
MITIRU_INLINE bool mitiru::Engine::tickAutoCaptureAndEndFrame()
MITIRU_INLINE void mitiru::Engine::tickHttpPollAndCap( const std::chrono::steady_clock::time_point& frameStart)
MITIRU_INLINE void mitiru::Engine::initHttpServer(int port, Game& game)
MITIRU_INLINE void mitiru::Engine::initFont(const std::string& userPath)
MITIRU_INLINE void mitiru::Engine::initSdfFont(std::vector<std::uint8_t> fontData)
MITIRU_INLINE void mitiru::Engine::applyInjectedInput()
MITIRU_INLINE void mitiru::Engine::initialize(const EngineConfig& config)
MITIRU_INLINE void mitiru::Engine::createRenderPipeline(int screenWidth, int screenHeight)
MITIRU_INLINE void mitiru::Engine::onWindowResize(int w, int h)
MITIRU_INLINE void mitiru::Engine::syncViewport()
MITIRU_INLINE void mitiru::Engine::create3DRenderer(int screenWidth, int screenHeight)
MITIRU_INLINE void mitiru::Engine::run(Game& game, const EngineConfig& configIn)
MITIRU_INLINE void mitiru::Engine::stepFrames( Game& game, std::uint64_t frameCount, const EngineConfig& config)
MITIRU_INLINE std::vector<std::uint8_t> mitiru::Engine::runAndCapture( Game& game, int frameCount, const EngineConfig& config)
MITIRU_INLINE bool mitiru::Engine::saveSettings() noexcept
MITIRU_INLINE void mitiru::Engine::persistIfEnabled() noexcept
MITIRU_INLINE std::string mitiru::Engine::snapshot() const
MITIRU_INLINE void mitiru::Engine::setFullscreen(bool enable) noexcept
MITIRU_INLINE bool mitiru::Engine::isFullscreen() const noexcept
inline void mitiru::Screen::drawGradientRectH(const sgc::Rectf& rect, const sgc::Colorf& leftColor, const sgc::Colorf& rightColor)
inline void mitiru::Screen::drawGradientRect4(const sgc::Rectf& rect, const sgc::Colorf& topLeft, const sgc::Colorf& topRight, const sgc::Colorf& bottomRight, const sgc::Colorf& bottomLeft)
inline void mitiru::Screen::drawRectRotated(const sgc::Rectf& rect, const sgc::Colorf& color, float angleDeg)
inline void mitiru::Screen::drawGradientRect(const sgc::Rectf& rect, const sgc::Colorf& topColor, const sgc::Colorf& bottomColor)
inline void mitiru::Screen::drawRectPattern(const sgc::Rectf& rect, PatternType pattern, float cellSize, const sgc::Colorf& color1, const sgc::Colorf& color2)
inline void mitiru::Screen::drawInnerShadow(const sgc::Rectf& rect, const sgc::Colorf& shadowColor, float blurSize, float offsetX, float offsetY)
inline void mitiru::Screen::drawFrostedRect(const sgc::Rectf& rect, const sgc::Colorf& tintColor, int layers)
inline void mitiru::Screen::drawRectPerspective(const sgc::Rectf& rect, const sgc::Colorf& color, bool vanishTop, float strength)
inline void mitiru::Screen::drawRectPerspectiveGradient(const sgc::Rectf& rect, const sgc::Colorf& topColor, const sgc::Colorf& bottomColor, bool vanishTop, float strength)
inline void mitiru::Screen::setPipeline(render::RenderPipeline2D* pipeline) noexcept
inline void mitiru::Screen::setValidator(validate::DrawCallValidator* validator) noexcept
inline void mitiru::Screen::clear(const sgc::Colorf& color)
inline void mitiru::Screen::renderUI(const ui::UINode& root, const ui::UITheme& theme)
inline void mitiru::Screen::resetDrawCallCount() noexcept
inline void mitiru::Screen::resize(int width, int height) noexcept
inline void mitiru::Screen::present()
inline void mitiru::Screen::pushClipRect(const sgc::Rectf& rect)
inline void mitiru::Screen::popClipRect()
inline void mitiru::Screen::setBlendMode(gfx::BlendMode mode)
inline void Screen::drawPixelGrid( const sgc::Rectf& dest, const std::uint32_t* pixels, int pixelWidth, int pixelHeight)
inline void Screen::drawPixelGrid( const sgc::Rectf& dest, const std::uint32_t* pixels, int pixelWidth, int pixelHeight, render::PixelArtFilter filter)
inline void mitiru::Screen::drawZigzagEdge(const sgc::Rectf& rect, const render::ZigzagStyle& zs)
inline void mitiru::Screen::drawScanlines(const sgc::Rectf& rect, float lineHeight, const sgc::Colorf& color)
inline void mitiru::Screen::drawDashedLine(const sgc::Vec2f& from, const sgc::Vec2f& to, float thickness, float dashLen, float gapLen, const sgc::Colorf& color)
inline void mitiru::Screen::drawRect(const sgc::Rectf& rect, const sgc::Colorf& color)
inline void mitiru::Screen::drawRectFrame(const sgc::Rectf& rect, const sgc::Colorf& color, float thickness)
inline void mitiru::Screen::drawRoundedRect(const sgc::Rectf& rect, const sgc::Colorf& color, float radius)
inline void mitiru::Screen::drawRoundedRectFrame(const sgc::Rectf& rect, const sgc::Colorf& color, float radius, float thickness)
inline void mitiru::Screen::drawPie(const sgc::Vec2f& center, float radius, float startAngle, float endAngle, const sgc::Colorf& color)
inline void mitiru::Screen::drawArc(const sgc::Vec2f& center, float radius, float startAngle, float endAngle, const sgc::Colorf& color, float thickness)
inline void mitiru::Screen::drawTriangle(const sgc::Vec2f& p0, const sgc::Vec2f& p1, const sgc::Vec2f& p2, const sgc::Colorf& color)
inline void mitiru::Screen::drawCircle(const sgc::Vec2f& center, float radius, const sgc::Colorf& color)
inline void mitiru::Screen::drawLine(const sgc::Vec2f& from, const sgc::Vec2f& to, const sgc::Colorf& color, float thickness)
inline void mitiru::Screen::drawPolygon(const std::vector<sgc::Vec2f>& points, const sgc::Colorf& color)
inline void mitiru::Screen::drawEllipse(const sgc::Vec2f& center, float radiusX, float radiusY, const sgc::Colorf& color)
inline void mitiru::Screen::drawRing(const sgc::Vec2f& center, float outerRadius, float innerRadius, const sgc::Colorf& color)
inline void mitiru::Screen::drawRoundedRect4(const sgc::Rectf& rect, const sgc::Colorf& color, float tl, float tr, float br, float bl)
inline void mitiru::Screen::drawCircleFrame(const sgc::Vec2f& center, float radius, const sgc::Colorf& color, float thickness)
inline void mitiru::Screen::drawSprite(const render::Texture& texture, const sgc::Rectf& dstRect)
inline void mitiru::Screen::drawSprite(const render::Texture& texture, const sgc::Rectf& dstRect, const sgc::Colorf& tintColor)
inline void mitiru::Screen::setTrueTypeFont(void* font, TtDrawFunc drawFn, TtMeasureFunc measureFn) noexcept
inline void mitiru::Screen::setSdfFont(void* font, SdfDrawFunc drawFn, SdfMeasureFunc measureFn) noexcept
inline void mitiru::Screen::clearSdfFont() noexcept
inline void mitiru::Screen::registerFont(const std::string& name, void* font, TtDrawFunc drawFn, TtMeasureFunc measureFn)
inline void mitiru::Screen::setFont(const std::string& name)
inline void mitiru::Screen::drawText(const sgc::Vec2f& position, std::string_view text, const sgc::Colorf& color, float fontSize)
inline void mitiru::Screen::drawTextClipped(const sgc::Rectf& rect, std::string_view text, const sgc::Colorf& color, float fontSize, float padX, float padY)
inline void mitiru::Screen::drawTextInRect(const sgc::Rectf& rect, std::string_view text, const sgc::Colorf& color, float fontSize, TextAlignH alignH, TextAlignV alignV, float padX, float padY)
inline void mitiru::Screen::drawTextWrapped(const sgc::Rectf& rect, std::string_view text, const sgc::Colorf& color, float fontSize, float padX, float padY, float lineSpacing)
inline void mitiru::Screen::drawTextHQ(const sgc::Vec2f& position, std::string_view text, const sgc::Colorf& color, float fontSize)
inline void mitiru::Screen::drawTextWithShadow(const sgc::Rectf& rect, std::string_view text, const sgc::Colorf& color, float fontSize, const sgc::Colorf& shadowColor, float shadowOffsetX, float shadowOffsetY, TextAlignH alignH, TextAlignV alignV)
inline void mitiru::Screen::drawTextOutlined(const sgc::Rectf& rect, std::string_view text, const sgc::Colorf& color, const sgc::Colorf& outlineColor, float outlineWidth, float fontSize, TextAlignH alignH, TextAlignV alignV)
inline void mitiru::Screen::drawTextStrikethrough(const sgc::Rectf& rect, std::string_view text, const sgc::Colorf& color, float fontSize, TextAlignH alignH, TextAlignV alignV)
inline void mitiru::Screen::drawTextBold(const sgc::Rectf& rect, std::string_view text, const sgc::Colorf& color, float fontSize, TextAlignH alignH, TextAlignV alignV)
inline void mitiru::Screen::drawTextSpaced(const sgc::Vec2f& position, std::string_view text, const sgc::Colorf& color, float fontSize, float letterSpacing)
inline void mitiru::Screen::pushTransform(float tx, float ty, float sx, float sy)
inline void mitiru::Screen::pushTransform(const Transform2D& t)
inline void mitiru::Screen::pushRotation(float rad, float pivotX, float pivotY)
inline void mitiru::Screen::popTransform()
class FrameBudget 15
enum `Category : std::uint8_t` { Render, Physics, Audio, Script, UI, Other, Count }
FrameBudget() noexcept
void beginFrame()
void beginCategory(Category cat)
void endCategory()
void endFrame()
[[nodiscard]] float totalFrameMs() const noexcept
[[nodiscard]] float categoryMs(Category cat) const noexcept
[[nodiscard]] float budgetUsagePercent() const noexcept
[[nodiscard]] bool isOverlayVisible() const noexcept
void toggleOverlay() noexcept
void setOverlayVisible(bool visible) noexcept
void drawOverlay(Screen& screen, float x, float y, float w, float h) const
[[nodiscard]] static constexpr std::string_view categoryName(Category cat) noexcept
[[nodiscard]] static constexpr sgc::Colorf categoryColor(Category cat) noexcept
class FrameBudgetScope 6
FrameBudgetScope(FrameBudget& budget, FrameBudget::Category cat) noexcept
~FrameBudgetScope()
FrameBudgetScope(const FrameBudgetScope&) = delete
FrameBudgetScope& operator=(const FrameBudgetScope&) = delete
FrameBudgetScope(FrameBudgetScope&&) = delete
FrameBudgetScope& operator=(FrameBudgetScope&&) = delete
struct LogEntry 5
LogLevel level = LogLevel::Info
std::string message
double timestamp = 0.0
std::string source
std::string category
class LogViewer 19
explicit LogViewer(std::size_t maxEntries = 1000)
void addEntry(const LogEntry& entry)
void addEntry(LogLevel level, std::string_view category, std::string_view message, double timestamp = 0.0)
void clear()
[[nodiscard]] std::size_t entryCount() const
void setMinLevel(LogLevel level) noexcept
void setCategoryFilter(std::string_view category)
void setTextFilter(std::string_view text)
void toggleVisible() noexcept
void setCollapsed(bool collapsed) noexcept
[[nodiscard]] bool isCollapsed() const noexcept
void setVisible(bool visible) noexcept
[[nodiscard]] bool isVisible() const noexcept
void setAutoScroll(bool autoScroll) noexcept
void scrollUp(int lines = 1)
void scrollDown(int lines = 1)
void setMaxEntries(std::size_t max)
[[nodiscard]] std::string copyToClipboard() const
void drawOverlay(Screen& screen) const
struct FrameBreakdown 8
float totalMs = 0.0f
float renderMs = 0.0f
float physicsMs = 0.0f
float audioMs = 0.0f
float inputMs = 0.0f
float uiMs = 0.0f
float otherMs = 0.0f
[[nodiscard]] std::string toJson() const
struct MemoryBreakdown 6
float totalMB = 0.0f
float texturesMB = 0.0f
float meshesMB = 0.0f
float audioMB = 0.0f
float uiMB = 0.0f
[[nodiscard]] std::string toJson() const
class ScopeTimer 6
explicit ScopeTimer(float& targetMs) noexcept
~ScopeTimer()
ScopeTimer(const ScopeTimer&) = delete
ScopeTimer& operator=(const ScopeTimer&) = delete
ScopeTimer(ScopeTimer&&) = delete
ScopeTimer& operator=(ScopeTimer&&) = delete
class ProfilerConnection 15
using HttpHandler = std::function<std::string()>;
explicit ProfilerConnection(std::size_t historySize = 120) noexcept
void connect(Engine& engine)
void registerHttpEndpoint(server::EngineHttpServer* httpServer)
void setAudioMixer(audio::AudioMixer* mixer) noexcept
void beginFrame()
void endFrame()
[[nodiscard]] FrameBreakdown& currentFrame() noexcept
[[nodiscard]] const FrameBreakdown& frameBreakdown() const noexcept
[[nodiscard]] MemoryBreakdown getMemoryBreakdown() const
void setEstimatedCounts(int textureCount, int meshCount, int audioChannels, int uiNodeCount) noexcept
[[nodiscard]] const ProfilerOverlay& overlay() const noexcept
[[nodiscard]] std::uint64_t frameCount() const noexcept
[[nodiscard]] std::string toApiJson() const
[[nodiscard]] HttpHandler getApiHandler() const
struct SectionTiming 8
std::string name
float durationMs = 0.0f
float minMs = 1e9f
float maxMs = 0.0f
float avgMs = 0.0f
float totalMs = 0.0f
std::uint32_t sampleCount = 0
int depth = 0
struct FrameData 2
float frameDurationMs = 0.0f
std::vector<SectionTiming> sections
class ProfilerGUI 16
enum `OverlayPosition : std::uint8_t` { TopLeft, TopRight, BottomLeft, BottomRight }
explicit ProfilerGUI(std::size_t historySize = 300)
void beginFrame()
void endFrame()
void beginSection(std::string_view name)
void endSection()
[[nodiscard]] FrameData getFrameData() const
void drawOverlay(Screen& screen) const
void drawDetailed(Screen& screen) const
void setVisible(bool visible) noexcept
[[nodiscard]] bool isVisible() const noexcept
void setOverlayPosition(OverlayPosition pos) noexcept
void setTransparency(float alpha) noexcept
void setTopNSections(int n) noexcept
void reset()
inline void mitiru::effects::ColorFlash::draw(Screen& screen) const
class ColorFlash 6
void flash(const sgc::Colorf& color, float duration = 0.2f)
void update(float dt)
void draw(Screen& screen) const
[[nodiscard]] bool isActive() const noexcept
[[nodiscard]] float progress() const noexcept
[[nodiscard]] float currentAlpha() const noexcept
enum FadeDirection 3
In
Out
inline void mitiru::effects::Fade::draw(Screen& screen) const
class Fade 9
void fadeIn(float duration = 1.0f, const sgc::Colorf& color = {0, 0, 0, 1})
void fadeOut(float duration = 1.0f, const sgc::Colorf& color = {0, 0, 0, 1})
void update(float dt)
void draw(Screen& screen) const
[[nodiscard]] bool isComplete() const noexcept
[[nodiscard]] bool isActive() const noexcept
[[nodiscard]] float progress() const noexcept
[[nodiscard]] FadeDirection direction() const noexcept
inline void mitiru::effects::Trail::draw( Screen& screen, const sgc::Colorf& color, float thickness) const
struct TrailPoint 2
sgc::Vec2f position
float age = 0
class Trail 9
int maxPoints = 50
float lifetime = 0.5f
void addPoint(const sgc::Vec2f& pos)
void update(float dt)
void draw(Screen& screen, const sgc::Colorf& color, float thickness = 2.0f) const
[[nodiscard]] int pointCount() const noexcept
void clear()
[[nodiscard]] const std::vector<TrailPoint>& points() const noexcept
#pragma once #ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #ifndef NOMINMAX #define NOMINMAX #endif #include <Windows.h> #include <Xinput.h> #pragma comment(lib, "xinput.lib") #include <algorithm> #include <array> #include <cmath> #include <cstdint> namespace mitiru
enum InputCommandType : std::uint8_t 5
KeyDown
KeyUp
MouseMove
MouseDown
MouseUp
struct InputCommand 5
InputCommandType type = InputCommandType::KeyDown
int keyCode = 0
int mouseButton = 0
float mouseX = 0.0f
float mouseY = 0.0f
class InputInjector 4
void inject(const InputCommand& command)
[[nodiscard]] std::vector<InputCommand> consumePending()
[[nodiscard]] std::size_t pendingCount() const
void clear()
enum GamepadButtonId : std::uint16_t 14
DPadUp = 0x0001
DPadDown = 0x0002
DPadLeft = 0x0004
DPadRight = 0x0008
Start = 0x0010
Back = 0x0020
LS = 0x0040
RS = 0x0080
LB = 0x0100
RB = 0x0200
A = 0x1000
B = 0x2000
X = 0x4000
Y = 0x8000
enum BindingType : std::uint8_t 4
Key
MouseButton
GamepadButton
GamepadAxis
struct InputBinding 6
BindingType type = BindingType::Key
int code = 0
[[nodiscard]] static constexpr InputBinding fromKey(KeyCode key) noexcept
[[nodiscard]] static constexpr InputBinding fromMouseButton(int button) noexcept
[[nodiscard]] static constexpr InputBinding fromGamepadButton(GamepadButtonId button) noexcept
[[nodiscard]] static constexpr InputBinding fromGamepadAxis(int axisId) noexcept
struct InputStateProvider 7
std::function<bool(int keyCode)> isKeyDown
std::function<bool(int keyCode)> isKeyPressed
std::function<bool(int button)> isMouseButtonDown
std::function<bool(int button)> isMouseButtonPressed
std::function<bool(int buttonCode)> isGamepadButtonDown
std::function<bool(int buttonCode)> isGamepadButtonPressed
std::function<float(int axisId)> getGamepadAxis
class InputMapper 15
void setProvider(const InputStateProvider& provider)
void bindKey(std::string_view actionName, KeyCode key)
void bindMouseButton(std::string_view actionName, int button)
void bindGamepadButton(std::string_view actionName, GamepadButtonId button)
void bindGamepadAxis(std::string_view actionName, int axisId)
void triggerActionFromBridge(std::string_view actionName)
void endFrame() noexcept
void unbindAll(std::string_view actionName)
void clearAllBindings()
[[nodiscard]] bool isActionDown(std::string_view actionName) const
[[nodiscard]] bool isActionPressed(std::string_view actionName) const
[[nodiscard]] float getActionAxis(std::string_view actionName) const
[[nodiscard]] std::size_t bindingCount(std::string_view actionName) const
[[nodiscard]] std::size_t actionCount() const noexcept
[[nodiscard]] const std::vector<InputBinding>& getBindings( std::string_view actionName) const
struct InputFrame 3
std::uint64_t frameNumber = 0
std::vector<InputCommand> commands
[[nodiscard]] std::string toJson() const
struct ReplayData 6
std::uint64_t seed = 0
int tps = 60
std::vector<InputFrame> frames
[[nodiscard]] std::string toJson() const
[[nodiscard]] static ReplayData fromJson(const std::string& jsonStr)
[[nodiscard]] std::size_t totalFrames() const noexcept
class InputRecorder 5
void beginRecording(std::uint64_t seed = 0, int tps = 60)
void recordFrame(std::uint64_t frameNumber, const std::vector<InputCommand>& commands)
[[nodiscard]] ReplayData endRecording()
[[nodiscard]] bool isRecording() const noexcept
[[nodiscard]] std::size_t recordedFrameCount() const noexcept
class InputReplayer 9
void load(const ReplayData& data)
[[nodiscard]] std::vector<InputCommand> getCommandsForFrame(std::uint64_t frameNumber) const
[[nodiscard]] std::vector<InputCommand> consumeNextFrame()
[[nodiscard]] bool isFinished() const noexcept
void reset() noexcept
[[nodiscard]] std::size_t totalFrames() const noexcept
[[nodiscard]] std::size_t currentIndex() const noexcept
[[nodiscard]] std::uint64_t seed() const noexcept
[[nodiscard]] int tps() const noexcept
enum MouseButton : std::uint8_t 3
Left = 0
Right = 1
Middle = 2
class InputState 26
static inline float s_dbgLastSetX = 0
static inline float s_dbgLastSetY = 0
static inline int s_dbgSetCount = 0
InputState() noexcept
, m_mouseX(0.0f) , m_mouseY(0.0f) , m_prevMouseX(0.0f) , m_prevMouseY(0.0f) , m_mouseCaptured(false) , m_rawDeltaX(0.0f) , m_rawDeltaY(0.0f)
[[nodiscard]] bool isKeyDown(int keyCode) const noexcept
[[nodiscard]] bool isKeyDown(KeyCode keyCode) const noexcept
[[nodiscard]] std::pair<float, float> mousePosition() const noexcept
void beginFrame() noexcept
void endTick() noexcept
[[nodiscard]] std::pair<float, float> mouseDelta() const noexcept
void setCursorCaptured(bool captured) noexcept
[[nodiscard]] bool isCursorCaptured() const noexcept
void setRawMouseDelta(float dx, float dy) noexcept
[[nodiscard]] bool isKeyJustPressed(int keyCode) const noexcept
[[nodiscard]] bool isKeyJustPressed(KeyCode keyCode) const noexcept
[[nodiscard]] bool isKeyJustReleased(int keyCode) const noexcept
[[nodiscard]] bool isKeyJustReleased(KeyCode keyCode) const noexcept
[[nodiscard]] bool isMouseButtonJustPressed(MouseButton button) const noexcept
[[nodiscard]] bool isMouseButtonJustReleased(MouseButton button) const noexcept
[[nodiscard]] bool isMouseButtonDown(MouseButton button) const noexcept
void setKeyDown(int keyCode, bool down) noexcept
void setKeyDown(KeyCode keyCode, bool down) noexcept
void setMousePosition(float x, float y) noexcept
void setMouseButtonDown(MouseButton button, bool down) noexcept
using Key = KeyCode;
enum KeyCode : int 107
Unknown = 0
Num0 = 48
Num1 = 49
Num2 = 50
Num3 = 51
Num4 = 52
Num5 = 53
Num6 = 54
Num7 = 55
Num8 = 56
Num9 = 57
A = 65
B = 66
C = 67
D = 68
E = 69
F = 70
G = 71
H = 72
I = 73
J = 74
K = 75
L = 76
M = 77
N = 78
O = 79
P = 80
Q = 81
R = 82
S = 83
T = 84
U = 85
V = 86
W = 87
X = 88
Y = 89
Z = 90
Backspace = 8
Tab = 9
Enter = 13
Shift = 16
Ctrl = 17
Alt = 18
Escape = 27
Space = 32
LShift = 160
RShift = 161
LCtrl = 162
RCtrl = 163
LAlt = 164
RAlt = 165
Left = 37
Up = 38
Right = 39
Down = 40
ArrowLeft = Left
ArrowUp = Up
ArrowRight = Right
ArrowDown = Down
F1 = 112
F2 = 113
F3 = 114
F4 = 115
F5 = 116
F6 = 117
F7 = 118
F8 = 119
F9 = 120
F10 = 121
F11 = 122
F12 = 123
Delete = 46
Insert = 45
Home = 36
End = 35
PageUp = 33
PageDown = 34
CapsLock = 20
Semicolon = 186
Equal = 187
Comma = 188
Minus = 189
Period = 190
Slash = 191
Backquote = 192
LeftBracket = 219
Backslash = 220
RightBracket = 221
Quote = 222
Numpad0 = 96
Numpad1 = 97
Numpad2 = 98
Numpad3 = 99
Numpad4 = 100
Numpad5 = 101
Numpad6 = 102
Numpad7 = 103
Numpad8 = 104
Numpad9 = 105
NumpadMultiply = 106
NumpadAdd = 107
NumpadSubtract = 109
NumpadDecimal = 110
NumpadDivide = 111
NumpadEnter = Enter
[[nodiscard]] inline std::string_view keyCodeToString(KeyCode code) noexcept
[[nodiscard]] inline KeyCode stringToKeyCode(std::string_view name) noexcept
enum TouchPhase : std::uint8_t 4
Began = 0
Moved = 1
Ended = 2
Cancelled = 3
enum SwipeDirection : std::uint8_t 4
Up = 0
Down = 1
Left = 2
Right = 3
struct TouchPoint 5
int id = 0
float x = 0.0f
float y = 0.0f
float pressure = 1.0f
TouchPhase phase = TouchPhase::Began
struct GestureConfig 7
float tapMaxDuration = 0.3f
float doubleTapInterval = 0.3f
float swipeMinDistance = 50.0f
float longPressDuration = 0.5f
float pinchMinDistance = 10.0f
float rotateMinAngle = 0.1f
[[nodiscard]] static GestureConfig defaults() noexcept
struct PinchInfo 3
float scale = 1.0f
float centerX = 0.0f
float centerY = 0.0f
struct RotateInfo 3
float angle = 0.0f
float centerX = 0.0f
float centerY = 0.0f
class TouchInputManager 19
explicit TouchInputManager( const GestureConfig& config = GestureConfig::defaults()) noexcept
void onTouchEvent(const TouchPoint& point)
void update(float deltaTime)
[[nodiscard]] const std::vector<TouchPoint>& activeTouches() const noexcept
[[nodiscard]] std::size_t touchCount() const noexcept
void onTap(std::function<void(float, float)> callback)
void onDoubleTap(std::function<void(float, float)> callback)
void onLongPress(std::function<void(float, float)> callback, float duration = 0.0f)
void onSwipe(std::function<void(SwipeDirection, float, float)> callback, SwipeDirection direction = SwipeDirection::Up)
void onPinch(std::function<void(const PinchInfo&)> callback)
void onRotate(std::function<void(const RotateInfo&)> callback)
void applyToMouseState(InputState& state) const
[[nodiscard]] const GestureConfig& config() const noexcept
void setConfig(const GestureConfig& config) noexcept
TouchInputManager(const TouchInputManager&) = delete
TouchInputManager& operator=(const TouchInputManager&) = delete
TouchInputManager(TouchInputManager&&) noexcept = default
TouchInputManager& operator=(TouchInputManager&&) noexcept = default
~TouchInputManager() = default
enum MouseWheelAxis : std::uint8_t 2
Vertical = 0
Horizontal = 1
class Win32Input 16
Win32Input() noexcept
bool processMessage(UINT msg, WPARAM wParam, LPARAM lParam) noexcept
void update() noexcept
[[nodiscard]] bool isKeyDown(KeyCode code) const noexcept
[[nodiscard]] bool isKeyPressed(KeyCode code) const noexcept
[[nodiscard]] bool isKeyReleased(KeyCode code) const noexcept
[[nodiscard]] bool isKeyDownRaw(int vk) const noexcept
[[nodiscard]] std::pair<int, int> getMousePosition() const noexcept
[[nodiscard]] int mouseX() const noexcept
[[nodiscard]] int mouseY() const noexcept
[[nodiscard]] bool isMouseButtonDown(MouseButton button) const noexcept
[[nodiscard]] bool isMouseButtonPressed(MouseButton button) const noexcept
[[nodiscard]] bool isMouseButtonReleased(MouseButton button) const noexcept
[[nodiscard]] int getMouseWheel() const noexcept
[[nodiscard]] int getMouseHWheel() const noexcept
void fillInputState(InputState& state) const noexcept
struct ObserveServerConfig 5
std::uint16_t port = 8080
std::string host = "127.0.0.1"
bool enableCors = true
bool enableScreenshot = true
int maxSnapshotRateMs = 0
class ObserveServer 12
ObserveServer() = default
explicit ObserveServer(const ObserveServerConfig& config)
~ObserveServer()
ObserveServer(const ObserveServer&) = delete
ObserveServer& operator=(const ObserveServer&) = delete
ObserveServer(ObserveServer&&) = delete
ObserveServer& operator=(ObserveServer&&) = delete
bool start(std::uint16_t port, Engine& engine, Inspector& inspector)
bool start(Engine& engine, Inspector& inspector)
void stop() noexcept
[[nodiscard]] bool isRunning() const noexcept
[[nodiscard]] const ObserveServerConfig& config() const noexcept
struct SnapshotData 7
std::uint64_t frameNumber = 0
float timestamp = 0.0f
int entityCount = 0
std::string worldSnapshot
std::string sceneInfo
int drawCallCount = 0
[[nodiscard]] std::string toJson() const
enum PlatformType 7
Headless
Windows
Linux
MacOS
iOS
Android
Emscripten
class IPlatform 3
virtual ~IPlatform() = default
[[nodiscard]] virtual std::unique_ptr<IWindow> createWindow( std::string_view title, int width, int height) = 0
[[nodiscard]] virtual PlatformType type() const noexcept = 0
class IWindow 9
virtual ~IWindow() = default
[[nodiscard]] virtual bool shouldClose() const = 0
virtual void pollEvents() = 0
[[nodiscard]] virtual int width() const = 0
[[nodiscard]] virtual int height() const = 0
virtual void setTitle(std::string_view title) = 0
virtual void requestClose() = 0
virtual void setInputState(InputState* )
virtual void setResizeCallback(std::function<void(int, int)> )
enum OsType : std::uint8_t 5
Unknown = 0
Windows
Linux
MacOS
Emscripten
enum CpuArch : std::uint8_t 6
Unknown = 0
X86
X64
Arm32
Arm64
Wasm
struct AvailableBackends 8
bool dx11 = false
bool dx12 = false
bool vulkan = false
bool opengl = false
bool webgl = false
bool null = true
[[nodiscard]] std::vector<std::string> list() const
[[nodiscard]] int count() const noexcept
struct AvailableWindowBackends 4
bool win32 = false
bool sdl2 = false
bool glfw = false
[[nodiscard]] std::vector<std::string> list() const
struct PlatformInfo 7
OsType os = OsType::Unknown
CpuArch arch = CpuArch::Unknown
AvailableBackends backends
AvailableWindowBackends windowBackends
[[nodiscard]] std::string osName() const
[[nodiscard]] std::string archName() const
[[nodiscard]] static PlatformInfo detect() noexcept
enum WindowBackend 5
Auto
Win32
Sdl2
Glfw
[[nodiscard]] inline std::unique_ptr<IWindow> createWindow( WindowBackend backend, std::string_view title, int width, int height)
class EmscriptenPlatform : public IPlatform 2
[[nodiscard]] std::unique_ptr<IWindow> createWindow( std::string_view title, int width, int height) override
[[nodiscard]] PlatformType type() const noexcept override
class EmscriptenWindow : public IWindow 10
explicit EmscriptenWindow( std::string_view canvasSelector, int width, int height)
[[nodiscard]] bool shouldClose() const override
void pollEvents() override
[[nodiscard]] int width() const override
[[nodiscard]] int height() const override
void setTitle(std::string_view title) override
void requestClose() override
[[nodiscard]] const std::string& canvasSelector() const noexcept
void setInputState(InputState* input) noexcept override
[[nodiscard]] float consumeWheelDelta() noexcept
struct GlfwInputConfig 8
bool enableKeyboard = true
bool enableMouse = true
bool enableJoystick = true
bool rawMouseMotion = false
bool stickyKeys = false
float mouseSensitivity = 1.0f
[[nodiscard]] static GlfwInputConfig defaults() noexcept
[[nodiscard]] static GlfwInputConfig fps() noexcept
struct GlfwJoystickState 5
bool connected = false
int joystickId = -1
void beginFrame() noexcept
[[nodiscard]] bool isButtonJustPressed(int index) const noexcept
[[nodiscard]] bool isButtonJustReleased(int index) const noexcept
struct GlfwScrollState 3
double xOffset = 0.0
double yOffset = 0.0
void reset() noexcept
class GlfwInput 12
explicit GlfwInput(GLFWwindow* window, const GlfwInputConfig& config = GlfwInputConfig::defaults())
~GlfwInput()
GlfwInput(const GlfwInput&) = delete
GlfwInput& operator=(const GlfwInput&) = delete
GlfwInput(GlfwInput&&) = delete
GlfwInput& operator=(GlfwInput&&) = delete
void beginFrame() noexcept
void pollJoysticks()
[[nodiscard]] const InputState& state() const noexcept
[[nodiscard]] const GlfwJoystickState& joystick() const noexcept
[[nodiscard]] const GlfwScrollState& scroll() const noexcept
[[nodiscard]] const GlfwInputConfig& config() const noexcept
struct GlfwVulkanSurfaceDesc 2
bool requirePresentation = true
[[nodiscard]] static std::vector<std::string> defaultRequiredExtensions()
struct SurfaceCreateResult 4
bool success = false
std::string errorMessage
[[nodiscard]] static SurfaceCreateResult ok() noexcept
[[nodiscard]] static SurfaceCreateResult fail(const std::string& message)
class GlfwVulkanSurface 2
[[nodiscard]] static std::vector<std::string> getRequiredExtensions()
[[nodiscard]] static SurfaceCreateResult createSurface( VkInstance instance, GLFWwindow* window, VkSurfaceKHR* outSurface)
enum GlfwGraphicsMode : std::uint8_t 2
Vulkan
OpenGL
class GlfwWindow : public IWindow 19
explicit GlfwWindow(std::string_view title, int width, int height, GlfwGraphicsMode mode = GlfwGraphicsMode::Vulkan)
~GlfwWindow() override
GlfwWindow(const GlfwWindow&) = delete
GlfwWindow& operator=(const GlfwWindow&) = delete
GlfwWindow(GlfwWindow&&) = delete
GlfwWindow& operator=(GlfwWindow&&) = delete
[[nodiscard]] bool shouldClose() const override
void pollEvents() override
[[nodiscard]] int width() const override
[[nodiscard]] int height() const override
void setTitle(std::string_view title) override
void requestClose() override
void swapBuffers()
[[nodiscard]] GlfwGraphicsMode graphicsMode() const noexcept
void setInputState(InputState* state) override
[[nodiscard]] GLFWwindow* nativeWindow() const noexcept
void resize(int width, int height)
void setFullscreen(bool fullscreen)
[[nodiscard]] bool isFullscreen() const noexcept
class HeadlessWindow : public IWindow 7
explicit HeadlessWindow(std::string_view title, int width, int height)
[[nodiscard]] bool shouldClose() const override
void pollEvents() override
[[nodiscard]] int width() const override
[[nodiscard]] int height() const override
void setTitle(std::string_view title) override
void requestClose() override
class HeadlessPlatform : public IPlatform 2
[[nodiscard]] std::unique_ptr<IWindow> createWindow( std::string_view title, int width, int height) override
[[nodiscard]] PlatformType type() const noexcept override
enum AudioSampleFormat : std::uint8_t 2
Int16 = 0
Float32
struct AudioDeviceConfig 9
std::uint32_t sampleRate = 44100
std::uint8_t channels = 2
AudioSampleFormat format = AudioSampleFormat::Float32
std::uint16_t bufferSize = 4096
std::string deviceName
[[nodiscard]] static AudioDeviceConfig defaults() noexcept
[[nodiscard]] static AudioDeviceConfig lowLatency() noexcept
[[nodiscard]] std::uint32_t bytesPerSample() const noexcept
[[nodiscard]] std::uint32_t bufferSizeBytes() const noexcept
struct ObtainedAudioFormat 5
std::uint32_t sampleRate = 0
std::uint8_t channels = 0
AudioSampleFormat format = AudioSampleFormat::Float32
std::uint16_t bufferSize = 0
[[nodiscard]] bool isValid() const noexcept
class Sdl2Audio 13
using AudioCallback = void(*)(void* userdata, std::uint8_t* stream, int len);
explicit Sdl2Audio( const AudioDeviceConfig& config, AudioCallback callback = nullptr, void* userdata = nullptr)
~Sdl2Audio()
Sdl2Audio(const Sdl2Audio&) = delete
Sdl2Audio& operator=(const Sdl2Audio&) = delete
Sdl2Audio(Sdl2Audio&&) = delete
Sdl2Audio& operator=(Sdl2Audio&&) = delete
void start() noexcept
void stop() noexcept
[[nodiscard]] bool isPlaying() const noexcept
[[nodiscard]] bool isOpen() const noexcept
[[nodiscard]] const ObtainedAudioFormat& obtainedFormat() const noexcept
[[nodiscard]] const AudioDeviceConfig& config() const noexcept
struct Sdl2InputConfig 7
bool enableKeyboard = true
bool enableMouse = true
bool enableGamepad = true
int gamepadDeadzone = 8000
bool enableTextInput = false
float mouseSensitivity = 1.0f
[[nodiscard]] static Sdl2InputConfig defaults() noexcept
struct GamepadState 4
bool connected = false
void beginFrame() noexcept
[[nodiscard]] bool isButtonJustPressed(int index) const noexcept
[[nodiscard]] bool isButtonJustReleased(int index) const noexcept
struct MouseWheelState 3
float scrollX = 0.0f
float scrollY = 0.0f
void reset() noexcept
class Sdl2Input 12
explicit Sdl2Input(const Sdl2InputConfig& config = Sdl2InputConfig::defaults())
~Sdl2Input()
Sdl2Input(const Sdl2Input&) = delete
Sdl2Input& operator=(const Sdl2Input&) = delete
Sdl2Input(Sdl2Input&&) = delete
Sdl2Input& operator=(Sdl2Input&&) = delete
void beginFrame() noexcept
void processEvent(const SDL_Event& event)
[[nodiscard]] const InputState& state() const noexcept
[[nodiscard]] const GamepadState& gamepad() const noexcept
[[nodiscard]] const MouseWheelState& wheel() const noexcept
[[nodiscard]] const Sdl2InputConfig& config() const noexcept
class Sdl2Window : public IWindow 18
explicit Sdl2Window(std::string_view title, int width, int height, Uint32 flags = SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE)
~Sdl2Window() override
Sdl2Window(const Sdl2Window&) = delete
Sdl2Window& operator=(const Sdl2Window&) = delete
Sdl2Window(Sdl2Window&&) = delete
Sdl2Window& operator=(Sdl2Window&&) = delete
[[nodiscard]] bool shouldClose() const override
void setInputState(InputState* inputState) noexcept override
void pollEvents() override
[[nodiscard]] int width() const override
[[nodiscard]] int height() const override
void setTitle(std::string_view title) override
void requestClose() override
void resize(int width, int height)
void setFullscreen(bool fullscreen, bool borderless = true)
[[nodiscard]] bool isFullscreen() const noexcept
[[nodiscard]] SDL_Window* nativeWindow() const noexcept
[[nodiscard]] void* platformHandle() const
class Win32Platform : public IPlatform 3
[[nodiscard]] std::unique_ptr<IWindow> createWindow( std::string_view title, int width, int height) override
[[nodiscard]] std::unique_ptr<IWindow> createWindowWithMode( std::string_view title, int width, int height, DisplayMode mode)
[[nodiscard]] PlatformType type() const noexcept override
class Win32Window : public IWindow 28
using ResizeCallback = std::function<void(int, int)>;
float m_lastMouseX = -1
float m_lastMouseY = -1
float m_dbgReadbackX = -1
float m_dbgReadbackY = -1
int m_mouseMoveCount = 0
explicit Win32Window(std::string_view title, int width, int height, DisplayMode displayMode = DisplayMode::Windowed)
~Win32Window() override
Win32Window(const Win32Window&) = delete
Win32Window& operator=(const Win32Window&) = delete
Win32Window(Win32Window&&) = delete
Win32Window& operator=(Win32Window&&) = delete
[[nodiscard]] bool shouldClose() const override
void pollEvents() override
[[nodiscard]] int width() const override
[[nodiscard]] int height() const override
void setTitle(std::string_view title) override
void requestClose() override
void setFullscreen(bool enable)
[[nodiscard]] bool isFullscreen() const noexcept
void show()
void hide()
[[nodiscard]] HWND getHandle() const noexcept
void setInputState(InputState* state) noexcept override
[[nodiscard]] const InputState* getInputStatePtr() const noexcept
void setResizeCallback(std::function<void(int, int)> cb) noexcept override
[[nodiscard]] static UINT systemDpi() noexcept
inline void mitiru::render::AaRenderer::plotAA( Screen& screen, int x, int y, const sgc::Colorf& color, float alpha)
class AaRenderer 5
void drawLineAA(Screen& screen, const sgc::Vec2f& from, const sgc::Vec2f& to, const sgc::Colorf& color, float thickness = 1.0f) const
void drawCircleAA(Screen& screen, const sgc::Vec2f& center, float radius, const sgc::Colorf& fillColor, float borderWidth = 0.0f, const sgc::Colorf& borderColor = sgc::Colorf{0.0f, 0.0f, 0.0f, 1.0f}) const
void drawRoundedRectAA(Screen& screen, const sgc::Rectf& rect, float cornerRadius, const sgc::Colorf& fillColor) const
void drawRoundedRectAA(Screen& screen, const sgc::Rectf& rect, float cornerRadius, const sgc::Colorf& fillColor, float borderWidth, const sgc::Colorf& borderColor) const
void drawTriangleAA(Screen& screen, const sgc::Vec2f& p0, const sgc::Vec2f& p1, const sgc::Vec2f& p2, const sgc::Colorf& color) const
class FontRenderer 13
FontRenderer() noexcept = default
[[nodiscard]] sgc::Vec2f measureText(std::string_view text, float scale) const noexcept
template <typename ScreenType> void drawTextWrapped(ScreenType& screen, std::string_view text, float x, float y, float maxWidth, float scale, const sgc::Colorf& color) const
template <typename ScreenType> void drawTextCentered(ScreenType& screen, std::string_view text, float cx, float cy, float scale, const sgc::Colorf& color) const
template <typename ScreenType> void drawText(ScreenType& screen, std::string_view text, float x, float y, float scale, const sgc::Colorf& color) const
[[nodiscard]] int countWrappedLines(std::string_view text, float maxWidth, float scale) const noexcept
[[nodiscard]] sgc::Vec2f measureTextWrapped(std::string_view text, float maxWidth, float scale) const noexcept
inline void mitiru::render::GradientRenderer::drawLinearGradient( Screen& screen, const sgc::Rectf& rect, const LinearGradient& gradient) const
inline void mitiru::render::GradientRenderer::drawRadialGradient( Screen& screen, const sgc::Rectf& rect, const RadialGradient& gradient) const
inline void mitiru::render::GradientRenderer::drawConicGradient( Screen& screen, const sgc::Rectf& rect, const ConicGradient& gradient) const
inline void mitiru::render::GradientRenderer::drawLinearGradient( Screen& screen, const sgc::Rectf& rect, float angleDegrees, const std::vector<GradientStop>& stops) const
inline void mitiru::render::GradientRenderer::drawRadialGradient( Screen& screen, const sgc::Rectf& rect, float centerX, float centerY, float radius, const std::vector<GradientStop>& stops) const
inline void mitiru::render::GradientRenderer::drawConicGradient( Screen& screen, const sgc::Rectf& rect, float centerX, float centerY, float startAngleDegrees, const std::vector<GradientStop>& stops) const
struct GradientStop 3
float position = 0.0f
constexpr GradientStop() noexcept = default
constexpr GradientStop(float position, const sgc::Colorf& color) noexcept
struct LinearGradient 2
float angleDegrees = 0.0f
std::vector<GradientStop> stops
struct RadialGradient 4
float centerX = 0.5f
float centerY = 0.5f
float radius = 0.5f
std::vector<GradientStop> stops
struct ConicGradient 4
float centerX = 0.5f
float centerY = 0.5f
float startAngleDegrees = 0.0f
std::vector<GradientStop> stops
class GradientRenderer 6
void drawLinearGradient(Screen& screen, const sgc::Rectf& rect, const LinearGradient& gradient) const
void drawRadialGradient(Screen& screen, const sgc::Rectf& rect, const RadialGradient& gradient) const
void drawConicGradient(Screen& screen, const sgc::Rectf& rect, const ConicGradient& gradient) const
void drawLinearGradient(Screen& screen, const sgc::Rectf& rect, float angleDegrees, const std::vector<GradientStop>& stops) const
void drawRadialGradient(Screen& screen, const sgc::Rectf& rect, float centerX, float centerY, float radius, const std::vector<GradientStop>& stops) const
void drawConicGradient(Screen& screen, const sgc::Rectf& rect, float centerX, float centerY, float startAngleDegrees, const std::vector<GradientStop>& stops) const
class TextRenderer 6
template <typename ScreenType> static void drawText(ScreenType& screen, std::string_view text, float x, float y, int scale, const sgc::Colorf& color)
template <typename ScreenType> static void drawTextFloat(ScreenType& screen, std::string_view text, float x, float y, float scale, const sgc::Colorf& color, float letterSpacing = 0.0f)
[[nodiscard]] static constexpr float measureWidthFloat(std::string_view text, float scale, float letterSpacing = 0.0f) noexcept
[[nodiscard]] static constexpr float measureHeightFloat(float scale) noexcept
[[nodiscard]] static constexpr int measureWidth(std::string_view text, int scale = 1) noexcept
[[nodiscard]] static constexpr int measureHeight(int scale = 1) noexcept
enum FilterMode 4
Nearest
Bilinear
Bicubic
inline void mitiru::render::TextureFilter::drawSpriteFiltered( Screen& screen, const Texture& texture, const sgc::Rectf& destRect, FilterMode mode, float alpha)
struct TextureFilter 17
[[nodiscard]] static sgc::Colorf sampleNearest( const Texture& texture, float u, float v) noexcept
[[nodiscard]] static sgc::Colorf sampleBilinear( const Texture& texture, float u, float v) noexcept
[[nodiscard]] static sgc::Colorf sampleBicubic( const Texture& texture, float u, float v) noexcept
[[nodiscard]] static sgc::Colorf sample( const Texture& texture, float u, float v, FilterMode mode) noexcept
static void drawSpriteFiltered(Screen& screen, const Texture& texture, const sgc::Rectf& destRect, FilterMode mode = FilterMode::Bilinear, float alpha = 1.0f)
[[nodiscard]] inline constexpr float smoothstep(float edge0, float edge1, float x) noexcept
[[nodiscard]] inline float roundedRect(float px, float py, float halfW, float halfH, float radius) noexcept
[[nodiscard]] inline float circle(float px, float py, float radius) noexcept
[[nodiscard]] inline sgc::Colorf alphaBlend(const sgc::Colorf& dst, const sgc::Colorf& src) noexcept
inline void mitiru::render::UiShapeRenderer::writePixel( Screen& screen, int x, int y, const sgc::Colorf& color)
inline void mitiru::render::UiShapeRenderer::drawRoundedRect( Screen& screen, const RoundedRectParams& params) const
inline void mitiru::render::UiShapeRenderer::drawCircle( Screen& screen, float cx, float cy, float radius, const sgc::Colorf& fillColor, float borderWidth, const sgc::Colorf& borderColor) const
inline void mitiru::render::UiShapeRenderer::drawPill( Screen& screen, float x, float y, float w, float h, const sgc::Colorf& fillColor) const
inline void mitiru::render::UiShapeRenderer::drawRoundedRectShadow( Screen& screen, const sgc::Rectf& rect, float cornerRadius, const sgc::Colorf& shadowColor, float shadowBlur, float offsetX, float offsetY) const
inline void mitiru::render::UiShapeRenderer::drawProgressArc( Screen& screen, float cx, float cy, float radius, float thickness, float progress, const sgc::Colorf& color, const sgc::Colorf& bgColor) const
inline const mitiru::render::Texture& mitiru::render::UiShapeCache::getOrCreate( Screen& screen, const RoundedRectParams& params)
inline mitiru::render::Texture mitiru::render::UiShapeCache::renderToTexture( Screen& screen, const RoundedRectParams& params)
struct RoundedRectParams 13
float x = 0.0f
float y = 0.0f
float width = 100.0f
float height = 50.0f
float cornerRadius = 8.0f
float borderWidth = 0.0f
float shadowOffsetX = 0.0f
float shadowOffsetY = 0.0f
float shadowBlur = 0.0f
float glowRadius = 0.0f
float opacity = 1.0f
[[nodiscard]] std::size_t hash() const noexcept
[[nodiscard]] bool operator==(const RoundedRectParams& rhs) const noexcept = default
class UiShapeRenderer 5
void drawRoundedRect(Screen& screen, const RoundedRectParams& params) const
void drawCircle(Screen& screen, float cx, float cy, float radius, const sgc::Colorf& fillColor, float borderWidth = 0.0f, const sgc::Colorf& borderColor = {0.5f, 0.5f, 0.5f, 1.0f}) const
void drawPill(Screen& screen, float x, float y, float w, float h, const sgc::Colorf& fillColor) const
void drawRoundedRectShadow(Screen& screen, const sgc::Rectf& rect, float cornerRadius, const sgc::Colorf& shadowColor, float shadowBlur, float offsetX, float offsetY) const
void drawProgressArc(Screen& screen, float cx, float cy, float radius, float thickness, float progress, const sgc::Colorf& color, const sgc::Colorf& bgColor) const
class UiShapeCache 49
explicit UiShapeCache(std::size_t maxEntries = 64) noexcept
[[nodiscard]] const Texture& getOrCreate(Screen& screen, const RoundedRectParams& params)
void clear() noexcept
[[nodiscard]] std::size_t size() const noexcept
[[nodiscard]] std::size_t maxEntries() const noexcept
void setMaxEntries(std::size_t maxEntries) noexcept
void createCommandResources()
void compileShaders()
void createRootSignature()
static void getInputLayoutInternal(D3D12_INPUT_ELEMENT_DESC* desc, UINT& count)
void createMainPSO()
void createOutlinePSO()
void createDepthBuffer()
void createHDRIntermediate()
void createOutlinePostProcess()
void createColorCopyBuffer()
void createFresnelMainPSO()
void createOverlay2D()
void drawPostProcessOutline()
void pollD3D12Validation()
void resolveMSAAColorToHDR()
void createTonemapPipeline()
void applyTonemap()
[[nodiscard]] D3D12_GPU_VIRTUAL_ADDRESS uploadTonemapCB()
void createFXAAPipelines()
void createFXAAIntermediate()
void drawFXAAPass()
void renderOverlay2D()
[[nodiscard]] D3D12_GPU_VIRTUAL_ADDRESS uploadTransformCB( const sgc::Mat4f& worldTransform)
[[nodiscard]] D3D12_GPU_VIRTUAL_ADDRESS uploadLightingCB( const Material& material)
void createShadowPSO()
void renderShadowPass()
void createAlbedoSrvHeap()
void ensureDefaultWhiteTexture()
[[nodiscard]] dx12::Dx12Texture2D* getOrUploadAlbedo(const Texture* tex)
[[nodiscard]] D3D12_GPU_DESCRIPTOR_HANDLE writeMainSrvTable(const Texture* tex)
[[nodiscard]] D3D12_GPU_DESCRIPTOR_HANDLE writeAlbedoSrv(const Texture* tex)
[[nodiscard]] D3D12_GPU_VIRTUAL_ADDRESS uploadShadowCB()
[[nodiscard]] D3D12_GPU_VIRTUAL_ADDRESS uploadLightArrayCB()
void drawOutlineMesh(const OutlineDrawCommand& cmd)
[[nodiscard]] ComPtr<ID3D12Resource> createUploadBuffer(UINT64 sizeBytes) const
static void uploadToBuffer(ID3D12Resource* resource, const void* data, UINT sizeBytes)
void ensureSkyboxTextureDx12()
void ensureSkyboxPipelineDx12()
void uploadSkyboxTextureDx12()
void drawSkyboxIfNeededDx12()
using NodePtr = std::shared_ptr<Node>;
inline void mitiru::scene::SpriteNode::onDraw(Screen& screen) const
inline void mitiru::scene::LabelNode::onDraw(Screen& screen) const
class Node 21
float rotation = 0.0f
bool m_active = true
bool m_visible = true
Node() = default
explicit Node(const std::string& name)
virtual ~Node() = default
virtual void onReady()
virtual void onUpdate(float dt)
virtual void onDraw(Screen& screen) const
virtual void onExit()
void addChild(NodePtr child)
void removeChild(const std::string& name)
[[nodiscard]] NodePtr findChild(const std::string& name) const
[[nodiscard]] NodePtr findDescendant(const std::string& name) const
void updateTree(float dt)
void drawTree(Screen& screen) const
[[nodiscard]] const std::string& name() const noexcept
void setName(const std::string& n)
[[nodiscard]] Node* parent() const noexcept
[[nodiscard]] const std::vector<NodePtr>& children() const noexcept
[[nodiscard]] int childCount() const noexcept
class SpriteNode : public Node 3
float width = 32
float height = 32
void onDraw(Screen& screen) const override
class LabelNode : public Node 3
std::string text
float fontSize = 16.0f
void onDraw(Screen& screen) const override
class TimerNode : public Node 9
float duration = 1.0f
bool oneShot = true
std::function<void()> onTimeout
void start()
void stop()
[[nodiscard]] bool isRunning() const noexcept
[[nodiscard]] float elapsed() const noexcept
void onUpdate(float dt) override
inline void initEngineHttpCallbacks(EngineCallbacks& cb, const EngineBridgeContext& ctx, Game& game)
struct EngineBridgeContext 8
std::map<std::string, std::string>* gameFlags = nullptr
const EngineConfig* config = nullptr
std::function<std::uint64_t()> getFrameNumber
std::function<const Clock*()> getClock
std::function<const Screen*()> getScreen
std::function<std::vector<std::uint8_t>()> capture
std::function<std::string()> getSnapshot
std::function<void()> requestStop
struct EngineCallbacks 22
std::function<std::uint64_t()> getFrameNumber
std::function<const Clock*()> getClock
std::function<const Screen*()> getScreen
std::function<std::vector<std::uint8_t>()> capture
std::function<std::string()> getSnapshot
std::function<void()> requestStop
std::function<std::string()> getSceneJson
std::function<int(const std::string&, const std::string&, int)> createNode
std::function<bool(int)> deleteNode
std::function<bool(int, const std::string&, const std::string&)> updateNodeProperty
std::function<bool(int, const std::string&, const std::string&)> addTrait
std::function<bool(int, const std::string&)> removeTrait
std::function<bool(const std::string&)> saveScene
std::function<bool(const std::string&)> loadScene
std::function<bool(int)> selectNode
std::function<bool(int)> focusNode
std::function<std::string()> getErrors
std::function<std::string()> getLog
std::function<std::string()> getProjectInfo
std::function<bool()> runGame
std::function<bool()> stopGame
std::function<bool(float, float, float, float, float, float)> setEditorCamera
class EngineHttpServer 9
bool init(int)
void shutdown()
void poll()
[[nodiscard]] bool isRunning() const noexcept
void setCommandSystem(CommandSystem*)
void setCallbacks(const EngineCallbacks&)
void setInputInjector(InputInjector*)
void setFlags(std::map<std::string, std::string>*)
void setConfig(const EngineConfig*)
struct EngineCallbacks 22
std::function<std::uint64_t()> getFrameNumber
std::function<const Clock*()> getClock
std::function<const Screen*()> getScreen
std::function<std::vector<std::uint8_t>()> capture
std::function<std::string()> getSnapshot
std::function<void()> requestStop
std::function<std::string()> getSceneJson
std::function<int(const std::string& name, const std::string& type, int parentId)> createNode
std::function<bool(int nodeId)> deleteNode
std::function<bool(int nodeId, const std::string& prop, const std::string& value)> updateNodeProperty
std::function<bool(int nodeId, const std::string& traitType, const std::string& traitData)> addTrait
std::function<bool(int nodeId, const std::string& traitType)> removeTrait
std::function<bool(const std::string& path)> saveScene
std::function<bool(const std::string& path)> loadScene
std::function<bool(int nodeId)> selectNode
std::function<bool(int nodeId)> focusNode
std::function<std::string()> getErrors
std::function<std::string()> getLog
std::function<std::string()> getProjectInfo
std::function<bool()> runGame
std::function<bool()> stopGame
std::function<bool(float yaw, float pitch, float distance, float px, float py, float pz)> setEditorCamera
class EngineHttpServer 16
EngineHttpServer() = default
~EngineHttpServer()
EngineHttpServer(const EngineHttpServer&) = delete
EngineHttpServer& operator=(const EngineHttpServer&) = delete
EngineHttpServer(EngineHttpServer&&) = delete
EngineHttpServer& operator=(EngineHttpServer&&) = delete
bool init(int port = 8090)
void setCallbacks(const EngineCallbacks& callbacks)
void setCommandSystem(CommandSystem* cmd) noexcept
void setInputInjector(InputInjector* injector) noexcept
void setFlags(std::map<std::string, std::string>* flags) noexcept
void setConfig(const EngineConfig* config) noexcept
void poll()
void shutdown() noexcept
[[nodiscard]] bool isRunning() const noexcept
[[nodiscard]] int port() const noexcept
enum IssueSeverity 2
Warning
Error
enum IssueType 6
OutOfBounds
PartialOverflow
ZeroSize
InvalidColor
TextOverflow
OverlappingDraw
struct DrawIssue 3
std::string message
int frameNumber = 0
std::string drawCallName
struct FrameStats 6
int totalDrawCalls = 0
int outOfBoundsCount = 0
int overflowCount = 0
int zeroSizeCount = 0
int invalidColorCount = 0
int textOverflowCount = 0
class DrawCallValidator 21
void attach(Screen& screen)
void setScreenBounds(int width, int height) noexcept
void setMargin(float pixels) noexcept
void setOverlapDetection(bool enabled) noexcept
void beginFrame() noexcept
void endFrame() noexcept
void onDrawCall(const sgc::Rectf& bounds, const char* callName)
void onColor(const sgc::Colorf& color, const char* callName, const sgc::Rectf& bounds)
void onTextDraw(const sgc::Vec2f& position, float textWidth, float textHeight, const char* callName)
void onTextOverflow(float availableWidth, float actualWidth, const char* callName, const sgc::Rectf& bounds)
[[nodiscard]] const std::vector<DrawIssue>& getIssues() const noexcept
[[nodiscard]] int getIssueCount() const noexcept
[[nodiscard]] bool hasErrors() const noexcept
[[nodiscard]] const FrameStats& stats() const noexcept
[[nodiscard]] int frameNumber() const noexcept
void suppress(IssueType type)
void unsuppress(IssueType type)
void clearSuppressions() noexcept
void drawDebugOverlay(Screen& screen) const
void printReport() const
[[nodiscard]] std::string report() const
struct TestResult 4
std::string name
bool passed = false
std::string message
[[nodiscard]] std::string toJson() const
struct GameTest 2
std::string name
std::function<bool(Engine&)> testFunc
class TestHarness 5
void addTest(GameTest test)
[[nodiscard]] std::vector<TestResult> runAll(Engine& engine) const
[[nodiscard]] std::string toJson(Engine& engine) const
[[nodiscard]] std::size_t size() const noexcept
void clear() noexcept

Sourced from docs/API_CATALOG.md, auto-generated by tools/generate_api_catalog.py.