Files
simian/docs/Scripting.md
T
nick d7add3964d
CI / build-and-test (push) Successful in 2m37s
Sync Docs to Gitea Wiki / Sync docs to Gitea wiki (push) Successful in 10s
feat: additonal components, updated docs
2026-03-09 17:37:29 +13:00

1.4 KiB

Scripting

This page is a starting point for scripting documentation.

Overview

  • Scripts live in scripts/ and are executed by AngelScript.
  • Predefined API and engine bindings are declared in scripts/as.predefined.

Input Actions

  • Query input with IsActionPressed, IsActionDown, IsActionReleased, and GetActionStrength.
  • Register and bind at runtime with RegisterAction, BindKeyboard, BindMouseButton, BindGamepadButton, and BindGamepadAxis.
  • Enums: Key, MouseButton, GamepadButton, GamepadAxis.

Example:

RegisterAction("boost");
BindKeyboard("boost", Key::LEFT_CONTROL);
BindGamepadButton("boost", 0, GamepadButton::RIGHT_TRIGGER_1);

RegisterAction("zoom");
BindGamepadAxis("zoom", 0, GamepadAxis::RIGHT_TRIGGER, 0.2f, false);

ECS Texture + UV

  • Texture and UV helpers live under the ECS:: namespace.
  • Texture: AddTexture, SetTextureId, GetTextureId, HasTexture, RemoveTexture.
  • UV Transform: AddUVTransform, SetUVScale, SetUVOffset, SetUVRotation, HasUVTransform, RemoveUVTransform.

Example:

uint e = ECS::CreateEntity();
ECS::AddTexture(e, texId);
ECS::AddUVTransform(e, 2.0f, 2.0f, 0.0f, 0.0f, 0.0f);
ECS::SetUVOffset(e, 0.25f, 0.0f);

Examples

  • scripts/game.as — demo showing ECS usage, rendering, scenegraph and input actions.

How to document APIs

Add Markdown pages in the docs/ folder. Use relative links and include code fences for examples.