1.4 KiB
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, andGetActionStrength. - Register and bind at runtime with
RegisterAction,BindKeyboard,BindMouseButton,BindGamepadButton, andBindGamepadAxis. - 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.