townengine/share/twn_api.json
2025-02-21 12:48:51 +03:00

419 lines
14 KiB
JSON

{
"name": "twn",
"procedures": {
"input_action": {
"module": "input",
"symbol": "action",
"header": "twn_input.h",
"params": [
{ "name": "name", "type": "char *" },
{ "name": "control", "type": "char *" }
]
},
"input_action_pressed": {
"module": "input",
"symbol": "action_pressed",
"header": "twn_input.h",
"params": [
{ "name": "name", "type": "char *" }
],
"return": "bool",
"restriction": "frame"
},
"input_action_just_pressed": {
"module": "input",
"symbol": "action_just_pressed",
"header": "twn_input.h",
"params": [
{ "name": "name", "type": "char *" }
],
"return": "bool",
"restriction": "frame"
},
"input_action_just_released": {
"module": "input",
"symbol": "action_just_released",
"header": "twn_input.h",
"params": [
{ "name": "name", "type": "char *" }
],
"return": "bool",
"restriction": "frame"
},
"input_action_position": {
"module": "input",
"symbol": "get_action_position",
"header": "twn_input.h",
"params": [
{ "name": "name", "type": "char *" }
],
"return": "Vec2",
"restriction": "frame"
},
"draw_sprite": {
"module": "draw",
"symbol": "sprite",
"header": "twn_draw.h",
"params": [
{ "name": "texture", "type": "char *" },
{ "name": "rect", "type": "Rect" },
{ "name": "texture_region", "type": "Rect", "default": { "x": 0, "y": 0, "w": 0, "h": 0 } },
{ "name": "color", "type": "Color", "default": { "r": 255, "g": 255, "b": 255, "a": 255 } },
{ "name": "rotation", "type": "float", "default": 0.0 },
{ "name": "flip_x", "type": "bool", "default": false },
{ "name": "flip_y", "type": "bool", "default": false },
{ "name": "stretch", "type": "bool", "default": true }
]
},
"draw_rectangle": {
"module": "draw",
"symbol": "rectangle",
"header": "twn_draw.h",
"params": [
{ "name": "rect", "type": "Rect" },
{ "name": "color", "type": "Color", "default": { "r": 255, "g": 255, "b": 255, "a": 255 } }
]
},
"draw_circle": {
"module": "draw",
"symbol": "circle",
"header": "twn_draw.h",
"params": [
{ "name": "position", "type": "Vec2" },
{ "name": "radius", "type": "float" },
{ "name": "color", "type": "Color", "default": { "r": 255, "g": 255, "b": 255, "a": 255 } }
]
},
"draw_text": {
"module": "draw",
"symbol": "text",
"header": "twn_draw.h",
"params": [
{ "name": "string", "type": "char *" },
{ "name": "position", "type": "Vec2" },
{ "name": "height", "type": "float", "default": 22 },
{ "name": "color", "type": "Color", "default": { "r": 255, "g": 255, "b": 255, "a": 255 } },
{ "name": "font", "type": "char *", "default": {} }
]
},
"draw_text_width": {
"module": "draw",
"symbol": "text_width",
"header": "twn_draw.h",
"params": [
{ "name": "string", "type": "char *" },
{ "name": "height", "type": "float", "default": 22 },
{ "name": "font", "type": "char *", "default": {} }
],
"return": "float",
"restriction": "asset"
},
"draw_nine_slice": {
"module": "draw",
"symbol": "nine_slice",
"header": "twn_draw.h",
"params": [
{ "name": "texture", "type": "char *" },
{ "name": "corners", "type": "Vec2" },
{ "name": "rect", "type": "Rect" },
{ "name": "border_thickness", "type": "float", "default": 0 },
{ "name": "color", "type": "Color", "default": { "r": 255, "g": 255, "b": 255, "a": 255 } }
]
},
"draw_line": {
"module": "draw",
"symbol": "line",
"header": "twn_draw.h",
"params": [
{ "name": "start", "type": "Vec2" },
{ "name": "finish", "type": "Vec2" },
{ "name": "thickness", "type": "float", "default": 1 },
{ "name": "color", "type": "Color", "default": { "r": 255, "g": 255, "b": 255, "a": 255 } }
]
},
"draw_triangle": {
"module": "draw",
"symbol": "triangle",
"header": "twn_draw.h",
"params": [
{ "name": "texture", "type": "char *" },
{ "name": "v0", "type": "Vec3" },
{ "name": "v1", "type": "Vec3" },
{ "name": "v2", "type": "Vec3" },
{ "name": "uv0", "type": "Vec2" },
{ "name": "uv1", "type": "Vec2" },
{ "name": "uv2", "type": "Vec2" },
{ "name": "c0", "type": "Color", "default": { "r": 255, "g": 255, "b": 255, "a": 255 } },
{ "name": "c1", "type": "Color", "default": { "r": 255, "g": 255, "b": 255, "a": 255 } },
{ "name": "c2", "type": "Color", "default": { "r": 255, "g": 255, "b": 255, "a": 255 } }
]
},
"draw_quad": {
"module": "draw",
"symbol": "quad",
"header": "twn_draw.h",
"params": [
{ "name": "texture", "type": "char *" },
{ "name": "v0", "type": "Vec3" },
{ "name": "v1", "type": "Vec3" },
{ "name": "v2", "type": "Vec3" },
{ "name": "v3", "type": "Vec3" },
{ "name": "texture_region", "type": "Rect" },
{ "name": "color", "type": "Color", "default": { "r": 255, "g": 255, "b": 255, "a": 255 } }
]
},
"draw_billboard": {
"module": "draw",
"symbol": "billboard",
"header": "twn_draw.h",
"params": [
{ "name": "texture", "type": "char *" },
{ "name": "position", "type": "Vec3" },
{ "name": "size", "type": "Vec2" },
{ "name": "texture_region", "type": "Rect", "default": { "x": 0, "y": 0, "w": 0, "h": 0 } },
{ "name": "color", "type": "Color", "default": { "r": 255, "g": 255, "b": 255, "a": 255 } },
{ "name": "cylindrical", "type": "bool", "default": false }
]
},
"draw_camera_2d": {
"module": "draw",
"symbol": "camera_2d",
"header": "twn_draw.h",
"params": [
{ "name": "position", "type": "Vec2", "default": { "x": 0, "y": 0 } },
{ "name": "rotation", "type": "float", "default": 0 },
{ "name": "zoom", "type": "float", "default": 1 }
]
},
"draw_camera": {
"module": "draw",
"symbol": "camera",
"header": "twn_draw.h",
"params": [
{ "name": "position", "type": "Vec3" },
{ "name": "direction", "type": "Vec3", "default": { "x": 0, "y": 0, "z": -1 } },
{ "name": "up", "type": "Vec3", "default": { "x": 0, "y": 1, "z": 0 } },
{ "name": "fov", "type": "float", "default": 1.57079632679 },
{ "name": "zoom", "type": "float", "default": 1 }
]
},
"draw_camera_from_principal_axes": {
"module": "draw",
"symbol": "camera_from_principal_axes",
"header": "twn_draw.h",
"params": [
{ "name": "position", "type": "Vec3" },
{ "name": "roll", "type": "float", "default": 0 },
{ "name": "pitch", "type": "float", "default": 0 },
{ "name": "yaw", "type": "float", "default": 0 },
{ "name": "fov", "type": "float", "default": 1.57079632679 },
{ "name": "zoom", "type": "float", "default": 1 }
],
"return": {
"fields": [
{ "name": "direction", "type": "Vec3" },
{ "name": "up", "type": "Vec3" }
],
"c_type": "DrawCameraFromPrincipalAxesResult"
},
"restriction": "parameters"
},
"draw_skybox": {
"module": "draw",
"symbol": "skybox",
"header": "twn_draw.h",
"params": [
{ "name": "textures", "type": "char *", "default": {} }
]
},
"audio_play": {
"module": "audio",
"symbol": "play",
"header": "twn_audio.h",
"params": [
{ "name": "audio", "type": "char *" },
{ "name": "channel", "type": "char *", "default": {} },
{ "name": "loops", "type": "bool", "default": false },
{ "name": "volume", "type": "float", "default": 1.0 },
{ "name": "panning", "type": "float", "default": 0.0 }
]
},
"audio_parameter": {
"module": "audio",
"symbol": "parameter",
"header": "twn_audio.h",
"params": [
{ "name": "channel", "type": "char *" },
{ "name": "parameter", "type": "char *" },
{ "name": "value", "type": "float" }
]
},
"file_read": {
"module": "util",
"symbol": "read",
"header": "twn_util.h",
"params": [
{ "name": "file", "type": "char *" }
],
"return": "char *",
"restriction": "asset"
},
"timer_tick_seconds": {
"module": "util",
"symbol": "tick_seconds",
"header": "twn_util.h",
"params": [
{ "name": "seconds_left", "type": "float" }
],
"return": "float",
"restriction": "parameters"
},
"timer_elapse_seconds": {
"module": "util",
"symbol": "elapse_seconds",
"header": "twn_util.h",
"params": [
{ "name": "seconds_left", "type": "float" },
{ "name": "interval", "type": "float" }
],
"return": {
"fields": [
{ "name": "seconds_left", "type": "float" },
{ "name": "interval", "type": "float" },
{ "name": "elapsed", "type": "bool" }
],
"c_type": "TimerElapseSecondsResult"
},
"restriction": "parameters"
},
"log_vec2": {
"module": "util",
"symbol": "log_vec2",
"header": "twn_util.h",
"params": [
{ "name": "value", "type": "Vec2" },
{ "name": "identity", "type": "char *", "default": {} }
]
},
"log_vec3": {
"module": "util",
"symbol": "log_vec3",
"header": "twn_util.h",
"params": [
{ "name": "value", "type": "Vec3" },
{ "name": "identity", "type": "char *", "default": {} }
]
},
"log_rect": {
"module": "util",
"symbol": "log_rect",
"header": "twn_util.h",
"params": [
{ "name": "value", "type": "Rect" },
{ "name": "identity", "type": "char *", "default": {} }
]
},
"profile_start": {
"module": "util",
"symbol": "profile_start",
"header": "twn_util.h",
"params": [
{ "name": "profile", "type": "char *" }
]
},
"profile_end": {
"module": "util",
"symbol": "profile_end",
"header": "twn_util.h",
"params": [
{ "name": "profile", "type": "char *" }
]
}
},
"types": {
"Vec2": {
"fields": [
{ "name": "x", "type": "float" },
{ "name": "y", "type": "float" }
],
"c_type": "Vec2"
},
"Vec3": {
"fields": [
{ "name": "x", "type": "float" },
{ "name": "y", "type": "float" },
{ "name": "z", "type": "float" }
],
"c_type": "Vec3"
},
"Color": {
"fields": [
{ "name": "r", "type": "uint8_t" },
{ "name": "g", "type": "uint8_t" },
{ "name": "b", "type": "uint8_t" },
{ "name": "a", "type": "uint8_t" }
],
"c_type": "Color"
},
"Rect": {
"fields": [
{ "name": "x", "type": "float" },
{ "name": "y", "type": "float" },
{ "name": "w", "type": "float" },
{ "name": "h", "type": "float" }
],
"c_type": "Rect"
},
"Context": {
"fields": [
{ "name": "frame_number", "type": "float" },
{ "name": "frame_duration", "type": "float" },
{ "name": "fog_density", "type": "float" },
{ "name": "fog_color", "type": "Color" },
{ "name": "resolution", "type": "Vec2" },
{ "name": "mouse_position", "type": "Vec2" },
{ "name": "mouse_movement", "type": "Vec2" },
{ "name": "random_seed", "type": "float" },
{ "name": "debug", "type": "bool" },
{ "name": "initialization_needed", "type": "bool" },
{ "name": "mouse_capture", "type": "bool" }
],
"c_type": "Context"
}
}
}