documentation update
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
# Cmdline
|
||||
#### cmds
|
||||
**array**
|
||||
|
||||
[
|
||||
{
|
||||
"flag": "l",
|
||||
"doc": "Set log level."
|
||||
}
|
||||
]
|
||||
|
||||
#### orders
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### register_cmd(flag, fn, doc)
|
||||
|
||||
|
||||
|
||||
#### register_order(order, fn, doc, usage = "")
|
||||
|
||||
|
||||
|
||||
#### print_order(fn)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# ColorMap
|
||||
#### makemap(map)
|
||||
|
||||
|
||||
|
||||
#### Jet
|
||||
**object**
|
||||
|
||||
[object Object]
|
||||
|
||||
#### BlueRed
|
||||
**object**
|
||||
|
||||
[object Object]
|
||||
|
||||
#### Inferno
|
||||
**object**
|
||||
|
||||
[object Object]
|
||||
|
||||
#### Bathymetry
|
||||
**object**
|
||||
|
||||
[object Object]
|
||||
|
||||
#### Viridis
|
||||
**object**
|
||||
|
||||
[object Object]
|
||||
|
||||
#### sample(t, map = this)
|
||||
|
||||
Sample a given colormap at the given percentage (0 to 1).
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
# Ease
|
||||
#### linear(t)
|
||||
|
||||
|
||||
|
||||
#### in(t)
|
||||
|
||||
|
||||
|
||||
#### out(t)
|
||||
|
||||
|
||||
|
||||
#### inout(t)
|
||||
|
||||
|
||||
|
||||
#### quad
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### cubic
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### quart
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### quint
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### expo
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### bounce
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### sine
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### elastic
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# event Module
|
||||
|
||||
## push_event
|
||||
|
||||
> Push a custom user event into SDL's queue, passing a callback function.
|
||||
|
||||
```
|
||||
function push_event()
|
||||
```
|
||||
|
||||
|
||||
## engine_input
|
||||
|
||||
> Poll all system events (keyboard, mouse, etc.) and call the given function with each event object.
|
||||
|
||||
```
|
||||
function engine_input()
|
||||
```
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# Gizmos
|
||||
#### pick_gameobject_points(worldpos, gameobject, points)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
# Register
|
||||
#### registries
|
||||
**array**
|
||||
|
||||
[
|
||||
{},
|
||||
{
|
||||
"doc": "Called once per frame."
|
||||
},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{}
|
||||
]
|
||||
|
||||
#### add_cb(name)
|
||||
|
||||
|
||||
|
||||
#### appupdate
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### update
|
||||
**object**
|
||||
|
||||
Called once per frame.
|
||||
|
||||
#### physupdate
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### gui
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### debug
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### draw
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### screengui
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
# resources Module
|
||||
|
||||
## scripts
|
||||
|
||||
|
||||
## images
|
||||
|
||||
|
||||
## sounds
|
||||
|
||||
|
||||
## fonts
|
||||
|
||||
|
||||
## lib
|
||||
|
||||
|
||||
## canonical
|
||||
|
||||
```
|
||||
function canonical(file)
|
||||
```
|
||||
|
||||
|
||||
## find_image
|
||||
|
||||
```
|
||||
function find_image(...args)
|
||||
```
|
||||
|
||||
|
||||
## find_sound
|
||||
|
||||
```
|
||||
function find_sound(...args)
|
||||
```
|
||||
|
||||
|
||||
## find_script
|
||||
|
||||
```
|
||||
function find_script(...args)
|
||||
```
|
||||
|
||||
|
||||
## find_font
|
||||
|
||||
```
|
||||
function find_font(...args)
|
||||
```
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# spline Module
|
||||
|
||||
## catmull
|
||||
|
||||
> Perform Catmull-Rom spline sampling on an array of 2D points, returning an array of samples.
|
||||
|
||||
```
|
||||
function catmull()
|
||||
```
|
||||
|
||||
|
||||
## bezier
|
||||
|
||||
> Perform a Bezier spline (or catmull) sampling on 2D points, returning an array of sampled points.
|
||||
|
||||
```
|
||||
function bezier()
|
||||
```
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
# SpriteAnim
|
||||
Functions to create Primum animations from varying sources.
|
||||
#### make(path)
|
||||
|
||||
|
||||
|
||||
#### gif(path)
|
||||
|
||||
Convert a gif.
|
||||
|
||||
#### strip(path, frames, time=0.05)
|
||||
|
||||
Given a path and number of frames, converts a horizontal strip animation, where each cell is the same width.
|
||||
|
||||
#### aseprite(path)
|
||||
|
||||
Given an aseprite json metadata, returns an object of animations defined in the aseprite file.
|
||||
|
||||
#### validate(anim)
|
||||
|
||||
|
||||
|
||||
#### find(path)
|
||||
|
||||
Given a path, find the relevant animation for the file.
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
# Vector
|
||||
#### length(v)
|
||||
|
||||
|
||||
|
||||
#### norm(v)
|
||||
|
||||
|
||||
|
||||
#### project(a, b)
|
||||
|
||||
|
||||
|
||||
#### dot(a, b)
|
||||
|
||||
|
||||
|
||||
#### random()
|
||||
|
||||
|
||||
|
||||
#### angle_between(a,b)
|
||||
|
||||
|
||||
|
||||
#### angle(v)
|
||||
|
||||
|
||||
|
||||
#### rotate(v,angle)
|
||||
|
||||
|
||||
|
||||
#### equal(v1, v2, tol)
|
||||
|
||||
|
||||
|
||||
#### reflect(vec, plane)
|
||||
|
||||
|
||||
|
||||
#### reflect_point(vec, point)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,43 +1,19 @@
|
||||
# actor Module
|
||||
# actor
|
||||
|
||||
## all_objects
|
||||
|
||||
```
|
||||
function all_objects(fn, startobj = world)
|
||||
```
|
||||
## all_objects(fn, startobj = world)
|
||||
|
||||
|
||||
## find_object
|
||||
|
||||
```
|
||||
function find_object(fn, startobj = world)
|
||||
```
|
||||
## find_object(fn, startobj = world)
|
||||
|
||||
|
||||
## tag_add
|
||||
|
||||
```
|
||||
function tag_add(tag, obj)
|
||||
```
|
||||
## tag_add(tag, obj)
|
||||
|
||||
|
||||
## tag_rm
|
||||
|
||||
```
|
||||
function tag_rm(tag, obj)
|
||||
```
|
||||
## tag_rm(tag, obj)
|
||||
|
||||
|
||||
## tag_clear_guid
|
||||
|
||||
```
|
||||
function tag_clear_guid(obj)
|
||||
```
|
||||
## tag_clear_guid(obj)
|
||||
|
||||
|
||||
## objects_with_tag
|
||||
|
||||
```
|
||||
function objects_with_tag(tag)
|
||||
```
|
||||
## objects_with_tag(tag)
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
# ai
|
||||
#### race(list)
|
||||
|
||||
|
||||
|
||||
#### sequence(list)
|
||||
|
||||
|
||||
|
||||
#### parallel(list)
|
||||
|
||||
|
||||
|
||||
#### dofor(secs, fn)
|
||||
|
||||
|
||||
|
||||
#### wait(secs = 1)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# allsprites
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# app
|
||||
#### die()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:11] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1,17 +0,0 @@
|
||||
# audio
|
||||
#### channels
|
||||
**number**
|
||||
|
||||
|
||||
|
||||
#### buffer_frames
|
||||
**number**
|
||||
|
||||
|
||||
|
||||
#### samplerate
|
||||
**number**
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
# base Module
|
||||
# base
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
# bbox
|
||||
#### overlap(box1, box2)
|
||||
|
||||
|
||||
|
||||
#### fromcwh(c, wh)
|
||||
|
||||
|
||||
|
||||
#### frompoints(points)
|
||||
|
||||
|
||||
|
||||
#### topoints(bb)
|
||||
|
||||
|
||||
|
||||
#### tocwh(bb)
|
||||
|
||||
|
||||
|
||||
#### towh(bb)
|
||||
|
||||
|
||||
|
||||
#### pointin(bb, p)
|
||||
|
||||
|
||||
|
||||
#### move(bb, pos)
|
||||
|
||||
|
||||
|
||||
#### expand(oldbb, x)
|
||||
|
||||
|
||||
|
||||
#### blwh(bl,wh)
|
||||
|
||||
Bounding box from (bottom left, width height)
|
||||
|
||||
#### fromobjs(objs)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:11] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1 +1 @@
|
||||
# cmd Module
|
||||
# cmd
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:11] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1,4 +1,4 @@
|
||||
# color Module
|
||||
# color
|
||||
|
||||
## Color
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
# component
|
||||
#### sprite(obj)
|
||||
|
||||
|
||||
|
||||
#### edge2d(obj)
|
||||
|
||||
|
||||
|
||||
#### circle2d(obj)
|
||||
|
||||
|
||||
|
||||
#### poly2d(obj)
|
||||
|
||||
|
||||
|
||||
#### seg2d(obj)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
# console
|
||||
#### print()
|
||||
|
||||
|
||||
|
||||
#### rec()
|
||||
|
||||
|
||||
|
||||
#### stdout_lvl
|
||||
**number**
|
||||
|
||||
|
||||
|
||||
#### transcript
|
||||
**string**
|
||||
|
||||
|
||||
|
||||
#### say(msg)
|
||||
|
||||
Write raw text to console, plus a newline.
|
||||
|
||||
#### log(msg)
|
||||
|
||||
|
||||
|
||||
#### pprint(msg, lvl = 0)
|
||||
|
||||
|
||||
|
||||
#### spam(msg)
|
||||
|
||||
|
||||
|
||||
#### debug(msg)
|
||||
|
||||
|
||||
|
||||
#### info(msg)
|
||||
|
||||
Output info level message.
|
||||
|
||||
#### warn(msg)
|
||||
|
||||
Output warn level message.
|
||||
|
||||
#### error(msg)
|
||||
|
||||
Output error level message, and print stacktrace.
|
||||
|
||||
#### panic(msg)
|
||||
|
||||
|
||||
|
||||
#### stackstr(skip = 0)
|
||||
|
||||
|
||||
|
||||
#### stack(skip = 0)
|
||||
|
||||
Output a stacktrace to console.
|
||||
|
||||
#### trace(skip = 0)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# convert
|
||||
#### romanize(num)
|
||||
|
||||
|
||||
|
||||
#### deromanize(str)
|
||||
|
||||
|
||||
|
||||
#### buf2hex(buffer)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:11] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1,50 +0,0 @@
|
||||
# debug
|
||||
#### fn_break(fn,obj = globalThis)
|
||||
|
||||
|
||||
|
||||
#### draw_phys
|
||||
**boolean**
|
||||
|
||||
|
||||
|
||||
#### draw_bb
|
||||
**boolean**
|
||||
|
||||
|
||||
|
||||
#### draw_gizmos
|
||||
**boolean**
|
||||
|
||||
|
||||
|
||||
#### draw_names
|
||||
**boolean**
|
||||
|
||||
|
||||
|
||||
#### draw()
|
||||
|
||||
|
||||
|
||||
#### inputs
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### gif
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### api
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### log
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:11] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1,22 +1,10 @@
|
||||
# doc Module
|
||||
# doc
|
||||
|
||||
## print_api
|
||||
|
||||
```
|
||||
function print_api(obj)
|
||||
```
|
||||
## print_api(obj)
|
||||
|
||||
|
||||
## print_modules
|
||||
|
||||
```
|
||||
function print_modules()
|
||||
```
|
||||
## print_modules()
|
||||
|
||||
|
||||
## write_modules
|
||||
|
||||
```
|
||||
function write_modules()
|
||||
```
|
||||
## write_modules()
|
||||
|
||||
|
||||
@@ -1,85 +1,37 @@
|
||||
# draw2d Module
|
||||
# draw2d
|
||||
|
||||
## point
|
||||
|
||||
```
|
||||
function point(pos, size, color = Color.blue)
|
||||
```
|
||||
## point(pos, size, color = Color.blue)
|
||||
|
||||
|
||||
## line
|
||||
|
||||
```
|
||||
function line(points, color = Color.white, thickness = 1, pipeline)
|
||||
```
|
||||
## line(points, color = Color.white, thickness = 1, pipeline)
|
||||
|
||||
|
||||
## cross
|
||||
|
||||
```
|
||||
function cross(pos, size, color = Color.red, thickness = 1, pipe)
|
||||
```
|
||||
## cross(pos, size, color = Color.red, thickness = 1, pipe)
|
||||
|
||||
|
||||
## arrow
|
||||
|
||||
```
|
||||
function arrow(start, end, color = Color.red, wingspan = 4, wingangle = 10, pipe)
|
||||
```
|
||||
## arrow(start, end, color = Color.red, wingspan = 4, wingangle = 10, pipe)
|
||||
|
||||
|
||||
## rectangle
|
||||
|
||||
```
|
||||
function rectangle(rect, color = Color.white, pipeline)
|
||||
```
|
||||
## rectangle(rect, color = Color.white, pipeline)
|
||||
|
||||
|
||||
## tile
|
||||
|
||||
```
|
||||
function tile(image, rect, color = Color.white, tile = tile_def, pipeline)
|
||||
```
|
||||
## tile(image, rect, color = Color.white, tile = tile_def, pipeline)
|
||||
|
||||
|
||||
## slice9
|
||||
|
||||
```
|
||||
function slice9(image, rect = [0,0], slice = 0, color = Color.white, info = slice9_info, pipeline)
|
||||
```
|
||||
## slice9(image, rect = [0,0], slice = 0, color = Color.white, info = slice9_info, pipeline)
|
||||
|
||||
|
||||
## image
|
||||
|
||||
```
|
||||
function image(image, rect = [0,0], rotation = 0, color, pipeline)
|
||||
```
|
||||
## image(image, rect = [0,0], rotation = 0, color, pipeline)
|
||||
|
||||
|
||||
## images
|
||||
|
||||
```
|
||||
function images(image, rects, config)
|
||||
```
|
||||
## images(image, rects, config)
|
||||
|
||||
|
||||
## sprites
|
||||
|
||||
```
|
||||
function sprites(sprites, sort = 0, pipeline)
|
||||
```
|
||||
## sprites(sprites, sort = 0, pipeline)
|
||||
|
||||
|
||||
## circle
|
||||
|
||||
```
|
||||
function circle(pos, radius, color, inner_radius = 1, pipeline)
|
||||
```
|
||||
## circle(pos, radius, color, inner_radius = 1, pipeline)
|
||||
|
||||
|
||||
## text
|
||||
|
||||
```
|
||||
function text(text, rect, font = sysfont, size = 0, color = Color.white, wrap = 0, pipeline)
|
||||
```
|
||||
## text(text, rect, font = sysfont, size = 0, color = Color.white, wrap = 0, pipeline)
|
||||
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
# dspsound
|
||||
#### noise()
|
||||
|
||||
|
||||
|
||||
#### pink()
|
||||
|
||||
|
||||
|
||||
#### red()
|
||||
|
||||
|
||||
|
||||
#### pitchshift()
|
||||
|
||||
|
||||
|
||||
#### noise_gate()
|
||||
|
||||
|
||||
|
||||
#### limiter()
|
||||
|
||||
|
||||
|
||||
#### compressor()
|
||||
|
||||
|
||||
|
||||
#### crush()
|
||||
|
||||
|
||||
|
||||
#### lpf()
|
||||
|
||||
|
||||
|
||||
#### hpf()
|
||||
|
||||
|
||||
|
||||
#### delay()
|
||||
|
||||
|
||||
|
||||
#### fwd_delay()
|
||||
|
||||
|
||||
|
||||
#### source()
|
||||
|
||||
|
||||
|
||||
#### mix()
|
||||
|
||||
|
||||
|
||||
#### master()
|
||||
|
||||
|
||||
|
||||
#### plugin_node()
|
||||
|
||||
|
||||
|
||||
#### midi()
|
||||
|
||||
|
||||
|
||||
#### mod()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:10] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:11] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1,33 +0,0 @@
|
||||
script:0: [2024-07-03 12:05:54] [22;31merror[0m, script: ReferenceError :: 'editor' is not defined
|
||||
at <eval> (<input>)
|
||||
at <anonymous> (scripts/debug.js:193)
|
||||
at <anonymous> (scripts/std.js:385)
|
||||
at cmd_args (scripts/std.js:458)
|
||||
at <eval> (C eval)
|
||||
|
||||
Initializing cpSpace - Chipmunk v7.0.3 (Debug Enabled)
|
||||
Compile with -DNDEBUG defined to disable debug mode and runtime assertion checks
|
||||
USE REPORT
|
||||
scripts/base.js 5.142 ms
|
||||
scripts/render.js 1.197 ms
|
||||
scripts/debug.js 521.4 us
|
||||
scripts/input.js 1.055 ms
|
||||
scripts/std.js 1.175 ms
|
||||
scripts/diff.js 194.4 us
|
||||
scripts/color.js 856.8 us
|
||||
scripts/gui.js 597.1 us
|
||||
scripts/tween.js 516.6 us
|
||||
scripts/ai.js 128.0 us
|
||||
scripts/physics.js 94.48 us
|
||||
scripts/geometry.js 189.4 us
|
||||
scripts/spline.js 253.1 us
|
||||
scripts/components.js 1.761 ms
|
||||
scripts/actor.js 185.2 us
|
||||
scripts/entity.js 2.157 ms
|
||||
scripts/widget.js 444.3 us
|
||||
scripts/mum.js 76.63 us
|
||||
scripts/editor.js 16.03 ms
|
||||
|
||||
ENTITY REPORT
|
||||
|
||||
scripts/engine.js:501: [2024-07-03 12:05:56] [22;36minfo[0m, script: QUITTING
|
||||
@@ -1 +1 @@
|
||||
# engine Module
|
||||
# engine
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
script:0: [2024-07-03 12:13:12] [22;31merror[0m, script: TypeError :: cannot read property 'doc' of undefined
|
||||
at <anonymous> (scripts/debug.js:179)
|
||||
at <anonymous> (scripts/debug.js:223)
|
||||
at <anonymous> (scripts/std.js:385)
|
||||
at cmd_args (scripts/std.js:458)
|
||||
at <eval> (C eval)
|
||||
|
||||
Initializing cpSpace - Chipmunk v7.0.3 (Debug Enabled)
|
||||
Compile with -DNDEBUG defined to disable debug mode and runtime assertion checks
|
||||
USE REPORT
|
||||
scripts/base.js 5.200 ms
|
||||
scripts/render.js 1.284 ms
|
||||
scripts/debug.js 516.9 us
|
||||
scripts/input.js 970.4 us
|
||||
scripts/std.js 1.103 ms
|
||||
scripts/diff.js 230.1 us
|
||||
scripts/color.js 1.148 ms
|
||||
scripts/gui.js 665.1 us
|
||||
scripts/tween.js 498.5 us
|
||||
scripts/ai.js 125.5 us
|
||||
scripts/physics.js 93.55 us
|
||||
scripts/geometry.js 212.2 us
|
||||
scripts/spline.js 252.9 us
|
||||
scripts/components.js 1.780 ms
|
||||
scripts/actor.js 188.5 us
|
||||
scripts/entity.js 2.101 ms
|
||||
scripts/widget.js 452.2 us
|
||||
scripts/mum.js 70.77 us
|
||||
scripts/editor.js 17.66 ms
|
||||
|
||||
ENTITY REPORT
|
||||
|
||||
scripts/engine.js:501: [2024-07-03 12:13:13] [22;36minfo[0m, script: QUITTING
|
||||
@@ -1,2 +0,0 @@
|
||||
# entityreport
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# esc
|
||||
Functions and constants for ANSI escape sequences.
|
||||
#### reset
|
||||
**string**
|
||||
|
||||
|
||||
|
||||
#### color(v)
|
||||
|
||||
|
||||
|
||||
|
||||
23
docs/api/event.md
Normal file
23
docs/api/event.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# event
|
||||
|
||||
## push_event(event)
|
||||
|
||||
Push a custom user event into SDL's queue, passing a callback function.
|
||||
|
||||
**event**: A function to call when this event is consumed.
|
||||
|
||||
**Returns**: None
|
||||
|
||||
|
||||
|
||||
|
||||
## engine_input(callback)
|
||||
|
||||
Poll all system events (keyboard, mouse, etc.) and call the given function with each event object.
|
||||
|
||||
**callback**: A function that executes on each event consumed from the poll.
|
||||
|
||||
**Returns**: None
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:10] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:11] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:10] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:10] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1,58 +0,0 @@
|
||||
# game
|
||||
#### engine_start(s)
|
||||
|
||||
|
||||
|
||||
#### startengine
|
||||
**number**
|
||||
|
||||
|
||||
|
||||
#### timescale
|
||||
**number**
|
||||
|
||||
|
||||
|
||||
#### all_objects(fn, startobj = world)
|
||||
|
||||
|
||||
|
||||
#### find_object(fn, startobj = world)
|
||||
|
||||
|
||||
|
||||
#### tags
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### tag_add(tag, obj)
|
||||
|
||||
|
||||
|
||||
#### tag_rm(tag, obj)
|
||||
|
||||
|
||||
|
||||
#### tag_clear_guid(guid)
|
||||
|
||||
|
||||
|
||||
#### objects_with_tag(tag)
|
||||
|
||||
|
||||
|
||||
#### texture(path, force = false)
|
||||
|
||||
|
||||
|
||||
#### loadurs()
|
||||
|
||||
|
||||
|
||||
#### ur
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:14] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1,91 +1,51 @@
|
||||
# geometry Module
|
||||
# geometry
|
||||
|
||||
## rect_intersection
|
||||
## rect_intersection()
|
||||
|
||||
> Return the intersection of two rectangles (x,y,w,h). The result may be empty if no intersection.
|
||||
|
||||
```
|
||||
function rect_intersection()
|
||||
```
|
||||
Return the intersection of two rectangles (x,y,w,h). The result may be empty if no intersection.
|
||||
|
||||
|
||||
## rect_intersects
|
||||
## rect_intersects()
|
||||
|
||||
> Return a boolean indicating if two rectangles overlap.
|
||||
|
||||
```
|
||||
function rect_intersects()
|
||||
```
|
||||
Return a boolean indicating if two rectangles overlap.
|
||||
|
||||
|
||||
## rect_expand
|
||||
## rect_expand()
|
||||
|
||||
> Merge or combine two rectangles, returning their bounding rectangle.
|
||||
|
||||
```
|
||||
function rect_expand()
|
||||
```
|
||||
Merge or combine two rectangles, returning their bounding rectangle.
|
||||
|
||||
|
||||
## rect_inside
|
||||
## rect_inside()
|
||||
|
||||
> Return true if the first rectangle is completely inside the second.
|
||||
|
||||
```
|
||||
function rect_inside()
|
||||
```
|
||||
Return true if the first rectangle is completely inside the second.
|
||||
|
||||
|
||||
## rect_random
|
||||
## rect_random()
|
||||
|
||||
> Return a random point within the given rectangle (uniform distribution).
|
||||
|
||||
```
|
||||
function rect_random()
|
||||
```
|
||||
Return a random point within the given rectangle (uniform distribution).
|
||||
|
||||
|
||||
## cwh2rect
|
||||
## cwh2rect()
|
||||
|
||||
> Helper: convert a center point and width/height vector to a rect object.
|
||||
|
||||
```
|
||||
function cwh2rect()
|
||||
```
|
||||
Helper: convert a center point and width/height vector to a rect object.
|
||||
|
||||
|
||||
## rect_point_inside
|
||||
## rect_point_inside()
|
||||
|
||||
> Return true if the given point is inside the given rectangle.
|
||||
|
||||
```
|
||||
function rect_point_inside()
|
||||
```
|
||||
Return true if the given point is inside the given rectangle.
|
||||
|
||||
|
||||
## rect_pos
|
||||
## rect_pos()
|
||||
|
||||
> Return just the (x,y) position of a rectangle as a 2D array.
|
||||
|
||||
```
|
||||
function rect_pos()
|
||||
```
|
||||
Return just the (x,y) position of a rectangle as a 2D array.
|
||||
|
||||
|
||||
## rect_move
|
||||
## rect_move()
|
||||
|
||||
> Offset a rectangle by a 2D vector.
|
||||
|
||||
```
|
||||
function rect_move()
|
||||
```
|
||||
Offset a rectangle by a 2D vector.
|
||||
|
||||
|
||||
## box
|
||||
|
||||
```
|
||||
function box(w, h)
|
||||
```
|
||||
## box(w, h)
|
||||
|
||||
|
||||
## sphere
|
||||
@@ -94,37 +54,17 @@ function box(w, h)
|
||||
## circle
|
||||
|
||||
|
||||
## ngon
|
||||
|
||||
```
|
||||
function ngon(radius, n)
|
||||
```
|
||||
## ngon(radius, n)
|
||||
|
||||
|
||||
## arc
|
||||
|
||||
```
|
||||
function arc(radius, angle, n, start = 0)
|
||||
```
|
||||
## arc(radius, angle, n, start = 0)
|
||||
|
||||
|
||||
## corners2points
|
||||
|
||||
```
|
||||
function corners2points(ll, ur)
|
||||
```
|
||||
## corners2points(ll, ur)
|
||||
|
||||
|
||||
## sortpointsccw
|
||||
|
||||
```
|
||||
function sortpointsccw(points)
|
||||
```
|
||||
## sortpointsccw(points)
|
||||
|
||||
|
||||
## points2cm
|
||||
|
||||
```
|
||||
function points2cm(points)
|
||||
```
|
||||
## points2cm(points)
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:10] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1,171 +1,91 @@
|
||||
# graphics Module
|
||||
# graphics
|
||||
|
||||
## make_sprite_mesh
|
||||
## make_sprite_mesh()
|
||||
|
||||
> Given an array of sprites, build a single geometry mesh for rendering them.
|
||||
Given an array of sprites, build a single geometry mesh for rendering them.
|
||||
|
||||
```
|
||||
function make_sprite_mesh()
|
||||
```
|
||||
|
||||
## make_sprite_queue()
|
||||
|
||||
## make_sprite_queue
|
||||
Given an array of sprites, optionally sort them and build a queue of pipeline commands.
|
||||
|
||||
> Given an array of sprites, optionally sort them and build a queue of pipeline commands.
|
||||
|
||||
```
|
||||
function make_sprite_queue()
|
||||
```
|
||||
## make_text_buffer()
|
||||
|
||||
Generate a GPU buffer mesh of text quads for rendering with a font, etc.
|
||||
|
||||
## make_text_buffer
|
||||
|
||||
> Generate a GPU buffer mesh of text quads for rendering with a font, etc.
|
||||
## rectpack()
|
||||
|
||||
```
|
||||
function make_text_buffer()
|
||||
```
|
||||
Perform a rectangle packing using the stbrp library. Return positions for each rect.
|
||||
|
||||
|
||||
## rectpack
|
||||
## make_rtree()
|
||||
|
||||
> Perform a rectangle packing using the stbrp library. Return positions for each rect.
|
||||
Create a new R-Tree for quickly querying many rectangles or sprite bounds.
|
||||
|
||||
```
|
||||
function rectpack()
|
||||
```
|
||||
|
||||
## make_texture()
|
||||
|
||||
## make_rtree
|
||||
Convert raw image bytes (PNG, JPG) into an SDL_Surface object.
|
||||
|
||||
> Create a new R-Tree for quickly querying many rectangles or sprite bounds.
|
||||
|
||||
```
|
||||
function make_rtree()
|
||||
```
|
||||
## make_gif()
|
||||
|
||||
Load a GIF from an array of bytes, returning an object with frames[] of surfaces.
|
||||
|
||||
## make_texture
|
||||
|
||||
> Convert raw image bytes (PNG, JPG) into an SDL_Surface object.
|
||||
## make_aseprite()
|
||||
|
||||
```
|
||||
function make_texture()
|
||||
```
|
||||
Load an Aseprite/ASE file from an array of bytes, returning frames or animations.
|
||||
|
||||
|
||||
## make_gif
|
||||
## cull_sprites()
|
||||
|
||||
> Load a GIF from an array of bytes, returning an object with frames[] of surfaces.
|
||||
Filter an array of sprites to only those visible in the provided camera's view.
|
||||
|
||||
```
|
||||
function make_gif()
|
||||
```
|
||||
|
||||
## rects_to_sprites()
|
||||
|
||||
## make_aseprite
|
||||
Convert an array of rect coords into sprite objects referencing an image.
|
||||
|
||||
> Load an Aseprite/ASE file from an array of bytes, returning frames or animations.
|
||||
|
||||
```
|
||||
function make_aseprite()
|
||||
```
|
||||
## make_surface()
|
||||
|
||||
Create a blank RGBA surface with the given dimensions. For software rendering or icons.
|
||||
|
||||
## cull_sprites
|
||||
|
||||
> Filter an array of sprites to only those visible in the provided camera's view.
|
||||
## make_cursor()
|
||||
|
||||
```
|
||||
function cull_sprites()
|
||||
```
|
||||
Create an SDL_Cursor from an existing surface and a given hotspot location.
|
||||
|
||||
|
||||
## rects_to_sprites
|
||||
## make_font()
|
||||
|
||||
> Convert an array of rect coords into sprite objects referencing an image.
|
||||
Load a font from TTF/OTF data (an ArrayBuffer) at the given pixel size.
|
||||
|
||||
```
|
||||
function rects_to_sprites()
|
||||
```
|
||||
|
||||
## make_sprite()
|
||||
|
||||
## make_surface
|
||||
Create a new sprite object, which has rect, color, layer, and image references.
|
||||
|
||||
> Create a blank RGBA surface with the given dimensions. For software rendering or icons.
|
||||
|
||||
```
|
||||
function make_surface()
|
||||
```
|
||||
## make_line_prim()
|
||||
|
||||
Build a GPU mesh representing a thick polyline from an array of points, using parsl.
|
||||
|
||||
## make_cursor
|
||||
|
||||
> Create an SDL_Cursor from an existing surface and a given hotspot location.
|
||||
## is_image(obj)
|
||||
|
||||
```
|
||||
function make_cursor()
|
||||
```
|
||||
|
||||
## texture(path)
|
||||
|
||||
## make_font
|
||||
|
||||
> Load a font from TTF/OTF data (an ArrayBuffer) at the given pixel size.
|
||||
## tex_hotreload(file)
|
||||
|
||||
```
|
||||
function make_font()
|
||||
```
|
||||
|
||||
## get_font(path,size)
|
||||
|
||||
## make_sprite
|
||||
|
||||
> Create a new sprite object, which has rect, color, layer, and image references.
|
||||
|
||||
```
|
||||
function make_sprite()
|
||||
```
|
||||
|
||||
|
||||
## make_line_prim
|
||||
|
||||
> Build a GPU mesh representing a thick polyline from an array of points, using parsl.
|
||||
|
||||
```
|
||||
function make_line_prim()
|
||||
```
|
||||
|
||||
|
||||
## is_image
|
||||
|
||||
```
|
||||
function is_image(obj)
|
||||
```
|
||||
|
||||
|
||||
## texture
|
||||
|
||||
```
|
||||
function texture(path)
|
||||
```
|
||||
|
||||
|
||||
## tex_hotreload
|
||||
|
||||
```
|
||||
function tex_hotreload(file)
|
||||
```
|
||||
|
||||
|
||||
## get_font
|
||||
|
||||
```
|
||||
function get_font(path,size)
|
||||
```
|
||||
|
||||
|
||||
## queue_sprite_mesh
|
||||
|
||||
```
|
||||
function queue_sprite_mesh(queue)
|
||||
```
|
||||
## queue_sprite_mesh(queue)
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
# gui
|
||||
#### scissor()
|
||||
|
||||
|
||||
|
||||
#### text()
|
||||
|
||||
|
||||
|
||||
#### font_set()
|
||||
|
||||
|
||||
|
||||
#### scissor_win()
|
||||
|
||||
|
||||
|
||||
#### input_lmouse_pressed()
|
||||
|
||||
|
||||
|
||||
#### input_s_pressed()
|
||||
|
||||
|
||||
|
||||
#### input_w_pressed()
|
||||
|
||||
|
||||
|
||||
#### input_enter_pressed()
|
||||
|
||||
|
||||
|
||||
#### controls
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,48 +1,28 @@
|
||||
# input Module
|
||||
# input
|
||||
|
||||
## mouse_show
|
||||
## mouse_show()
|
||||
|
||||
> Show or hide the mouse cursor. Pass true to show, false to hide.
|
||||
|
||||
```
|
||||
function mouse_show()
|
||||
```
|
||||
Show or hide the mouse cursor. Pass true to show, false to hide.
|
||||
|
||||
|
||||
## mouse_lock
|
||||
## mouse_lock()
|
||||
|
||||
> Capture or release the mouse. Pass true to lock, false to unlock.
|
||||
|
||||
```
|
||||
function mouse_lock()
|
||||
```
|
||||
Capture or release the mouse. Pass true to lock, false to unlock.
|
||||
|
||||
|
||||
## cursor_set
|
||||
## cursor_set()
|
||||
|
||||
> Set the given cursor (created by os.make_cursor) as the active mouse cursor.
|
||||
|
||||
```
|
||||
function cursor_set()
|
||||
```
|
||||
Set the given cursor (created by os.make_cursor) as the active mouse cursor.
|
||||
|
||||
|
||||
## keyname
|
||||
## keyname()
|
||||
|
||||
> Given a numeric keycode, return the corresponding key name (e.g., from SDL).
|
||||
|
||||
```
|
||||
function keyname()
|
||||
```
|
||||
Given a numeric keycode, return the corresponding key name (e.g., from SDL).
|
||||
|
||||
|
||||
## keymod
|
||||
## keymod()
|
||||
|
||||
> Return an object describing the current modifier keys, e.g. {shift:true, ctrl:true}.
|
||||
|
||||
```
|
||||
function keymod()
|
||||
```
|
||||
Return an object describing the current modifier keys, e.g. {shift:true, ctrl:true}.
|
||||
|
||||
|
||||
## mouse
|
||||
@@ -51,49 +31,25 @@ function keymod()
|
||||
## keyboard
|
||||
|
||||
|
||||
## print_pawn_kbm
|
||||
|
||||
```
|
||||
function print_pawn_kbm(pawn)
|
||||
```
|
||||
## print_pawn_kbm(pawn)
|
||||
|
||||
|
||||
## procdown
|
||||
|
||||
```
|
||||
function procdown()
|
||||
```
|
||||
## procdown()
|
||||
|
||||
|
||||
## print_md_kbm
|
||||
|
||||
```
|
||||
function print_md_kbm(pawn)
|
||||
```
|
||||
## print_md_kbm(pawn)
|
||||
|
||||
|
||||
## has_bind
|
||||
|
||||
```
|
||||
function has_bind(pawn, bind)
|
||||
```
|
||||
## has_bind(pawn, bind)
|
||||
|
||||
|
||||
## action
|
||||
|
||||
|
||||
## tabcomplete
|
||||
|
||||
```
|
||||
function tabcomplete(val, list)
|
||||
```
|
||||
## tabcomplete(val, list)
|
||||
|
||||
|
||||
## do_uncontrol
|
||||
|
||||
```
|
||||
function do_uncontrol(pawn)
|
||||
```
|
||||
## do_uncontrol(pawn)
|
||||
|
||||
|
||||
## player
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
# inputpanel
|
||||
#### title
|
||||
**string**
|
||||
|
||||
|
||||
|
||||
#### value
|
||||
**string**
|
||||
|
||||
|
||||
|
||||
#### on
|
||||
**boolean**
|
||||
|
||||
|
||||
|
||||
#### pos
|
||||
**array**
|
||||
|
||||
[
|
||||
20,
|
||||
460
|
||||
]
|
||||
|
||||
#### wh
|
||||
**array**
|
||||
|
||||
[
|
||||
100,
|
||||
100
|
||||
]
|
||||
|
||||
#### anchor
|
||||
**array**
|
||||
|
||||
[
|
||||
0,
|
||||
1
|
||||
]
|
||||
|
||||
#### padding
|
||||
**array**
|
||||
|
||||
[
|
||||
5,
|
||||
-15
|
||||
]
|
||||
|
||||
#### gui()
|
||||
|
||||
|
||||
|
||||
#### guibody()
|
||||
|
||||
|
||||
|
||||
#### open()
|
||||
|
||||
|
||||
|
||||
#### start()
|
||||
|
||||
|
||||
|
||||
#### close()
|
||||
|
||||
|
||||
|
||||
#### action()
|
||||
|
||||
|
||||
|
||||
#### closeonsubmit
|
||||
**boolean**
|
||||
|
||||
|
||||
|
||||
#### submit()
|
||||
|
||||
|
||||
|
||||
#### submit_check()
|
||||
|
||||
|
||||
|
||||
#### keycb()
|
||||
|
||||
|
||||
|
||||
#### caret
|
||||
**number**
|
||||
|
||||
|
||||
|
||||
#### reset_value()
|
||||
|
||||
|
||||
|
||||
#### input_backspace_pressrep()
|
||||
|
||||
|
||||
|
||||
#### inputs
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
|
||||
237
docs/api/io.md
237
docs/api/io.md
@@ -1,154 +1,219 @@
|
||||
# io Module
|
||||
# io
|
||||
|
||||
## rm
|
||||
## rm(path)
|
||||
|
||||
> Remove the file or empty directory at the given path.
|
||||
Remove the file or empty directory at the given path.
|
||||
|
||||
```
|
||||
function rm()
|
||||
```
|
||||
**path**: The file or empty directory to remove. Must be empty if a directory.
|
||||
|
||||
**Returns**: None
|
||||
|
||||
## mkdir
|
||||
|
||||
> Create a directory at the given path.
|
||||
|
||||
```
|
||||
function mkdir()
|
||||
```
|
||||
|
||||
## mkdir(path)
|
||||
|
||||
## stat
|
||||
Create a directory at the given path.
|
||||
|
||||
> Return an object describing file metadata for the given path. The object includes filesize, modtime, createtime, and accesstime. Throw an error if the path does not exist.
|
||||
**path**: The directory path to create.
|
||||
|
||||
```
|
||||
function stat()
|
||||
```
|
||||
**Returns**: None
|
||||
|
||||
|
||||
## globfs
|
||||
|
||||
> Return an array of files matching any glob patterns provided. Recursively enumerates the filesystem within PHYSFS.
|
||||
|
||||
```
|
||||
function globfs()
|
||||
```
|
||||
## stat(path)
|
||||
|
||||
Return an object describing file metadata for the given path. The object includes
|
||||
filesize, modtime, createtime, and accesstime. Throw an error if the path does not exist.
|
||||
|
||||
## match
|
||||
**path**: The file or directory to retrieve metadata for.
|
||||
|
||||
> Return boolean indicating whether the given path[1] matches the provided wildcard pattern[2].
|
||||
**Returns**: An object with metadata (filesize, modtime, createtime, accesstime).
|
||||
|
||||
```
|
||||
function match()
|
||||
```
|
||||
|
||||
|
||||
## exists
|
||||
|
||||
> Return a boolean indicating whether the file or directory at the given path exists.
|
||||
## globfs(patterns)
|
||||
|
||||
```
|
||||
function exists()
|
||||
```
|
||||
Return an array of files that do not match any of the provided glob patterns. It
|
||||
recursively enumerates the filesystem within PHYSFS. Each pattern is treated as an
|
||||
"ignore" rule, similar to .gitignore usage.
|
||||
|
||||
**patterns**: An array of glob patterns to ignore. Any file matching one of these is skipped.
|
||||
|
||||
## mount
|
||||
**Returns**: An array of matching file paths.
|
||||
|
||||
> Mount a directory or archive[1] at the specified mount point[2]. An undefined mount point mounts to '/'. Throw on error.
|
||||
|
||||
```
|
||||
function mount()
|
||||
```
|
||||
|
||||
|
||||
## unmount
|
||||
## match(pattern, string)
|
||||
|
||||
> Unmount a previously mounted directory or archive. Throw on error.
|
||||
Return boolean indicating whether the given wildcard pattern matches the provided
|
||||
string. Dots must match dots. Case is not ignored.
|
||||
|
||||
```
|
||||
function unmount()
|
||||
```
|
||||
Patterns can incorporate:
|
||||
'?' - Matches exactly one character (except leading dots or slashes).
|
||||
'*' - Matches zero or more characters (excluding path separators).
|
||||
'**' - Matches zero or more characters, including path separators.
|
||||
'[abc]' - A bracket expression; matches any single character from the set. Ranges like [a-z], [0-9] also work.
|
||||
'[[:alpha:]]' - POSIX character classes can be used inside brackets.
|
||||
'\' - Backslash escapes the next character.
|
||||
'!' - If placed immediately inside brackets (like [!abc]), it negates the set.
|
||||
|
||||
**pattern**: The wildcard pattern to compare.
|
||||
|
||||
## slurp
|
||||
**string**: The string to test against the wildcard pattern.
|
||||
|
||||
> Read the entire file at the given path as a string. Throw on error.
|
||||
**Returns**: True if matched, otherwise false.
|
||||
|
||||
```
|
||||
function slurp()
|
||||
```
|
||||
|
||||
|
||||
## slurpbytes
|
||||
|
||||
> Read the entire file at the given path as a raw ArrayBuffer. Throw on error.
|
||||
## exists(path)
|
||||
|
||||
```
|
||||
function slurpbytes()
|
||||
```
|
||||
Return a boolean indicating whether the file or directory at the given path exists.
|
||||
|
||||
**path**: The file or directory path to check.
|
||||
|
||||
## slurpwrite
|
||||
**Returns**: True if the path exists, otherwise false.
|
||||
|
||||
> Write data[1] (string or ArrayBuffer) to the given file path[2]. Overwrite if it exists. Throw on error.
|
||||
|
||||
```
|
||||
function slurpwrite()
|
||||
```
|
||||
|
||||
|
||||
## writepath
|
||||
## mount(archiveOrDir, mountPoint)
|
||||
|
||||
> Set the write directory. Subsequent writes will go here by default. Throw on error.
|
||||
Mount a directory or archive at the specified mount point. An undefined mount
|
||||
point mounts to '/'. Throw on error.
|
||||
|
||||
```
|
||||
function writepath()
|
||||
```
|
||||
**archiveOrDir**: The directory or archive to mount.
|
||||
|
||||
**mountPoint**: The path at which to mount. If omitted or undefined, '/' is used.
|
||||
|
||||
## basedir
|
||||
**Returns**: None
|
||||
|
||||
> Return the application's base directory (where the executable is located).
|
||||
|
||||
```
|
||||
function basedir()
|
||||
```
|
||||
|
||||
|
||||
## userdir
|
||||
## unmount(path)
|
||||
|
||||
> Return the user's directory, often used for saving data.
|
||||
Unmount a previously mounted directory or archive. Throw on error.
|
||||
|
||||
```
|
||||
function userdir()
|
||||
```
|
||||
**path**: The directory or archive mount point to unmount.
|
||||
|
||||
**Returns**: None
|
||||
|
||||
## realdir
|
||||
|
||||
> Return the actual, real directory (on the host filesystem) that contains the given file path. Return undefined if not found.
|
||||
|
||||
```
|
||||
function realdir()
|
||||
```
|
||||
|
||||
## slurp(path)
|
||||
|
||||
## open
|
||||
Read the entire file at the given path as a string. Throw on error.
|
||||
|
||||
> Open a file for writing, returning a file object that can be used for further operations. Throw on error.
|
||||
**path**: The file path to read from.
|
||||
|
||||
```
|
||||
function open()
|
||||
```
|
||||
**Returns**: A string with the file’s contents.
|
||||
|
||||
|
||||
## searchpath
|
||||
|
||||
> Return an array of all directories in the current paths.
|
||||
|
||||
```
|
||||
function searchpath()
|
||||
```
|
||||
## slurpbytes(path)
|
||||
|
||||
Read the entire file at the given path as a raw ArrayBuffer. Throw on error.
|
||||
|
||||
**path**: The file path to read from.
|
||||
|
||||
**Returns**: An ArrayBuffer containing the file’s raw bytes.
|
||||
|
||||
|
||||
|
||||
|
||||
## slurpwrite(data, path)
|
||||
|
||||
Write data (string or ArrayBuffer) to the given file path. Overwrite if it exists.
|
||||
Throw on error.
|
||||
|
||||
**data**: The data to write (string or ArrayBuffer).
|
||||
|
||||
**path**: The file path to write to.
|
||||
|
||||
**Returns**: None
|
||||
|
||||
|
||||
|
||||
|
||||
## writepath(path)
|
||||
|
||||
Set the write directory. Subsequent writes will go here by default. Throw on error.
|
||||
|
||||
**path**: The directory path to set as writable.
|
||||
|
||||
**Returns**: None
|
||||
|
||||
|
||||
|
||||
|
||||
## basedir()
|
||||
|
||||
Return the application's base directory (where the executable is located).
|
||||
|
||||
**Returns**: A string with the base directory path.
|
||||
|
||||
|
||||
|
||||
|
||||
## userdir()
|
||||
|
||||
Return the user's directory, often used for saving data.
|
||||
|
||||
**Returns**: A string with the user's directory path.
|
||||
|
||||
|
||||
|
||||
|
||||
## realdir(path)
|
||||
|
||||
Return the actual, real directory (on the host filesystem) that contains the given
|
||||
file path. Return undefined if not found.
|
||||
|
||||
**path**: The file path whose real directory is requested.
|
||||
|
||||
**Returns**: A string with the real directory path, or undefined.
|
||||
|
||||
|
||||
|
||||
|
||||
## open(path)
|
||||
|
||||
Open a file for writing, returning a file object that can be used for further
|
||||
operations. Throw on error.
|
||||
|
||||
**path**: The file path to open for writing.
|
||||
|
||||
**Returns**: A file object for subsequent write operations.
|
||||
|
||||
|
||||
|
||||
|
||||
## searchpath()
|
||||
|
||||
Return an array of all directories in the current paths.
|
||||
|
||||
**Returns**: An array of directory paths in the search path.
|
||||
|
||||
|
||||
|
||||
|
||||
## enumerate(path, recurse)
|
||||
|
||||
Return an array of files within the given directory, optionally recursing into
|
||||
subdirectories.
|
||||
|
||||
**path**: The directory to list.
|
||||
|
||||
**recurse**: Whether to recursively include subdirectories (true or false).
|
||||
|
||||
**Returns**: An array of file (and directory) paths found.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
# joint
|
||||
#### pin()
|
||||
|
||||
|
||||
|
||||
#### pivot()
|
||||
|
||||
|
||||
|
||||
#### gear()
|
||||
|
||||
|
||||
|
||||
#### rotary()
|
||||
|
||||
|
||||
|
||||
#### damped_rotary()
|
||||
|
||||
|
||||
|
||||
#### damped_spring()
|
||||
|
||||
|
||||
|
||||
#### groove()
|
||||
|
||||
|
||||
|
||||
#### slide()
|
||||
|
||||
|
||||
|
||||
#### ratchet()
|
||||
|
||||
|
||||
|
||||
#### motor()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,100 +1,56 @@
|
||||
# js Module
|
||||
# js
|
||||
|
||||
## dump_mem
|
||||
## dump_mem()
|
||||
|
||||
> Return a string summarizing memory usage in the QuickJS runtime.
|
||||
|
||||
```
|
||||
function dump_mem()
|
||||
```
|
||||
Return a string summarizing memory usage in the QuickJS runtime.
|
||||
|
||||
|
||||
## dump_shapes
|
||||
## dump_shapes()
|
||||
|
||||
> Return a debug string describing the internal shape hierarchy used by QuickJS.
|
||||
|
||||
```
|
||||
function dump_shapes()
|
||||
```
|
||||
Return a debug string describing the internal shape hierarchy used by QuickJS.
|
||||
|
||||
|
||||
## dump_atoms
|
||||
## dump_atoms()
|
||||
|
||||
> Return a debug string describing all currently registered atoms in the QuickJS runtime.
|
||||
|
||||
```
|
||||
function dump_atoms()
|
||||
```
|
||||
Return a debug string describing all currently registered atoms in the QuickJS runtime.
|
||||
|
||||
|
||||
## calc_mem
|
||||
## calc_mem()
|
||||
|
||||
> Return the approximate memory usage of a single JS value.
|
||||
|
||||
```
|
||||
function calc_mem()
|
||||
```
|
||||
Return the approximate memory usage of a single JS value.
|
||||
|
||||
|
||||
## mem
|
||||
## mem()
|
||||
|
||||
> Return a comprehensive memory usage object for the current QuickJS runtime.
|
||||
|
||||
```
|
||||
function mem()
|
||||
```
|
||||
Return a comprehensive memory usage object for the current QuickJS runtime.
|
||||
|
||||
|
||||
## mem_limit
|
||||
## mem_limit()
|
||||
|
||||
> Set (in bytes) the maximum memory the QuickJS runtime will attempt to use.
|
||||
|
||||
```
|
||||
function mem_limit()
|
||||
```
|
||||
Set (in bytes) the maximum memory the QuickJS runtime will attempt to use.
|
||||
|
||||
|
||||
## gc_threshold
|
||||
## gc_threshold()
|
||||
|
||||
> Set the threshold at which garbage collection triggers automatically, in bytes.
|
||||
|
||||
```
|
||||
function gc_threshold()
|
||||
```
|
||||
Set the threshold at which garbage collection triggers automatically, in bytes.
|
||||
|
||||
|
||||
## max_stacksize
|
||||
## max_stacksize()
|
||||
|
||||
> Set the maximum allowed stack size for QuickJS. Exceeding it can cause errors.
|
||||
|
||||
```
|
||||
function max_stacksize()
|
||||
```
|
||||
Set the maximum allowed stack size for QuickJS. Exceeding it can cause errors.
|
||||
|
||||
|
||||
## memstate
|
||||
## memstate()
|
||||
|
||||
> Return simpler memory usage (malloc sizes, etc.) for the QuickJS runtime.
|
||||
|
||||
```
|
||||
function memstate()
|
||||
```
|
||||
Return simpler memory usage (malloc sizes, etc.) for the QuickJS runtime.
|
||||
|
||||
|
||||
## gc
|
||||
## gc()
|
||||
|
||||
> Force a full garbage collection immediately.
|
||||
|
||||
```
|
||||
function gc()
|
||||
```
|
||||
Force a full garbage collection immediately.
|
||||
|
||||
|
||||
## eval
|
||||
## eval()
|
||||
|
||||
> Evaluate the given JavaScript source string with an optional filename, returning the result.
|
||||
|
||||
```
|
||||
function eval()
|
||||
```
|
||||
Evaluate the given JavaScript source string with an optional filename, returning the result.
|
||||
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
# json Module
|
||||
# json
|
||||
|
||||
## encode
|
||||
|
||||
```
|
||||
function encode(val,space,replacer,whitelist)
|
||||
```
|
||||
## encode(val,space,replacer,whitelist)
|
||||
|
||||
|
||||
## decode
|
||||
|
||||
```
|
||||
function decode(text,reviver)
|
||||
```
|
||||
## decode(text,reviver)
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
# listpanel
|
||||
#### assets
|
||||
**array**
|
||||
|
||||
[]
|
||||
|
||||
#### allassets
|
||||
**array**
|
||||
|
||||
[]
|
||||
|
||||
#### mumlist
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### submit_check()
|
||||
|
||||
|
||||
|
||||
#### start()
|
||||
|
||||
|
||||
|
||||
#### keycb()
|
||||
|
||||
|
||||
|
||||
#### guibody()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
# loop Module
|
||||
# loop
|
||||
|
||||
## step
|
||||
|
||||
```
|
||||
function step()
|
||||
```
|
||||
## step()
|
||||
|
||||
|
||||
238
docs/api/math.md
238
docs/api/math.md
@@ -1,271 +1,147 @@
|
||||
# math Module
|
||||
# math
|
||||
|
||||
## dot
|
||||
## dot()
|
||||
|
||||
> Compute the dot product between two numeric arrays, returning a scalar. Extra elements are ignored.
|
||||
Compute the dot product between two numeric arrays, returning a scalar. Extra elements are ignored.
|
||||
|
||||
```
|
||||
function dot()
|
||||
```
|
||||
|
||||
## project()
|
||||
|
||||
## project
|
||||
Project one vector onto another, returning a new array of the same dimension.
|
||||
|
||||
> Project one vector onto another, returning a new array of the same dimension.
|
||||
|
||||
```
|
||||
function project()
|
||||
```
|
||||
## rotate()
|
||||
|
||||
Rotate a 2D point (or array of length 2) by the given angle (in turns) around an optional pivot.
|
||||
|
||||
## rotate
|
||||
|
||||
> Rotate a 2D point (or array of length 2) by the given angle (in turns) around an optional pivot.
|
||||
## midpoint()
|
||||
|
||||
```
|
||||
function rotate()
|
||||
```
|
||||
Compute the midpoint of two arrays of numbers. Only the first two entries are used if 2D is intended.
|
||||
|
||||
|
||||
## midpoint
|
||||
## reflect()
|
||||
|
||||
> Compute the midpoint of two arrays of numbers. Only the first two entries are used if 2D is intended.
|
||||
Reflect a vector across a plane normal. Both arguments must be numeric arrays.
|
||||
|
||||
```
|
||||
function midpoint()
|
||||
```
|
||||
|
||||
## distance()
|
||||
|
||||
## reflect
|
||||
Compute the Euclidean distance between two numeric arrays of matching length.
|
||||
|
||||
> Reflect a vector across a plane normal. Both arguments must be numeric arrays.
|
||||
|
||||
```
|
||||
function reflect()
|
||||
```
|
||||
## direction()
|
||||
|
||||
Compute the normalized direction vector from the first array to the second.
|
||||
|
||||
## distance
|
||||
|
||||
> Compute the Euclidean distance between two numeric arrays of matching length.
|
||||
## angle()
|
||||
|
||||
```
|
||||
function distance()
|
||||
```
|
||||
Given a 2D vector, return its angle from the X-axis in radians or some chosen units.
|
||||
|
||||
|
||||
## direction
|
||||
## norm()
|
||||
|
||||
> Compute the normalized direction vector from the first array to the second.
|
||||
Return a normalized copy of the given numeric array. For 2D/3D/4D or arbitrary length.
|
||||
|
||||
```
|
||||
function direction()
|
||||
```
|
||||
|
||||
## angle_between()
|
||||
|
||||
## angle
|
||||
Compute the angle between two vectors (2D/3D/4D).
|
||||
|
||||
> Given a 2D vector, return its angle from the X-axis in radians or some chosen units.
|
||||
|
||||
```
|
||||
function angle()
|
||||
```
|
||||
## lerp()
|
||||
|
||||
Linear interpolation between two numbers: lerp(a, b, t).
|
||||
|
||||
## norm
|
||||
|
||||
> Return a normalized copy of the given numeric array. For 2D/3D/4D or arbitrary length.
|
||||
## gcd()
|
||||
|
||||
```
|
||||
function norm()
|
||||
```
|
||||
Compute the greatest common divisor of two integers.
|
||||
|
||||
|
||||
## angle_between
|
||||
## lcm()
|
||||
|
||||
> Compute the angle between two vectors (2D/3D/4D).
|
||||
Compute the least common multiple of two integers.
|
||||
|
||||
```
|
||||
function angle_between()
|
||||
```
|
||||
|
||||
## clamp()
|
||||
|
||||
## lerp
|
||||
Clamp a number between low and high. clamp(value, low, high).
|
||||
|
||||
> Linear interpolation between two numbers: lerp(a, b, t).
|
||||
|
||||
```
|
||||
function lerp()
|
||||
```
|
||||
## angledist()
|
||||
|
||||
Compute the signed distance between two angles in 'turn' units, e.g. 0..1 range.
|
||||
|
||||
## gcd
|
||||
|
||||
> Compute the greatest common divisor of two integers.
|
||||
## jitter()
|
||||
|
||||
```
|
||||
function gcd()
|
||||
```
|
||||
Apply a random +/- percentage noise to a number. Example: jitter(100, 0.05) -> ~95..105.
|
||||
|
||||
|
||||
## lcm
|
||||
## mean()
|
||||
|
||||
> Compute the least common multiple of two integers.
|
||||
Compute the arithmetic mean of an array of numbers.
|
||||
|
||||
```
|
||||
function lcm()
|
||||
```
|
||||
|
||||
## sum()
|
||||
|
||||
## clamp
|
||||
Sum all elements of an array of numbers.
|
||||
|
||||
> Clamp a number between low and high. clamp(value, low, high).
|
||||
|
||||
```
|
||||
function clamp()
|
||||
```
|
||||
## sigma()
|
||||
|
||||
Compute standard deviation of an array of numbers.
|
||||
|
||||
## angledist
|
||||
|
||||
> Compute the signed distance between two angles in 'turn' units, e.g. 0..1 range.
|
||||
## median()
|
||||
|
||||
```
|
||||
function angledist()
|
||||
```
|
||||
Compute the median of an array of numbers.
|
||||
|
||||
|
||||
## jitter
|
||||
## length()
|
||||
|
||||
> Apply a random +/- percentage noise to a number. Example: jitter(100, 0.05) -> ~95..105.
|
||||
Return the length of a vector (i.e. sqrt of sum of squares).
|
||||
|
||||
```
|
||||
function jitter()
|
||||
```
|
||||
|
||||
## from_to()
|
||||
|
||||
## mean
|
||||
Return an array of points from a start to an end, spaced out by a certain distance.
|
||||
|
||||
> Compute the arithmetic mean of an array of numbers.
|
||||
|
||||
```
|
||||
function mean()
|
||||
```
|
||||
## rand()
|
||||
|
||||
Return a random float in [0,1).
|
||||
|
||||
## sum
|
||||
|
||||
> Sum all elements of an array of numbers.
|
||||
## randi()
|
||||
|
||||
```
|
||||
function sum()
|
||||
```
|
||||
Return a random 32-bit integer.
|
||||
|
||||
|
||||
## sigma
|
||||
## srand()
|
||||
|
||||
> Compute standard deviation of an array of numbers.
|
||||
|
||||
```
|
||||
function sigma()
|
||||
```
|
||||
|
||||
|
||||
## median
|
||||
|
||||
> Compute the median of an array of numbers.
|
||||
|
||||
```
|
||||
function median()
|
||||
```
|
||||
|
||||
|
||||
## length
|
||||
|
||||
> Return the length of a vector (i.e. sqrt of sum of squares).
|
||||
|
||||
```
|
||||
function length()
|
||||
```
|
||||
|
||||
|
||||
## from_to
|
||||
|
||||
> Return an array of points from a start to an end, spaced out by a certain distance.
|
||||
|
||||
```
|
||||
function from_to()
|
||||
```
|
||||
|
||||
|
||||
## rand
|
||||
|
||||
> Return a random float in [0,1).
|
||||
|
||||
```
|
||||
function rand()
|
||||
```
|
||||
|
||||
|
||||
## randi
|
||||
|
||||
> Return a random 32-bit integer.
|
||||
|
||||
```
|
||||
function randi()
|
||||
```
|
||||
|
||||
|
||||
## srand
|
||||
|
||||
> Seed the random number generator with the given integer, or with current time if none.
|
||||
|
||||
```
|
||||
function srand()
|
||||
```
|
||||
Seed the random number generator with the given integer, or with current time if none.
|
||||
|
||||
|
||||
## TAU
|
||||
|
||||
|
||||
## deg2rad
|
||||
|
||||
```
|
||||
function deg2rad(deg)
|
||||
```
|
||||
## deg2rad(deg)
|
||||
|
||||
|
||||
## rad2deg
|
||||
|
||||
```
|
||||
function rad2deg(rad)
|
||||
```
|
||||
## rad2deg(rad)
|
||||
|
||||
|
||||
## turn2rad
|
||||
|
||||
```
|
||||
function turn2rad(x)
|
||||
```
|
||||
## turn2rad(x)
|
||||
|
||||
|
||||
## rad2turn
|
||||
|
||||
```
|
||||
function rad2turn(x)
|
||||
```
|
||||
## rad2turn(x)
|
||||
|
||||
|
||||
## turn2deg
|
||||
|
||||
```
|
||||
function turn2deg(x)
|
||||
```
|
||||
## turn2deg(x)
|
||||
|
||||
|
||||
## deg2turn
|
||||
|
||||
```
|
||||
function deg2turn(x)
|
||||
```
|
||||
## deg2turn(x)
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
# nota
|
||||
#### encode()
|
||||
|
||||
|
||||
|
||||
#### decode()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# notifypanel
|
||||
#### title
|
||||
**string**
|
||||
|
||||
|
||||
|
||||
#### msg
|
||||
**string**
|
||||
|
||||
|
||||
|
||||
#### action()
|
||||
|
||||
|
||||
|
||||
#### guibody()
|
||||
|
||||
|
||||
|
||||
|
||||
202
docs/api/os.md
202
docs/api/os.md
@@ -1,226 +1,126 @@
|
||||
# os Module
|
||||
# os
|
||||
|
||||
## make_transform
|
||||
## make_transform()
|
||||
|
||||
> Create a new transform object that can be used for 2D/3D positioning, scaling, and rotation.
|
||||
Create a new transform object that can be used for 2D/3D positioning, scaling, and rotation.
|
||||
|
||||
```
|
||||
function make_transform()
|
||||
```
|
||||
|
||||
## clean_transforms()
|
||||
|
||||
## clean_transforms
|
||||
Force an update on all transforms to remove dangling references or perform house-keeping.
|
||||
|
||||
> Force an update on all transforms to remove dangling references or perform house-keeping.
|
||||
|
||||
```
|
||||
function clean_transforms()
|
||||
```
|
||||
## platform()
|
||||
|
||||
Return a string with the underlying platform name, like 'Windows', 'Linux', or 'macOS'.
|
||||
|
||||
## platform
|
||||
|
||||
> Return a string with the underlying platform name, like 'Windows', 'Linux', or 'macOS'.
|
||||
## arch()
|
||||
|
||||
```
|
||||
function platform()
|
||||
```
|
||||
Return the CPU architecture string for this system (e.g. 'x64', 'arm64').
|
||||
|
||||
|
||||
## arch
|
||||
## totalmem()
|
||||
|
||||
> Return the CPU architecture string for this system (e.g. 'x64', 'arm64').
|
||||
Return the total system RAM in bytes.
|
||||
|
||||
```
|
||||
function arch()
|
||||
```
|
||||
|
||||
## freemem()
|
||||
|
||||
## totalmem
|
||||
Return the amount of free system RAM in bytes, if known.
|
||||
|
||||
> Return the total system RAM in bytes.
|
||||
|
||||
```
|
||||
function totalmem()
|
||||
```
|
||||
## hostname()
|
||||
|
||||
Return the system's hostname, or an empty string if not available.
|
||||
|
||||
## freemem
|
||||
|
||||
> Return the amount of free system RAM in bytes, if known.
|
||||
## version()
|
||||
|
||||
```
|
||||
function freemem()
|
||||
```
|
||||
Return the OS or kernel version string, if the platform provides it.
|
||||
|
||||
|
||||
## hostname
|
||||
## kill()
|
||||
|
||||
> Return the system's hostname, or an empty string if not available.
|
||||
Send a signal (e.g., 'SIGINT', 'SIGTERM', etc.) to the current process.
|
||||
|
||||
```
|
||||
function hostname()
|
||||
```
|
||||
|
||||
## exit()
|
||||
|
||||
## version
|
||||
Exit the application with the specified exit code.
|
||||
|
||||
> Return the OS or kernel version string, if the platform provides it.
|
||||
|
||||
```
|
||||
function version()
|
||||
```
|
||||
## now()
|
||||
|
||||
Return current time (in seconds as a float) with high resolution.
|
||||
|
||||
## kill
|
||||
|
||||
> Send a signal (e.g., 'SIGINT', 'SIGTERM', etc.) to the current process.
|
||||
## openurl()
|
||||
|
||||
```
|
||||
function kill()
|
||||
```
|
||||
Open the provided URL in the default web browser, if possible.
|
||||
|
||||
|
||||
## exit
|
||||
## make_timer()
|
||||
|
||||
> Exit the application with the specified exit code.
|
||||
Create a new timer object that will call a specified function after a certain delay.
|
||||
|
||||
```
|
||||
function exit()
|
||||
```
|
||||
|
||||
## update_timers()
|
||||
|
||||
## now
|
||||
Advance all timers by the provided time delta (in seconds).
|
||||
|
||||
> Return current time (in seconds as a float) with high resolution.
|
||||
|
||||
```
|
||||
function now()
|
||||
```
|
||||
## sleep()
|
||||
|
||||
Block execution for the specified number of seconds.
|
||||
|
||||
## openurl
|
||||
|
||||
> Open the provided URL in the default web browser, if possible.
|
||||
## battery_pct()
|
||||
|
||||
```
|
||||
function openurl()
|
||||
```
|
||||
Return the battery level (percentage) or negative if unknown.
|
||||
|
||||
|
||||
## make_timer
|
||||
## battery_voltage()
|
||||
|
||||
> Create a new timer object that will call a specified function after a certain delay.
|
||||
Return the current battery voltage in volts, if available.
|
||||
|
||||
```
|
||||
function make_timer()
|
||||
```
|
||||
|
||||
## battery_seconds()
|
||||
|
||||
## update_timers
|
||||
Return the estimated remaining battery time in seconds, or negative if unknown.
|
||||
|
||||
> Advance all timers by the provided time delta (in seconds).
|
||||
|
||||
```
|
||||
function update_timers()
|
||||
```
|
||||
## power_state()
|
||||
|
||||
Return a string describing power status: 'on battery', 'charging', 'charged', etc.
|
||||
|
||||
## sleep
|
||||
|
||||
> Block execution for the specified number of seconds.
|
||||
## on()
|
||||
|
||||
```
|
||||
function sleep()
|
||||
```
|
||||
Register a global callback for certain engine-wide or system-level events.
|
||||
|
||||
|
||||
## battery_pct
|
||||
## rt_info()
|
||||
|
||||
> Return the battery level (percentage) or negative if unknown.
|
||||
Return internal QuickJS runtime info, such as object counts.
|
||||
|
||||
```
|
||||
function battery_pct()
|
||||
```
|
||||
|
||||
## rusage()
|
||||
|
||||
## battery_voltage
|
||||
Return resource usage stats for this process, if the platform supports it.
|
||||
|
||||
> Return the current battery voltage in volts, if available.
|
||||
|
||||
```
|
||||
function battery_voltage()
|
||||
```
|
||||
## mallinfo()
|
||||
|
||||
Return detailed memory allocation info (arena size, free blocks, etc.) on some platforms.
|
||||
|
||||
## battery_seconds
|
||||
|
||||
> Return the estimated remaining battery time in seconds, or negative if unknown.
|
||||
## env()
|
||||
|
||||
```
|
||||
function battery_seconds()
|
||||
```
|
||||
Fetch the value of a given environment variable, or undefined if it doesn't exist.
|
||||
|
||||
|
||||
## power_state
|
||||
## system()
|
||||
|
||||
> Return a string describing power status: 'on battery', 'charging', 'charged', etc.
|
||||
|
||||
```
|
||||
function power_state()
|
||||
```
|
||||
|
||||
|
||||
## on
|
||||
|
||||
> Register a global callback for certain engine-wide or system-level events.
|
||||
|
||||
```
|
||||
function on()
|
||||
```
|
||||
|
||||
|
||||
## rt_info
|
||||
|
||||
> Return internal QuickJS runtime info, such as object counts.
|
||||
|
||||
```
|
||||
function rt_info()
|
||||
```
|
||||
|
||||
|
||||
## rusage
|
||||
|
||||
> Return resource usage stats for this process, if the platform supports it.
|
||||
|
||||
```
|
||||
function rusage()
|
||||
```
|
||||
|
||||
|
||||
## mallinfo
|
||||
|
||||
> Return detailed memory allocation info (arena size, free blocks, etc.) on some platforms.
|
||||
|
||||
```
|
||||
function mallinfo()
|
||||
```
|
||||
|
||||
|
||||
## env
|
||||
|
||||
> Fetch the value of a given environment variable, or undefined if it doesn't exist.
|
||||
|
||||
```
|
||||
function env()
|
||||
```
|
||||
|
||||
|
||||
## system
|
||||
|
||||
> Execute a shell command using the system() call. Returns the command's exit code.
|
||||
|
||||
```
|
||||
function system()
|
||||
```
|
||||
Execute a shell command using the system() call. Returns the command's exit code.
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
# performance
|
||||
#### barecall()
|
||||
|
||||
|
||||
|
||||
#### unpack_num()
|
||||
|
||||
|
||||
|
||||
#### unpack_array()
|
||||
|
||||
|
||||
|
||||
#### pack_num()
|
||||
|
||||
|
||||
|
||||
#### pack_string()
|
||||
|
||||
|
||||
|
||||
#### unpack_string()
|
||||
|
||||
|
||||
|
||||
#### unpack_32farr()
|
||||
|
||||
|
||||
|
||||
#### call_fn_n()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
at <anonymous> (scripts/engine.js:198)
|
||||
at <eval> (C eval)
|
||||
at get iterations (native)
|
||||
at <anonymous> (scripts/debug.js:185)
|
||||
at <anonymous> (scripts/debug.js:223)
|
||||
at <anonymous> (scripts/std.js:385)
|
||||
at cmd_args (scripts/std.js:458)
|
||||
at <eval> (C eval)
|
||||
|
||||
USE REPORT
|
||||
scripts/base.js 5.646 ms
|
||||
scripts/render.js 1.282 ms
|
||||
scripts/debug.js 598.0 us
|
||||
scripts/input.js 1.005 ms
|
||||
scripts/std.js 1.606 ms
|
||||
scripts/diff.js 214.2 us
|
||||
scripts/color.js 989.1 us
|
||||
scripts/gui.js 931.0 us
|
||||
scripts/tween.js 631.2 us
|
||||
scripts/ai.js 130.4 us
|
||||
scripts/physics.js 100.2 us
|
||||
scripts/geometry.js 186.1 us
|
||||
scripts/spline.js 286.5 us
|
||||
scripts/components.js 2.147 ms
|
||||
scripts/actor.js 236.0 us
|
||||
scripts/entity.js 2.627 ms
|
||||
scripts/widget.js 496.0 us
|
||||
scripts/mum.js 75.69 us
|
||||
scripts/editor.js 18.19 ms
|
||||
|
||||
ENTITY REPORT
|
||||
|
||||
scripts/engine.js:501: [2024-07-03 12:13:09] [22;36minfo[0m, script: QUITTING
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:195: [2024-07-03 12:13:10] [22;33mwarn[0m, script: Cannot print the API of 'physlag', as it was not found.
|
||||
@@ -1,68 +0,0 @@
|
||||
# player
|
||||
#### 0
|
||||
**object**
|
||||
|
||||
[object Object]
|
||||
|
||||
#### 1
|
||||
**object**
|
||||
|
||||
[object Object]
|
||||
|
||||
#### 2
|
||||
**object**
|
||||
|
||||
[object Object]
|
||||
|
||||
#### 3
|
||||
**object**
|
||||
|
||||
[object Object]
|
||||
|
||||
#### players
|
||||
**array**
|
||||
|
||||
A list of current players.
|
||||
|
||||
#### input(fn, ...args)
|
||||
|
||||
|
||||
|
||||
#### mouse_input(type, ...args)
|
||||
|
||||
|
||||
|
||||
#### char_input(c)
|
||||
|
||||
|
||||
|
||||
#### raw_input(cmd, state, ...args)
|
||||
|
||||
|
||||
|
||||
#### obj_controlled(obj)
|
||||
|
||||
|
||||
|
||||
#### print_pawns()
|
||||
|
||||
Print out a list of the current pawn control stack.
|
||||
|
||||
#### create()
|
||||
|
||||
|
||||
|
||||
#### pawns
|
||||
**array**
|
||||
|
||||
[]
|
||||
|
||||
#### control(pawn)
|
||||
|
||||
Control a provided object, if the object has an 'inputs' object.
|
||||
|
||||
#### uncontrol(pawn)
|
||||
|
||||
Uncontrol a previously controlled object.
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
at <anonymous> (scripts/engine.js:198)
|
||||
at <eval> (C eval)
|
||||
at get radius (native)
|
||||
at <anonymous> (scripts/debug.js:185)
|
||||
at <anonymous> (scripts/debug.js:223)
|
||||
at <anonymous> (scripts/std.js:385)
|
||||
at cmd_args (scripts/std.js:458)
|
||||
at <eval> (C eval)
|
||||
|
||||
USE REPORT
|
||||
scripts/base.js 5.789 ms
|
||||
scripts/render.js 2.126 ms
|
||||
scripts/debug.js 709.5 us
|
||||
scripts/input.js 1.222 ms
|
||||
scripts/std.js 1.344 ms
|
||||
scripts/diff.js 233.6 us
|
||||
scripts/color.js 1.017 ms
|
||||
scripts/gui.js 747.8 us
|
||||
scripts/tween.js 625.2 us
|
||||
scripts/ai.js 173.2 us
|
||||
scripts/physics.js 124.2 us
|
||||
scripts/geometry.js 221.7 us
|
||||
scripts/spline.js 321.3 us
|
||||
scripts/components.js 2.191 ms
|
||||
scripts/actor.js 230.6 us
|
||||
scripts/entity.js 4.996 ms
|
||||
scripts/widget.js 607.5 us
|
||||
scripts/mum.js 94.18 us
|
||||
scripts/editor.js 22.40 ms
|
||||
|
||||
ENTITY REPORT
|
||||
|
||||
scripts/engine.js:501: [2024-07-03 12:13:09] [22;36minfo[0m, script: QUITTING
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:11] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:10] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1,136 +0,0 @@
|
||||
# profcache
|
||||
#### scripts/base.js
|
||||
**array**
|
||||
|
||||
[
|
||||
5509269
|
||||
]
|
||||
|
||||
#### scripts/render.js
|
||||
**array**
|
||||
|
||||
[
|
||||
1371390
|
||||
]
|
||||
|
||||
#### scripts/debug.js
|
||||
**array**
|
||||
|
||||
[
|
||||
590951
|
||||
]
|
||||
|
||||
#### scripts/input.js
|
||||
**array**
|
||||
|
||||
[
|
||||
1101579
|
||||
]
|
||||
|
||||
#### scripts/std.js
|
||||
**array**
|
||||
|
||||
[
|
||||
1516994
|
||||
]
|
||||
|
||||
#### scripts/diff.js
|
||||
**array**
|
||||
|
||||
[
|
||||
242594
|
||||
]
|
||||
|
||||
#### scripts/color.js
|
||||
**array**
|
||||
|
||||
[
|
||||
1054188
|
||||
]
|
||||
|
||||
#### scripts/gui.js
|
||||
**array**
|
||||
|
||||
[
|
||||
706472
|
||||
]
|
||||
|
||||
#### scripts/tween.js
|
||||
**array**
|
||||
|
||||
[
|
||||
518110
|
||||
]
|
||||
|
||||
#### scripts/ai.js
|
||||
**array**
|
||||
|
||||
[
|
||||
129610
|
||||
]
|
||||
|
||||
#### scripts/physics.js
|
||||
**array**
|
||||
|
||||
[
|
||||
168777,
|
||||
32773
|
||||
]
|
||||
|
||||
#### scripts/geometry.js
|
||||
**array**
|
||||
|
||||
[
|
||||
216535
|
||||
]
|
||||
|
||||
#### scripts/spline.js
|
||||
**array**
|
||||
|
||||
[
|
||||
284937
|
||||
]
|
||||
|
||||
#### scripts/components.js
|
||||
**array**
|
||||
|
||||
[
|
||||
1904302
|
||||
]
|
||||
|
||||
#### scripts/actor.js
|
||||
**array**
|
||||
|
||||
[
|
||||
196303
|
||||
]
|
||||
|
||||
#### scripts/entity.js
|
||||
**array**
|
||||
|
||||
[
|
||||
2293362
|
||||
]
|
||||
|
||||
#### scripts/widget.js
|
||||
**array**
|
||||
|
||||
[
|
||||
524872
|
||||
]
|
||||
|
||||
#### scripts/mum.js
|
||||
**array**
|
||||
|
||||
[
|
||||
81892
|
||||
]
|
||||
|
||||
#### scripts/editor.js
|
||||
**array**
|
||||
|
||||
[
|
||||
17107128
|
||||
]
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
# profile
|
||||
#### now()
|
||||
|
||||
|
||||
|
||||
#### best_t(t)
|
||||
|
||||
|
||||
|
||||
#### report(start, msg = "[undefined report]")
|
||||
|
||||
|
||||
|
||||
#### addreport(cache, line, start)
|
||||
|
||||
|
||||
|
||||
#### printreport(cache, name)
|
||||
|
||||
|
||||
|
||||
#### cpu(fn, times = 1, q = "unnamed")
|
||||
|
||||
|
||||
|
||||
#### ms(t)
|
||||
|
||||
|
||||
|
||||
#### secs(t)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
# prosperon
|
||||
#### phys2d_step()
|
||||
|
||||
|
||||
|
||||
#### window_render()
|
||||
|
||||
|
||||
|
||||
#### guid()
|
||||
|
||||
|
||||
|
||||
#### version
|
||||
**string**
|
||||
|
||||
|
||||
|
||||
#### revision
|
||||
**string**
|
||||
|
||||
|
||||
|
||||
#### semver
|
||||
**object**
|
||||
|
||||
Functions for semantic versioning numbers. Semantic versioning is given as a triple digit number, as MAJOR.MINOR.PATCH.
|
||||
|
||||
#### iconified(icon)
|
||||
|
||||
|
||||
|
||||
#### focus(focus)
|
||||
|
||||
|
||||
|
||||
#### resize(dimensions)
|
||||
|
||||
|
||||
|
||||
#### suspended(sus)
|
||||
|
||||
|
||||
|
||||
#### mouseenter()
|
||||
|
||||
|
||||
|
||||
#### mouseleave()
|
||||
|
||||
|
||||
|
||||
#### touchpress(touches)
|
||||
|
||||
|
||||
|
||||
#### touchrelease(touches)
|
||||
|
||||
|
||||
|
||||
#### touchmove(touches)
|
||||
|
||||
|
||||
|
||||
#### clipboardpaste(str)
|
||||
|
||||
|
||||
|
||||
#### quit()
|
||||
|
||||
|
||||
|
||||
#### keys
|
||||
**array**
|
||||
|
||||
[]
|
||||
|
||||
#### keydown(key, repeat)
|
||||
|
||||
|
||||
|
||||
#### keyup(key)
|
||||
|
||||
|
||||
|
||||
#### droppedfile(path)
|
||||
|
||||
|
||||
|
||||
#### textinput(c)
|
||||
|
||||
|
||||
|
||||
#### mousemove(pos, dx)
|
||||
|
||||
|
||||
|
||||
#### mousescroll(dx)
|
||||
|
||||
|
||||
|
||||
#### mousedown(b)
|
||||
|
||||
|
||||
|
||||
#### mouseup(b)
|
||||
|
||||
|
||||
|
||||
#### appupdate(...args)
|
||||
|
||||
|
||||
|
||||
#### update(...args)
|
||||
|
||||
|
||||
|
||||
#### physupdate(...args)
|
||||
|
||||
|
||||
|
||||
#### gui(...args)
|
||||
|
||||
|
||||
|
||||
#### debug(...args)
|
||||
|
||||
|
||||
|
||||
#### draw(...args)
|
||||
|
||||
|
||||
|
||||
#### screengui(...args)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# render Module
|
||||
# render
|
||||
|
||||
## _main
|
||||
|
||||
@@ -9,58 +9,26 @@
|
||||
## toggles
|
||||
|
||||
|
||||
## stencil_writer
|
||||
|
||||
```
|
||||
function stencil_writer(...args)
|
||||
```
|
||||
## stencil_writer(...args)
|
||||
|
||||
|
||||
## fillmask
|
||||
|
||||
```
|
||||
function fillmask(ref)
|
||||
```
|
||||
## fillmask(ref)
|
||||
|
||||
|
||||
## mask
|
||||
|
||||
```
|
||||
function mask(image, pos, scale, rotation = 0, ref = 1)
|
||||
```
|
||||
## mask(image, pos, scale, rotation = 0, ref = 1)
|
||||
|
||||
|
||||
## viewport
|
||||
|
||||
```
|
||||
function viewport(rect)
|
||||
```
|
||||
## viewport(rect)
|
||||
|
||||
|
||||
## scissor
|
||||
|
||||
```
|
||||
function scissor(rect)
|
||||
```
|
||||
## scissor(rect)
|
||||
|
||||
|
||||
## queue
|
||||
|
||||
```
|
||||
function queue(cmd)
|
||||
```
|
||||
## queue(cmd)
|
||||
|
||||
|
||||
## setup_draw
|
||||
|
||||
```
|
||||
function setup_draw()
|
||||
```
|
||||
## setup_draw()
|
||||
|
||||
|
||||
## setup_hud
|
||||
|
||||
```
|
||||
function setup_hud()
|
||||
```
|
||||
## setup_hud()
|
||||
|
||||
|
||||
31
docs/api/resources.md
Normal file
31
docs/api/resources.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# resources
|
||||
|
||||
## scripts
|
||||
|
||||
|
||||
## images
|
||||
|
||||
|
||||
## sounds
|
||||
|
||||
|
||||
## fonts
|
||||
|
||||
|
||||
## lib
|
||||
|
||||
|
||||
## canonical(file)
|
||||
|
||||
|
||||
## find_image(...args)
|
||||
|
||||
|
||||
## find_sound(...args)
|
||||
|
||||
|
||||
## find_script(...args)
|
||||
|
||||
|
||||
## find_font(...args)
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:12] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:10] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1,24 +0,0 @@
|
||||
# shape
|
||||
#### box(w,h)
|
||||
|
||||
|
||||
|
||||
#### sphere
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### circle
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### ngon(radius, n)
|
||||
|
||||
|
||||
|
||||
#### arc(radius, angle, n, start = 0)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
# sim
|
||||
#### mode
|
||||
**string**
|
||||
|
||||
|
||||
|
||||
#### play()
|
||||
|
||||
|
||||
|
||||
#### playing()
|
||||
|
||||
|
||||
|
||||
#### pause()
|
||||
|
||||
|
||||
|
||||
#### paused()
|
||||
|
||||
|
||||
|
||||
#### step()
|
||||
|
||||
|
||||
|
||||
#### stepping()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,32 +1,16 @@
|
||||
# sound Module
|
||||
# sound
|
||||
|
||||
## undefined
|
||||
|
||||
|
||||
## pcm
|
||||
|
||||
```
|
||||
function pcm(file)
|
||||
```
|
||||
## pcm(file)
|
||||
|
||||
|
||||
## play
|
||||
|
||||
```
|
||||
function play(file)
|
||||
```
|
||||
## play(file)
|
||||
|
||||
|
||||
## cry
|
||||
|
||||
```
|
||||
function cry(file)
|
||||
```
|
||||
## cry(file)
|
||||
|
||||
|
||||
## music
|
||||
|
||||
```
|
||||
function music(file, fade = 0.5)
|
||||
```
|
||||
## music(file, fade = 0.5)
|
||||
|
||||
|
||||
11
docs/api/spline.md
Normal file
11
docs/api/spline.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# spline
|
||||
|
||||
## catmull()
|
||||
|
||||
Perform Catmull-Rom spline sampling on an array of 2D points, returning an array of samples.
|
||||
|
||||
|
||||
## bezier()
|
||||
|
||||
Perform a Bezier spline (or catmull) sampling on 2D points, returning an array of sampled points.
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
# steam
|
||||
#### init()
|
||||
|
||||
|
||||
|
||||
#### achievements
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### app
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### cloud
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
at <anonymous> (scripts/engine.js:198)
|
||||
at <eval> (C eval)
|
||||
at get width (native)
|
||||
at <anonymous> (scripts/debug.js:185)
|
||||
at <anonymous> (scripts/debug.js:223)
|
||||
at <anonymous> (scripts/std.js:385)
|
||||
at cmd_args (scripts/std.js:458)
|
||||
at <eval> (C eval)
|
||||
|
||||
USE REPORT
|
||||
scripts/base.js 5.249 ms
|
||||
scripts/render.js 1.376 ms
|
||||
scripts/debug.js 583.5 us
|
||||
scripts/input.js 1.117 ms
|
||||
scripts/std.js 1.244 ms
|
||||
scripts/diff.js 212.4 us
|
||||
scripts/color.js 974.6 us
|
||||
scripts/gui.js 772.7 us
|
||||
scripts/tween.js 592.2 us
|
||||
scripts/ai.js 180.3 us
|
||||
scripts/physics.js 129.8 us
|
||||
scripts/geometry.js 244.5 us
|
||||
scripts/spline.js 308.4 us
|
||||
scripts/components.js 1.976 ms
|
||||
scripts/actor.js 224.7 us
|
||||
scripts/entity.js 2.333 ms
|
||||
scripts/widget.js 517.9 us
|
||||
scripts/mum.js 80.06 us
|
||||
scripts/editor.js 19.23 ms
|
||||
|
||||
ENTITY REPORT
|
||||
|
||||
scripts/engine.js:501: [2024-07-03 12:13:10] [22;36minfo[0m, script: QUITTING
|
||||
@@ -1,58 +1,30 @@
|
||||
# time Module
|
||||
# time
|
||||
|
||||
## now
|
||||
## now()
|
||||
|
||||
> Return the current system time as a floating-point number of seconds with microsecond precision.
|
||||
|
||||
```
|
||||
function now()
|
||||
```
|
||||
Return the current system time as a floating-point number of seconds with microsecond precision.
|
||||
|
||||
|
||||
## computer_dst
|
||||
## computer_dst()
|
||||
|
||||
> Return true if the local system time is currently in Daylight Savings Time, otherwise false.
|
||||
|
||||
```
|
||||
function computer_dst()
|
||||
```
|
||||
Return true if the local system time is currently in Daylight Savings Time, otherwise false.
|
||||
|
||||
|
||||
## computer_zone
|
||||
## computer_zone()
|
||||
|
||||
> Return the local time zone offset from UTC in hours, e.g. -5 for EST.
|
||||
|
||||
```
|
||||
function computer_zone()
|
||||
```
|
||||
Return the local time zone offset from UTC in hours, e.g. -5 for EST.
|
||||
|
||||
|
||||
## hour2minute
|
||||
|
||||
```
|
||||
function hour2minute()
|
||||
```
|
||||
## hour2minute()
|
||||
|
||||
|
||||
## day2hour
|
||||
|
||||
```
|
||||
function day2hour()
|
||||
```
|
||||
## day2hour()
|
||||
|
||||
|
||||
## minute2second
|
||||
|
||||
```
|
||||
function minute2second()
|
||||
```
|
||||
## minute2second()
|
||||
|
||||
|
||||
## week2day
|
||||
|
||||
```
|
||||
function week2day()
|
||||
```
|
||||
## week2day()
|
||||
|
||||
|
||||
## strparse
|
||||
@@ -85,25 +57,13 @@ function week2day()
|
||||
## epoch
|
||||
|
||||
|
||||
## isleap
|
||||
|
||||
```
|
||||
function isleap(year)
|
||||
```
|
||||
## isleap(year)
|
||||
|
||||
|
||||
## yearsize
|
||||
|
||||
```
|
||||
function yearsize(y)
|
||||
```
|
||||
## yearsize(y)
|
||||
|
||||
|
||||
## timecode
|
||||
|
||||
```
|
||||
function timecode(t, fps = 24)
|
||||
```
|
||||
## timecode(t, fps = 24)
|
||||
|
||||
|
||||
## monthdays
|
||||
@@ -112,26 +72,14 @@ function timecode(t, fps = 24)
|
||||
## zones
|
||||
|
||||
|
||||
## record
|
||||
|
||||
```
|
||||
function record(num, zone = this.computer_zone()
|
||||
```
|
||||
## record(num, zone = this.computer_zone()
|
||||
|
||||
|
||||
## number
|
||||
|
||||
```
|
||||
function number(rec)
|
||||
```
|
||||
## number(rec)
|
||||
|
||||
|
||||
## fmt
|
||||
|
||||
|
||||
## text
|
||||
|
||||
```
|
||||
function text(num, fmt = this.fmt, zone)
|
||||
```
|
||||
## text(num, fmt = this.fmt, zone)
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
# timer
|
||||
#### update(dt)
|
||||
|
||||
|
||||
|
||||
#### kill()
|
||||
|
||||
|
||||
|
||||
#### delay(fn, secs)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# tween Module
|
||||
# tween
|
||||
|
||||
## Tween
|
||||
|
||||
@@ -6,9 +6,5 @@
|
||||
## Ease
|
||||
|
||||
|
||||
## tween
|
||||
|
||||
```
|
||||
function tween(from, to, time, fn, cb)
|
||||
```
|
||||
## tween(from, to, time, fn, cb)
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:195: [2024-07-03 12:13:14] [22;33mwarn[0m, script: Cannot print the API of 'undefined', as it was not found.
|
||||
@@ -1,20 +0,0 @@
|
||||
# ur
|
||||
#### _list
|
||||
**array**
|
||||
|
||||
[
|
||||
"camera2d",
|
||||
"sprite"
|
||||
]
|
||||
|
||||
#### camera2d
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
#### sprite
|
||||
**object**
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:10] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1,103 +1,47 @@
|
||||
# util Module
|
||||
# util
|
||||
|
||||
## guid
|
||||
## guid()
|
||||
|
||||
> Return a random 32-character hexadecimal UUID-like string.
|
||||
|
||||
```
|
||||
function guid()
|
||||
```
|
||||
Return a random 32-character hexadecimal UUID-like string.
|
||||
|
||||
|
||||
## insertion_sort
|
||||
## insertion_sort()
|
||||
|
||||
> In-place insertion sort of an array using a comparison function cmp(a,b)->Number.
|
||||
|
||||
```
|
||||
function insertion_sort()
|
||||
```
|
||||
In-place insertion sort of an array using a comparison function cmp(a,b)->Number.
|
||||
|
||||
|
||||
## deepfreeze
|
||||
|
||||
```
|
||||
function deepfreeze(obj)
|
||||
```
|
||||
## deepfreeze(obj)
|
||||
|
||||
|
||||
## dainty_assign
|
||||
|
||||
```
|
||||
function dainty_assign(target, source)
|
||||
```
|
||||
## dainty_assign(target, source)
|
||||
|
||||
|
||||
## get
|
||||
|
||||
```
|
||||
function get(obj, path, defValue)
|
||||
```
|
||||
## get(obj, path, defValue)
|
||||
|
||||
|
||||
## isObject
|
||||
|
||||
```
|
||||
function isObject(o)
|
||||
```
|
||||
## isObject(o)
|
||||
|
||||
|
||||
## isEmpty
|
||||
|
||||
```
|
||||
function isEmpty(o)
|
||||
```
|
||||
## isEmpty(o)
|
||||
|
||||
|
||||
## dig
|
||||
|
||||
```
|
||||
function dig(obj, path, def = {})
|
||||
```
|
||||
## dig(obj, path, def = {})
|
||||
|
||||
|
||||
## access
|
||||
|
||||
```
|
||||
function access(obj, name)
|
||||
```
|
||||
## access(obj, name)
|
||||
|
||||
|
||||
## mergekey
|
||||
|
||||
```
|
||||
function mergekey(o1, o2, k)
|
||||
```
|
||||
## mergekey(o1, o2, k)
|
||||
|
||||
|
||||
## merge
|
||||
|
||||
```
|
||||
function merge(target, ...objs)
|
||||
```
|
||||
## merge(target, ...objs)
|
||||
|
||||
|
||||
## copy
|
||||
|
||||
```
|
||||
function copy(proto, ...objs)
|
||||
```
|
||||
## copy(proto, ...objs)
|
||||
|
||||
|
||||
## obj_lerp
|
||||
|
||||
```
|
||||
function obj_lerp(a,b,t)
|
||||
```
|
||||
## obj_lerp(a,b,t)
|
||||
|
||||
|
||||
## normalizeSpacing
|
||||
|
||||
```
|
||||
function normalizeSpacing(spacing)
|
||||
```
|
||||
## normalizeSpacing(spacing)
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
# video Module
|
||||
# video
|
||||
|
||||
## make_video
|
||||
## make_video()
|
||||
|
||||
> Decode a video file (MPEG, etc.) from an ArrayBuffer, returning a datastream object.
|
||||
|
||||
```
|
||||
function make_video()
|
||||
```
|
||||
Decode a video file (MPEG, etc.) from an ArrayBuffer, returning a datastream object.
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# window
|
||||
#### size
|
||||
**array**
|
||||
|
||||
[
|
||||
500,
|
||||
500
|
||||
]
|
||||
|
||||
#### mode
|
||||
**string**
|
||||
|
||||
|
||||
|
||||
#### editor
|
||||
**boolean**
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
scripts/debug.js:205: [2024-07-03 12:13:10] [22;33mwarn[0m, script: Cannot print the API of something that isn't an object.
|
||||
@@ -1,6 +0,0 @@
|
||||
# yaml
|
||||
#### tojson(yaml)
|
||||
|
||||
|
||||
|
||||
|
||||
19
docs/dull.md
Normal file
19
docs/dull.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Dull
|
||||
|
||||
The language is dubbed "dull". Dull, because it is a less featureful ES6. Where does it differ from ES6?
|
||||
|
||||
- No 'with'
|
||||
- No 'eval'
|
||||
- No promises, async, await, generators ...
|
||||
- Names can include any character
|
||||
- Automatic tail call optimization
|
||||
- No class syntax, at all
|
||||
- No null; only undefined
|
||||
- No import/export syntax; 'use' instead
|
||||
- No proxies
|
||||
- Strings demarked with "" or `` only; ' is reserved for symbols, akin to scheme. 'ok is shorthand for Symbol.for("ok")
|
||||
|
||||
Eventually, it could be JIT'd, but another trait of dull is that it is easy to integrate C code into.
|
||||
|
||||
Dull is based on Javascript, and has C-like syntax, because that makes it trivial to push code from it into a real C file. Numerous times I've been able to nearly copy and paste some dull code into a C file and get an immediate 50x speed improvement.
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Physics
|
||||
Prospeorn comes with the [[https://chipmunk-physics.net][Chipmunk]] physics engine built in. It is a fast, stable physics solution. All entities are assumed to be physics based objects, and components can be added to them to enable more physics features.
|
||||
@@ -1,9 +0,0 @@
|
||||
# Profiling
|
||||
|
||||
There are a handful of profiling methods available to you.
|
||||
|
||||
## Frame by frame profile
|
||||
|
||||
## Cpu instrumentation
|
||||
|
||||
## Game stats
|
||||
@@ -1,16 +0,0 @@
|
||||
# Getting Started
|
||||
|
||||
## Installation
|
||||
### Linux & MacOS
|
||||
Install the most [[https://prosperon.dev/download][recent binaries]] into your `$PATH`.
|
||||
|
||||
### Windows
|
||||
Copy the executable into any folder and run it. If no game is deteced, it scaffolds for you.
|
||||
|
||||
### Building
|
||||
You will need `sokol-shdc` in the top of your directory. Then, `make shaders` and `make`. The command `make install` copies it to your home's `.bin` path.
|
||||
|
||||
## Playing your first game
|
||||
Download any of the completed example projects. Run `prosperon play` in the folder.
|
||||
|
||||
Poke around the example projects. You will find it refreshingly straight forward.
|
||||
@@ -1,4 +1,6 @@
|
||||
# TERMINOLOGY
|
||||
# Graphics drawing
|
||||
|
||||
## Terminology
|
||||
Texture - a set of bytes on the GPU, not directly accessible
|
||||
Surface - a set of bytes in RAM, modifiable
|
||||
rect - a rectangle of {x,y,width,height}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
A collection of examples for doing common things with Prosperon.
|
||||
@@ -1,8 +1,10 @@
|
||||
Prosperon is an opinionated Javascript-based runtime for making games, quickly. It is NOT web compatible, and doesn't intend to be. It uses a hefty dosing of ideas from the Misty language, to make an easy and intuitive way to make virtual worlds.
|
||||
# Prosperon Docs
|
||||
|
||||
With Javascript's C-like syntax, it makes it easy to make classic style games like Pacman or Fantasy Zone, without diving into Unity, Godot or Unreal Engine.
|
||||
Prosperon is based around a Javascript-like language, made to enable the fastest way to make computer games, in a cross platform way.
|
||||
|
||||
# API usage
|
||||
This was done to make programs simpler, faster, and easier to maintain. Much Javascript code from before ES6 is compatible.
|
||||
|
||||
## API usage
|
||||
A lot of the API usage is informed from 'duck typing'. If something "looks" like a camera - it can be used like one! If something "looks" like a sprite, it can be used like one! There are fast paths on nearly everything for well defined objects
|
||||
|
||||
Uniformity is prioritized. Javascript allows for a powerful abstraction - the object - which Prosperon makes much use of. It allows for another - the arraybuffer - which makes it simple to plug different parts of the engine into each other.
|
||||
@@ -14,87 +16,3 @@ Most functions take objects just like this, increasing flexibility for what you
|
||||
|
||||
# Gradual performance
|
||||
Prosperon makes it easy to make something quickly, and if it runs well, you're golden! But if it's slow, there are a plethora of options to make it faster. Plus, with native C plugins, there is nothing that can't be figured out.
|
||||
|
||||
# API
|
||||
~~prosperon master
|
||||
Here are the modules that can be included via 'use'.
|
||||
|
||||
// extensions
|
||||
Object.id - get a unique id for the given javascript object
|
||||
|
||||
// global syntax level things
|
||||
Globals have been kept to a minimum to ensure game objects are as flexible as possible in what they can call their state. The vast majority of access to prosperon is done through the 'use' statement.
|
||||
use - import a module
|
||||
on actors: /* look to web windows for a comparison */
|
||||
- spawn: create a new actor
|
||||
- delay: execute a function after seconds
|
||||
-
|
||||
|
||||
prosperon global object; information about the engine; process related (ie, if there are multiple threads running, prosperon will be different in each, os will be the same)
|
||||
- version: 0.6.1
|
||||
- revision: git revision
|
||||
- argv: the string of arguments passed to the process
|
||||
- semver: functions to compare use
|
||||
|
||||
os - sys calls; information about the underlying hardware
|
||||
js - information about the scripting language; gc functions; etc
|
||||
|
||||
// mixed in
|
||||
base
|
||||
std
|
||||
|
||||
// core use fns
|
||||
input - user input settings
|
||||
json - json encoding and decoding
|
||||
resources - access resources
|
||||
sound - play sounds
|
||||
time - time access
|
||||
actor - actor helpers
|
||||
color - color constants
|
||||
tween - helper to tween
|
||||
util - random helpers
|
||||
io - file system access, mounting, unmounting
|
||||
event - system events
|
||||
|
||||
math - math help
|
||||
geometry - geometry help
|
||||
|
||||
// rendering
|
||||
draw2d - immediate mode draw 2d stuff functions
|
||||
render - render configuration and use; shaders, pipelines, render state.
|
||||
graphics - create graphics objects (textures, fonts, etc); memory usage of fonts, textures, etc.
|
||||
|
||||
// game component modules
|
||||
emitter - particle drawing helper
|
||||
sprite - sprite drawing helper
|
||||
transform - helper to turn programs into transforms
|
||||
layout - a gui layout helper
|
||||
imgui - add for imgui calls
|
||||
controller - higher level controller based on events
|
||||
|
||||
~~prosperon dev
|
||||
nota
|
||||
dmon
|
||||
enet
|
||||
|
||||
convert
|
||||
debug
|
||||
diff
|
||||
nogame
|
||||
parseq
|
||||
path
|
||||
physics
|
||||
gizmos
|
||||
log
|
||||
stats
|
||||
stdprofile
|
||||
stdtest
|
||||
test
|
||||
textedit
|
||||
editor
|
||||
yaml
|
||||
spline
|
||||
profile
|
||||
sim
|
||||
|
||||
noise // using stb perlin
|
||||
Reference in New Issue
Block a user