add core docs
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
# actor
|
||||
|
||||
## actor
|
||||
### toString() <sub>function</sub>
|
||||
|
||||
### toString
|
||||
### spawn(script, config, callback) <sub>function</sub>
|
||||
|
||||
### spawn(script, config, callback)
|
||||
### clear() <sub>function</sub>
|
||||
|
||||
### clear
|
||||
### kill() <sub>function</sub>
|
||||
|
||||
### kill
|
||||
|
||||
### delay(fn, seconds)
|
||||
### delay(fn, seconds) <sub>function</sub>
|
||||
|
||||
@@ -2,36 +2,36 @@
|
||||
|
||||
The console object provides various logging, debugging, and output methods.
|
||||
|
||||
### print
|
||||
### print() <sub>function</sub>
|
||||
|
||||
### spam(msg)
|
||||
### spam(msg) <sub>function</sub>
|
||||
|
||||
Output a spam-level message for very verbose logging.
|
||||
|
||||
### debug(msg)
|
||||
### debug(msg) <sub>function</sub>
|
||||
|
||||
Output a debug-level message.
|
||||
|
||||
### info(msg)
|
||||
### info(msg) <sub>function</sub>
|
||||
|
||||
Output info level message.
|
||||
|
||||
### warn(msg)
|
||||
### warn(msg) <sub>function</sub>
|
||||
|
||||
Output warn level message.
|
||||
|
||||
### log(msg)
|
||||
### log(msg) <sub>function</sub>
|
||||
|
||||
Output directly to in game console.
|
||||
|
||||
### error(e)
|
||||
### error(e) <sub>function</sub>
|
||||
|
||||
Output error level message, and print stacktrace.
|
||||
|
||||
### panic(e)
|
||||
### panic(e) <sub>function</sub>
|
||||
|
||||
Output a panic-level message and exit the program.
|
||||
|
||||
### assert(op, str = `assertion failed [value '${op}']`)
|
||||
### assert(op, str = `assertion failed [value '${op}']`) <sub>function</sub>
|
||||
|
||||
If the condition is false, print an error and panic.
|
||||
|
||||
@@ -6,7 +6,7 @@ as managing tag-based lookups. Objects are assumed to have a "objects" property,
|
||||
pointing to children or sub-objects, forming a tree.
|
||||
|
||||
|
||||
### all_objects(fn, startobj)
|
||||
### all_objects(fn, startobj) <sub>function</sub>
|
||||
|
||||
|
||||
Iterate over each object (and its sub-objects) in the hierarchy, calling fn for each one.
|
||||
@@ -20,7 +20,7 @@ Iterate over each object (and its sub-objects) in the hierarchy, calling fn for
|
||||
**Returns**: The first truthy value returned by fn, or undefined if none.
|
||||
|
||||
|
||||
### find_object(fn, startobj)
|
||||
### find_object(fn, startobj) <sub>function</sub>
|
||||
|
||||
|
||||
Intended to find a matching object within the hierarchy.
|
||||
@@ -34,7 +34,7 @@ Intended to find a matching object within the hierarchy.
|
||||
**Returns**: Not yet implemented.
|
||||
|
||||
|
||||
### tag_add(tag, obj)
|
||||
### tag_add(tag, obj) <sub>function</sub>
|
||||
|
||||
|
||||
Associate the given object with the specified tag. Creates a new tag set if it does not exist.
|
||||
@@ -48,7 +48,7 @@ Associate the given object with the specified tag. Creates a new tag set if it d
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### tag_rm(tag, obj)
|
||||
### tag_rm(tag, obj) <sub>function</sub>
|
||||
|
||||
|
||||
Remove the given object from the specified tag’s set, if it exists.
|
||||
@@ -62,7 +62,7 @@ Remove the given object from the specified tag’s set, if it exists.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### tag_clear_guid(obj)
|
||||
### tag_clear_guid(obj) <sub>function</sub>
|
||||
|
||||
|
||||
Remove the object from all tag sets.
|
||||
@@ -74,7 +74,7 @@ Remove the object from all tag sets.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### objects_with_tag(tag)
|
||||
### objects_with_tag(tag) <sub>function</sub>
|
||||
|
||||
|
||||
Retrieve all objects currently tagged with the specified tag.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# cmd
|
||||
|
||||
## cmd
|
||||
### length <sub>number</sub>
|
||||
|
||||
### name <sub>string</sub>
|
||||
|
||||
### prototype <sub>object</sub>
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# color
|
||||
|
||||
## color
|
||||
### Color <sub>object</sub>
|
||||
|
||||
### esc <sub>object</sub>
|
||||
|
||||
### ColorMap <sub>object</sub>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# doc
|
||||
|
||||
## doc
|
||||
### writeDocFile(obj, title) <sub>function</sub>
|
||||
|
||||
### writeDocFile(obj, title)
|
||||
|
||||
Return a markdown string for a given obj, with optional title.
|
||||
Return a markdown string for a given obj, with an optional title.
|
||||
|
||||
@@ -5,7 +5,7 @@ A collection of 2D drawing functions that operate in screen space. Provides prim
|
||||
for lines, rectangles, text, sprite drawing, etc.
|
||||
|
||||
|
||||
### point(pos, size, color)
|
||||
### point(pos, size, color) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ for lines, rectangles, text, sprite drawing, etc.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### line(points, color, thickness, pipeline)
|
||||
### line(points, color, thickness, pipeline) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ for lines, rectangles, text, sprite drawing, etc.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### cross(pos, size, color, thickness, pipe)
|
||||
### cross(pos, size, color, thickness, pipe) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ for lines, rectangles, text, sprite drawing, etc.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### arrow(start, end, color, wingspan, wingangle, pipe)
|
||||
### arrow(start, end, color, wingspan, wingangle, pipe) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ for lines, rectangles, text, sprite drawing, etc.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### rectangle(rect, color, pipeline)
|
||||
### rectangle(rect, color, pipeline) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ for lines, rectangles, text, sprite drawing, etc.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### tile(image, rect, color, tile, pipeline)
|
||||
### tile(image, rect, color, tile, pipeline) <sub>function</sub>
|
||||
|
||||
|
||||
:raises Error: If no image is provided.
|
||||
@@ -112,7 +112,7 @@ for lines, rectangles, text, sprite drawing, etc.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### slice9(image, rect, slice, color, info, pipeline)
|
||||
### slice9(image, rect, slice, color, info, pipeline) <sub>function</sub>
|
||||
|
||||
|
||||
:raises Error: If no image is provided.
|
||||
@@ -134,7 +134,7 @@ for lines, rectangles, text, sprite drawing, etc.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### image(image, rect, rotation, color, pipeline)
|
||||
### image(image, rect, rotation, color, pipeline) <sub>function</sub>
|
||||
|
||||
|
||||
:raises Error: If no image is provided.
|
||||
@@ -154,7 +154,7 @@ for lines, rectangles, text, sprite drawing, etc.
|
||||
**Returns**: A sprite object that was created for this draw call.
|
||||
|
||||
|
||||
### images(image, rects, config)
|
||||
### images(image, rects, config) <sub>function</sub>
|
||||
|
||||
|
||||
:raises Error: If no image is provided.
|
||||
@@ -170,7 +170,7 @@ for lines, rectangles, text, sprite drawing, etc.
|
||||
**Returns**: An array of sprite objects created and queued for rendering.
|
||||
|
||||
|
||||
### sprites(sprites, sort, pipeline)
|
||||
### sprites(sprites, sort, pipeline) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ for lines, rectangles, text, sprite drawing, etc.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### circle(pos, radius, color, inner_radius, pipeline)
|
||||
### circle(pos, radius, color, inner_radius, pipeline) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ for lines, rectangles, text, sprite drawing, etc.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### text(text, rect, font, size, color, wrap, pipeline)
|
||||
### text(text, rect, font, size, color, wrap, pipeline) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# event
|
||||
|
||||
## event
|
||||
|
||||
### push_event(event)
|
||||
### push_event(event) <sub>function</sub>
|
||||
|
||||
Push a custom user event into SDL's queue, passing a callback function.
|
||||
|
||||
@@ -14,7 +12,7 @@ Push a custom user event into SDL's queue, passing a callback function.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### engine_input(callback)
|
||||
### engine_input(callback) <sub>function</sub>
|
||||
|
||||
Poll all system events (keyboard, mouse, etc.) and call the given function with each event object.
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ A collection of geometry-related functions for circles, spheres, boxes, polygons
|
||||
and rectangle utilities. Some functionality is implemented in C and exposed here.
|
||||
|
||||
|
||||
### rect_intersection(a, b)
|
||||
### rect_intersection(a, b) <sub>function</sub>
|
||||
|
||||
|
||||
Return the intersection of two rectangles. The result may be empty if no intersection.
|
||||
@@ -19,7 +19,7 @@ Return the intersection of two rectangles. The result may be empty if no interse
|
||||
**Returns**: A rectangle that is the intersection of the two. May have zero width/height if no overlap.
|
||||
|
||||
|
||||
### rect_intersects(a, b)
|
||||
### rect_intersects(a, b) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ Return the intersection of two rectangles. The result may be empty if no interse
|
||||
**Returns**: A boolean indicating whether the two rectangles overlap.
|
||||
|
||||
|
||||
### rect_expand(a, b)
|
||||
### rect_expand(a, b) <sub>function</sub>
|
||||
|
||||
|
||||
Merge or combine two rectangles, returning their bounding rectangle.
|
||||
@@ -46,7 +46,7 @@ Merge or combine two rectangles, returning their bounding rectangle.
|
||||
**Returns**: A new rectangle that covers the bounds of both input rectangles.
|
||||
|
||||
|
||||
### rect_inside(inner, outer)
|
||||
### rect_inside(inner, outer) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ Merge or combine two rectangles, returning their bounding rectangle.
|
||||
**Returns**: True if 'inner' is completely inside 'outer', otherwise false.
|
||||
|
||||
|
||||
### rect_random(rect)
|
||||
### rect_random(rect) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ Merge or combine two rectangles, returning their bounding rectangle.
|
||||
**Returns**: A random point within the rectangle (uniform distribution).
|
||||
|
||||
|
||||
### cwh2rect(center, wh)
|
||||
### cwh2rect(center, wh) <sub>function</sub>
|
||||
|
||||
|
||||
Helper: convert a center point and width/height vector to a rect object.
|
||||
@@ -84,7 +84,7 @@ Helper: convert a center point and width/height vector to a rect object.
|
||||
**Returns**: A rectangle {x, y, w, h} with x,y set to center and w,h set to the given size.
|
||||
|
||||
|
||||
### rect_point_inside(rect, point)
|
||||
### rect_point_inside(rect, point) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ Helper: convert a center point and width/height vector to a rect object.
|
||||
**Returns**: True if the point lies inside the rectangle, otherwise false.
|
||||
|
||||
|
||||
### rect_pos(rect)
|
||||
### rect_pos(rect) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ Helper: convert a center point and width/height vector to a rect object.
|
||||
**Returns**: A 2D vector [x,y] giving the rectangle's position.
|
||||
|
||||
|
||||
### rect_move(rect, offset)
|
||||
### rect_move(rect, offset) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ Helper: convert a center point and width/height vector to a rect object.
|
||||
**Returns**: A new rectangle with updated x,y offset.
|
||||
|
||||
|
||||
### box(w, h)
|
||||
### box(w, h) <sub>function</sub>
|
||||
|
||||
|
||||
Construct a box centered at the origin with the given width and height. This overrides the box object above.
|
||||
@@ -135,38 +135,15 @@ Construct a box centered at the origin with the given width and height. This ove
|
||||
**Returns**: An array of four 2D points representing the corners of a rectangle centered at [0,0].
|
||||
|
||||
|
||||
### sphere <sub>object</sub>
|
||||
|
||||
|
||||
Sphere-related geometry functions:
|
||||
- volume(r): Return the volume of a sphere with radius r.
|
||||
- random(r, theta, phi): Return a random point on or inside a sphere.
|
||||
|
||||
|
||||
#### volume(r)
|
||||
|
||||
|
||||
|
||||
|
||||
**r**: The sphere radius.
|
||||
|
||||
|
||||
**Returns**: The volume of the sphere, calculated as (4/3) * pi * r^3.
|
||||
|
||||
|
||||
#### random(r, theta, phi)
|
||||
|
||||
|
||||
Generate a random point inside a sphere of variable radius, distributing angles in the specified ranges.
|
||||
|
||||
|
||||
**r**: A single number (radius) or a 2-element array [minRadius, maxRadius].
|
||||
|
||||
**theta**: A single number or 2-element array defining the range in turns for the theta angle, default [0,1].
|
||||
|
||||
**phi**: A single number or 2-element array defining the range in turns for the phi angle, default [-0.5,0.5].
|
||||
|
||||
|
||||
**Returns**: A 3D point (x,y,z) randomly placed within a sphere.
|
||||
|
||||
### circle <sub>object</sub>
|
||||
|
||||
|
||||
Circle-related geometry functions:
|
||||
@@ -174,45 +151,7 @@ Circle-related geometry functions:
|
||||
- random(r, theta): Return a random 2D point on a circle; uses sphere.random internally and extracts x,z.
|
||||
|
||||
|
||||
#### area(r)
|
||||
|
||||
|
||||
|
||||
|
||||
**r**: Radius of the circle.
|
||||
|
||||
|
||||
**Returns**: The area, pi * r^2.
|
||||
|
||||
|
||||
#### random(r, theta)
|
||||
|
||||
|
||||
|
||||
|
||||
**r**: A radius or [minRadius, maxRadius].
|
||||
|
||||
**theta**: Angle range in turns (single number or [min,max]).
|
||||
|
||||
|
||||
**Returns**: A 2D point (x,z) in the circle, using the sphere random generator and ignoring y.
|
||||
|
||||
|
||||
#### points(radius, n)
|
||||
|
||||
|
||||
Shortcut for geometry.arc(radius, 360, n).
|
||||
|
||||
|
||||
**radius**: The circle's radius.
|
||||
|
||||
**n**: Number of points around the circle.
|
||||
|
||||
|
||||
**Returns**: An array of 2D points equally spaced around a full 360-degree circle.
|
||||
|
||||
|
||||
### ngon(radius, n)
|
||||
### ngon(radius, n) <sub>function</sub>
|
||||
|
||||
|
||||
Generates a regular n-gon by calling geometry.arc with full 360 degrees.
|
||||
@@ -226,7 +165,7 @@ Generates a regular n-gon by calling geometry.arc with full 360 degrees.
|
||||
**Returns**: An array of 2D points forming a regular n-gon.
|
||||
|
||||
|
||||
### arc(radius, angle, n, start)
|
||||
### arc(radius, angle, n, start) <sub>function</sub>
|
||||
|
||||
|
||||
Generate an arc (or partial circle) of n points, each angle spread equally over 'angle' degrees from 'start'.
|
||||
@@ -244,7 +183,7 @@ Generate an arc (or partial circle) of n points, each angle spread equally over
|
||||
**Returns**: An array of 2D points along the arc.
|
||||
|
||||
|
||||
### corners2points(ll, ur)
|
||||
### corners2points(ll, ur) <sub>function</sub>
|
||||
|
||||
|
||||
Similar to box.points, but calculates differently.
|
||||
@@ -258,7 +197,7 @@ Similar to box.points, but calculates differently.
|
||||
**Returns**: A four-point array of corners [ll, lower-right, upper-right, upper-left].
|
||||
|
||||
|
||||
### sortpointsccw(points)
|
||||
### sortpointsccw(points) <sub>function</sub>
|
||||
|
||||
|
||||
Sort an array of points in CCW order based on their angles from the centroid.
|
||||
@@ -270,7 +209,7 @@ Sort an array of points in CCW order based on their angles from the centroid.
|
||||
**Returns**: A new array of the same points, sorted counterclockwise around their centroid.
|
||||
|
||||
|
||||
### points2cm(points)
|
||||
### points2cm(points) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ Includes both JavaScript and C-implemented routines for creating geometry buffer
|
||||
rectangle packing, etc.
|
||||
|
||||
|
||||
### make_sprite_mesh(sprites)
|
||||
### make_sprite_mesh(sprites) <sub>function</sub>
|
||||
|
||||
|
||||
:param oldMesh (optional): An existing mesh object to reuse/resize if possible.
|
||||
@@ -19,7 +19,7 @@ Given an array of sprites, build a single geometry mesh for rendering them.
|
||||
**Returns**: A GPU mesh object with pos, uv, color, and indices buffers for all sprites.
|
||||
|
||||
|
||||
### make_sprite_queue(sprites, camera, pipeline, sort)
|
||||
### make_sprite_queue(sprites, camera, pipeline, sort) <sub>function</sub>
|
||||
|
||||
|
||||
Given an array of sprites, optionally sort them, then build a queue of pipeline commands.
|
||||
@@ -38,7 +38,7 @@ Each group with a shared image becomes one command.
|
||||
**Returns**: An array of pipeline commands: geometry with mesh references, grouped by image.
|
||||
|
||||
|
||||
### make_text_buffer(text, rect, angle, color, wrap, font)
|
||||
### make_text_buffer(text, rect, angle, color, wrap, font) <sub>function</sub>
|
||||
|
||||
|
||||
Generate a GPU buffer mesh of text quads for rendering with a font, etc.
|
||||
@@ -60,7 +60,7 @@ Generate a GPU buffer mesh of text quads for rendering with a font, etc.
|
||||
**Returns**: A geometry buffer mesh (pos, uv, color, indices) for rendering text.
|
||||
|
||||
|
||||
### rectpack(width, height, sizes)
|
||||
### rectpack(width, height, sizes) <sub>function</sub>
|
||||
|
||||
|
||||
Perform a rectangle packing using the stbrp library. Return positions for each rect.
|
||||
@@ -76,7 +76,7 @@ Perform a rectangle packing using the stbrp library. Return positions for each r
|
||||
**Returns**: An array of [x,y] coordinates placing each rect, or null if they don't fit.
|
||||
|
||||
|
||||
### make_rtree
|
||||
### make_rtree() <sub>function</sub>
|
||||
|
||||
|
||||
Create a new R-Tree for geometry queries.
|
||||
@@ -85,7 +85,7 @@ Create a new R-Tree for geometry queries.
|
||||
**Returns**: An R-Tree object for quickly querying many rectangles or sprite bounds.
|
||||
|
||||
|
||||
### make_texture(data)
|
||||
### make_texture(data) <sub>function</sub>
|
||||
|
||||
|
||||
Convert raw image bytes into an SDL_Surface object.
|
||||
@@ -97,7 +97,7 @@ Convert raw image bytes into an SDL_Surface object.
|
||||
**Returns**: An SDL_Surface object representing the decoded image in RAM, for use with GPU or software rendering.
|
||||
|
||||
|
||||
### make_gif(data)
|
||||
### make_gif(data) <sub>function</sub>
|
||||
|
||||
|
||||
Load a GIF, returning its frames. If it's a single-frame GIF, the result may have .surface only.
|
||||
@@ -109,7 +109,7 @@ Load a GIF, returning its frames. If it's a single-frame GIF, the result may hav
|
||||
**Returns**: An object with frames[], each frame having its own .surface. Some also have a .texture for GPU use.
|
||||
|
||||
|
||||
### make_aseprite(data)
|
||||
### make_aseprite(data) <sub>function</sub>
|
||||
|
||||
|
||||
Load an Aseprite/ASE file from an array of bytes, returning frames or animations.
|
||||
@@ -121,7 +121,7 @@ Load an Aseprite/ASE file from an array of bytes, returning frames or animations
|
||||
**Returns**: An object containing frames or animations, each with .surface. May also have top-level .surface for a single-layer case.
|
||||
|
||||
|
||||
### cull_sprites(sprites, camera)
|
||||
### cull_sprites(sprites, camera) <sub>function</sub>
|
||||
|
||||
|
||||
Filter an array of sprites to only those visible in the provided camera’s view.
|
||||
@@ -135,7 +135,7 @@ Filter an array of sprites to only those visible in the provided camera’s view
|
||||
**Returns**: A new array of sprites that are visible in the camera's view.
|
||||
|
||||
|
||||
### rects_to_sprites(rects, image)
|
||||
### rects_to_sprites(rects, image) <sub>function</sub>
|
||||
|
||||
|
||||
Convert an array of rect coords into sprite objects referencing a single image.
|
||||
@@ -149,7 +149,7 @@ Convert an array of rect coords into sprite objects referencing a single image.
|
||||
**Returns**: An array of sprite objects referencing the 'image' and each rect for UV or position.
|
||||
|
||||
|
||||
### make_surface(dimensions)
|
||||
### make_surface(dimensions) <sub>function</sub>
|
||||
|
||||
|
||||
Create a blank surface in RAM.
|
||||
@@ -161,7 +161,7 @@ Create a blank surface in RAM.
|
||||
**Returns**: A blank RGBA surface with the given dimensions, typically for software rendering or icons.
|
||||
|
||||
|
||||
### make_cursor(opts)
|
||||
### make_cursor(opts) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ Create a blank surface in RAM.
|
||||
**Returns**: An SDL_Cursor object referencing the given surface for a custom mouse cursor.
|
||||
|
||||
|
||||
### make_font(data, size)
|
||||
### make_font(data, size) <sub>function</sub>
|
||||
|
||||
|
||||
Load a font from TTF/OTF data at the given size.
|
||||
@@ -186,7 +186,7 @@ Load a font from TTF/OTF data at the given size.
|
||||
**Returns**: A font object with surface, texture, and glyph data, for text rendering with make_text_buffer.
|
||||
|
||||
|
||||
### make_sprite
|
||||
### make_sprite() <sub>function</sub>
|
||||
|
||||
|
||||
Create a new sprite object, storing default properties.
|
||||
@@ -195,7 +195,7 @@ Create a new sprite object, storing default properties.
|
||||
**Returns**: A new sprite object, which typically has .rect, .color, .layer, .image, etc.
|
||||
|
||||
|
||||
### make_line_prim(points, thickness, startCap, endCap, color)
|
||||
### make_line_prim(points, thickness, startCap, endCap, color) <sub>function</sub>
|
||||
|
||||
|
||||
Build a GPU mesh representing a thick polyline from an array of points, using parsl or a similar library under the hood.
|
||||
@@ -215,7 +215,7 @@ Build a GPU mesh representing a thick polyline from an array of points, using pa
|
||||
**Returns**: A geometry mesh object suitable for rendering the line via a pipeline command.
|
||||
|
||||
|
||||
### is_image(obj)
|
||||
### is_image(obj) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ Build a GPU mesh representing a thick polyline from an array of points, using pa
|
||||
**Returns**: True if 'obj' has a .texture and a .rect property, indicating it's an image object.
|
||||
|
||||
|
||||
### texture(path)
|
||||
### texture(path) <sub>function</sub>
|
||||
|
||||
|
||||
Load or retrieve a cached image, converting it into a GPU texture. If 'path' is already an object, it’s returned directly.
|
||||
@@ -238,7 +238,7 @@ Load or retrieve a cached image, converting it into a GPU texture. If 'path' is
|
||||
**Returns**: An image object with {surface, texture, frames?, etc.} depending on the format.
|
||||
|
||||
|
||||
### tex_hotreload(file)
|
||||
### tex_hotreload(file) <sub>function</sub>
|
||||
|
||||
|
||||
Reload the image for the given file, updating the cached copy in memory and GPU.
|
||||
@@ -250,7 +250,7 @@ Reload the image for the given file, updating the cached copy in memory and GPU.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### get_font(path, size)
|
||||
### get_font(path, size) <sub>function</sub>
|
||||
|
||||
|
||||
Load a font from file if not cached, or retrieve from cache if already loaded.
|
||||
@@ -264,7 +264,7 @@ Load a font from file if not cached, or retrieve from cache if already loaded.
|
||||
**Returns**: A font object with .surface and .texture for rendering text.
|
||||
|
||||
|
||||
### queue_sprite_mesh(queue)
|
||||
### queue_sprite_mesh(queue) <sub>function</sub>
|
||||
|
||||
|
||||
Builds a single geometry mesh for all sprite-type commands in the queue, storing first_index/num_indices
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
# imgui
|
||||
|
||||
## imgui
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# input
|
||||
|
||||
## input
|
||||
|
||||
### mouse_show(show)
|
||||
### mouse_show(show) <sub>function</sub>
|
||||
|
||||
Show or hide the mouse cursor. Pass true to show, false to hide.
|
||||
|
||||
@@ -14,7 +12,7 @@ Show or hide the mouse cursor. Pass true to show, false to hide.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### mouse_lock(lock)
|
||||
### mouse_lock(lock) <sub>function</sub>
|
||||
|
||||
Capture or release the mouse, confining it within the window if locked.
|
||||
|
||||
@@ -26,7 +24,7 @@ Capture or release the mouse, confining it within the window if locked.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### cursor_set(cursor)
|
||||
### cursor_set(cursor) <sub>function</sub>
|
||||
|
||||
Set the given cursor (created by os.make_cursor) as the active mouse cursor.
|
||||
|
||||
@@ -38,7 +36,7 @@ Set the given cursor (created by os.make_cursor) as the active mouse cursor.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### keyname(keycode)
|
||||
### keyname(keycode) <sub>function</sub>
|
||||
|
||||
Given a numeric keycode, return the corresponding key name (e.g., from SDL).
|
||||
|
||||
@@ -50,7 +48,7 @@ Given a numeric keycode, return the corresponding key name (e.g., from SDL).
|
||||
**Returns**: A string with the key name.
|
||||
|
||||
|
||||
### keymod
|
||||
### keymod() <sub>function</sub>
|
||||
|
||||
Return an object describing the current modifier keys, e.g. {shift:true, ctrl:true}.
|
||||
|
||||
@@ -59,7 +57,7 @@ Return an object describing the current modifier keys, e.g. {shift:true, ctrl:tr
|
||||
**Returns**: An object with boolean fields for each modifier key.
|
||||
|
||||
|
||||
### mousestate
|
||||
### mousestate() <sub>function</sub>
|
||||
|
||||
Return an object describing the current mouse state, including x,y coordinates
|
||||
and booleans for pressed buttons (left, middle, right, x1, x2).
|
||||
@@ -69,14 +67,22 @@ and booleans for pressed buttons (left, middle, right, x1, x2).
|
||||
**Returns**: Object { x, y, left, middle, right, x1, x2 }
|
||||
|
||||
|
||||
### print_pawn_kbm(pawn)
|
||||
### mouse <sub>object</sub>
|
||||
|
||||
### procdown
|
||||
### keyboard <sub>object</sub>
|
||||
|
||||
### print_md_kbm(pawn)
|
||||
### print_pawn_kbm(pawn) <sub>function</sub>
|
||||
|
||||
### has_bind(pawn, bind)
|
||||
### procdown() <sub>function</sub>
|
||||
|
||||
### tabcomplete(val, list)
|
||||
### print_md_kbm(pawn) <sub>function</sub>
|
||||
|
||||
### do_uncontrol(pawn)
|
||||
### has_bind(pawn, bind) <sub>function</sub>
|
||||
|
||||
### action <sub>object</sub>
|
||||
|
||||
### tabcomplete(val, list) <sub>function</sub>
|
||||
|
||||
### do_uncontrol(pawn) <sub>function</sub>
|
||||
|
||||
### player <sub>object</sub>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# io
|
||||
|
||||
## io
|
||||
|
||||
### rm(path)
|
||||
### rm(path) <sub>function</sub>
|
||||
|
||||
Remove the file or empty directory at the given path.
|
||||
|
||||
@@ -14,7 +12,7 @@ Remove the file or empty directory at the given path.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### mkdir(path)
|
||||
### mkdir(path) <sub>function</sub>
|
||||
|
||||
Create a directory at the given path.
|
||||
|
||||
@@ -26,7 +24,7 @@ Create a directory at the given path.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### stat(path)
|
||||
### stat(path) <sub>function</sub>
|
||||
|
||||
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.
|
||||
@@ -39,7 +37,7 @@ filesize, modtime, createtime, and accesstime. Throw an error if the path does n
|
||||
**Returns**: An object with metadata (filesize, modtime, createtime, accesstime).
|
||||
|
||||
|
||||
### globfs(patterns)
|
||||
### globfs(patterns) <sub>function</sub>
|
||||
|
||||
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
|
||||
@@ -53,7 +51,7 @@ recursively enumerates the filesystem within PHYSFS. Each pattern is treated as
|
||||
**Returns**: An array of matching file paths.
|
||||
|
||||
|
||||
### match(pattern, string)
|
||||
### match(pattern, string) <sub>function</sub>
|
||||
|
||||
Return boolean indicating whether the given wildcard pattern matches the provided
|
||||
string. Dots must match dots. Case is not ignored.
|
||||
@@ -77,7 +75,7 @@ Patterns can incorporate:
|
||||
**Returns**: True if matched, otherwise false.
|
||||
|
||||
|
||||
### exists(path)
|
||||
### exists(path) <sub>function</sub>
|
||||
|
||||
Return a boolean indicating whether the file or directory at the given path exists.
|
||||
|
||||
@@ -89,7 +87,7 @@ Return a boolean indicating whether the file or directory at the given path exis
|
||||
**Returns**: True if the path exists, otherwise false.
|
||||
|
||||
|
||||
### mount(archiveOrDir, mountPoint)
|
||||
### mount(archiveOrDir, mountPoint) <sub>function</sub>
|
||||
|
||||
Mount a directory or archive at the specified mount point. An undefined mount
|
||||
point mounts to '/'. Throw on error.
|
||||
@@ -104,7 +102,7 @@ point mounts to '/'. Throw on error.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### unmount(path)
|
||||
### unmount(path) <sub>function</sub>
|
||||
|
||||
Unmount a previously mounted directory or archive. Throw on error.
|
||||
|
||||
@@ -116,7 +114,7 @@ Unmount a previously mounted directory or archive. Throw on error.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### slurp(path)
|
||||
### slurp(path) <sub>function</sub>
|
||||
|
||||
Read the entire file at the given path as a string. Throw on error.
|
||||
|
||||
@@ -128,7 +126,7 @@ Read the entire file at the given path as a string. Throw on error.
|
||||
**Returns**: A string with the file’s contents.
|
||||
|
||||
|
||||
### slurpbytes(path)
|
||||
### slurpbytes(path) <sub>function</sub>
|
||||
|
||||
Read the entire file at the given path as a raw ArrayBuffer. Throw on error.
|
||||
|
||||
@@ -140,7 +138,7 @@ Read the entire file at the given path as a raw ArrayBuffer. Throw on error.
|
||||
**Returns**: An ArrayBuffer containing the file’s raw bytes.
|
||||
|
||||
|
||||
### slurpwrite(data, path)
|
||||
### slurpwrite(data, path) <sub>function</sub>
|
||||
|
||||
Write data (string or ArrayBuffer) to the given file path. Overwrite if it exists.
|
||||
Throw on error.
|
||||
@@ -155,7 +153,7 @@ Throw on error.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### writepath(path)
|
||||
### writepath(path) <sub>function</sub>
|
||||
|
||||
Set the write directory. Subsequent writes will go here by default. Throw on error.
|
||||
|
||||
@@ -167,7 +165,7 @@ Set the write directory. Subsequent writes will go here by default. Throw on err
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### basedir
|
||||
### basedir() <sub>function</sub>
|
||||
|
||||
Return the application's base directory (where the executable is located).
|
||||
|
||||
@@ -176,7 +174,7 @@ Return the application's base directory (where the executable is located).
|
||||
**Returns**: A string with the base directory path.
|
||||
|
||||
|
||||
### userdir
|
||||
### userdir() <sub>function</sub>
|
||||
|
||||
Return the user's directory, often used for saving data.
|
||||
|
||||
@@ -185,7 +183,7 @@ Return the user's directory, often used for saving data.
|
||||
**Returns**: A string with the user's directory path.
|
||||
|
||||
|
||||
### realdir(path)
|
||||
### realdir(path) <sub>function</sub>
|
||||
|
||||
Return the actual, real directory (on the host filesystem) that contains the given
|
||||
file path. Return undefined if not found.
|
||||
@@ -198,7 +196,7 @@ file path. Return undefined if not found.
|
||||
**Returns**: A string with the real directory path, or undefined.
|
||||
|
||||
|
||||
### open(path)
|
||||
### open(path) <sub>function</sub>
|
||||
|
||||
Open a file for writing, returning a file object that can be used for further
|
||||
operations. Throw on error.
|
||||
@@ -211,7 +209,7 @@ operations. Throw on error.
|
||||
**Returns**: A file object for subsequent write operations.
|
||||
|
||||
|
||||
### searchpath
|
||||
### searchpath() <sub>function</sub>
|
||||
|
||||
Return an array of all directories in the current paths.
|
||||
|
||||
@@ -220,7 +218,7 @@ Return an array of all directories in the current paths.
|
||||
**Returns**: An array of directory paths in the search path.
|
||||
|
||||
|
||||
### enumerate(path, recurse)
|
||||
### enumerate(path, recurse) <sub>function</sub>
|
||||
|
||||
Return an array of files within the given directory, optionally recursing into
|
||||
subdirectories.
|
||||
@@ -235,6 +233,6 @@ subdirectories.
|
||||
**Returns**: An array of file (and directory) paths found.
|
||||
|
||||
|
||||
### mount_core
|
||||
### mount_core() <sub>function</sub>
|
||||
|
||||
### is_directory
|
||||
### is_directory() <sub>function</sub>
|
||||
|
||||
@@ -5,7 +5,7 @@ Provides functions for introspecting and configuring the QuickJS runtime engine.
|
||||
Includes debug info, memory usage, GC controls, code evaluation, etc.
|
||||
|
||||
|
||||
### cycle_hook(callback)
|
||||
### cycle_hook(callback) <sub>function</sub>
|
||||
|
||||
|
||||
or undefined to remove the callback.
|
||||
@@ -21,7 +21,7 @@ is undefined, the hook is removed.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### dump_shapes
|
||||
### dump_shapes() <sub>function</sub>
|
||||
|
||||
|
||||
Use this for internal debugging of object shapes.
|
||||
@@ -30,7 +30,7 @@ Use this for internal debugging of object shapes.
|
||||
**Returns**: A debug string describing the internal shape hierarchy used by QuickJS.
|
||||
|
||||
|
||||
### dump_atoms
|
||||
### dump_atoms() <sub>function</sub>
|
||||
|
||||
|
||||
known by QuickJS. Helpful for diagnosing memory usage or potential key collisions.
|
||||
@@ -39,7 +39,7 @@ known by QuickJS. Helpful for diagnosing memory usage or potential key collision
|
||||
**Returns**: A debug string listing all currently registered atoms (internal property keys/symbols)
|
||||
|
||||
|
||||
### dump_class
|
||||
### dump_class() <sub>function</sub>
|
||||
|
||||
|
||||
Shows how many objects of each class exist, useful for advanced memory or performance profiling.
|
||||
@@ -48,7 +48,7 @@ Shows how many objects of each class exist, useful for advanced memory or perfor
|
||||
**Returns**: A debug string describing the distribution of JS object classes in the QuickJS runtime.
|
||||
|
||||
|
||||
### dump_objects
|
||||
### dump_objects() <sub>function</sub>
|
||||
|
||||
|
||||
useful for debugging memory leaks or object lifetimes.
|
||||
@@ -57,7 +57,7 @@ useful for debugging memory leaks or object lifetimes.
|
||||
**Returns**: A debug string listing certain internal QuickJS objects and their references,
|
||||
|
||||
|
||||
### dump_type_overheads
|
||||
### dump_type_overheads() <sub>function</sub>
|
||||
|
||||
|
||||
Displays memory usage breakdown for different internal object types.
|
||||
@@ -66,7 +66,7 @@ Displays memory usage breakdown for different internal object types.
|
||||
**Returns**: A debug string describing the overheads for various JS object types in QuickJS.
|
||||
|
||||
|
||||
### stack_info
|
||||
### stack_info() <sub>function</sub>
|
||||
|
||||
|
||||
Internal debugging utility to examine call stack details.
|
||||
@@ -75,7 +75,7 @@ Internal debugging utility to examine call stack details.
|
||||
**Returns**: An object or string describing the runtime's current stack usage and capacity.
|
||||
|
||||
|
||||
### calc_mem(value)
|
||||
### calc_mem(value) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ Compute the approximate size of a single JS value in memory. This is a best-effo
|
||||
**Returns**: Approximate memory usage (in bytes) of that single value.
|
||||
|
||||
|
||||
### mem
|
||||
### mem() <sub>function</sub>
|
||||
|
||||
|
||||
including total allocated bytes, object counts, and more.
|
||||
@@ -99,7 +99,7 @@ Retrieve an overview of the runtime’s memory usage.
|
||||
**Returns**: An object containing a comprehensive snapshot of memory usage for the current QuickJS runtime,
|
||||
|
||||
|
||||
### mem_limit(bytes)
|
||||
### mem_limit(bytes) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ fail or throw errors.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### gc_threshold(bytes)
|
||||
### gc_threshold(bytes) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ Set the threshold (in bytes) for QuickJS to perform an automatic GC pass when me
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### max_stacksize(bytes)
|
||||
### max_stacksize(bytes) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ Set the maximum stack size for QuickJS. If exceeded, the runtime may throw a sta
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### memstate
|
||||
### memstate() <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ Gives a quick overview of the memory usage, including malloc size and other allo
|
||||
**Returns**: A simpler memory usage object (malloc sizes, etc.) for the QuickJS runtime.
|
||||
|
||||
|
||||
### gc
|
||||
### gc() <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ Force an immediate, full garbage collection pass, reclaiming unreachable memory.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### eval(src, filename)
|
||||
### eval(src, filename) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# json
|
||||
|
||||
## json
|
||||
|
||||
### encode(val,space,replacer,whitelist)
|
||||
### encode(val,space,replacer,whitelist) <sub>function</sub>
|
||||
|
||||
Produce a JSON text from a Javascript object. If a record value, at any level, contains a json() method, it will be called, and the value it returns (usually a simpler record) will be JSONified.
|
||||
|
||||
@@ -10,7 +8,7 @@ If the record does not have a json() method, and if whitelist is a record, then
|
||||
|
||||
If the space input is true, then line breaks and extra whitespace will be included in the text.
|
||||
|
||||
### decode(text,reviver)
|
||||
### decode(text,reviver) <sub>function</sub>
|
||||
|
||||
The text text is parsed, and the resulting value (usually a record or an array) is returned.
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# loop
|
||||
|
||||
## loop
|
||||
|
||||
### step
|
||||
### step() <sub>function</sub>
|
||||
|
||||
@@ -1,115 +1,115 @@
|
||||
# math
|
||||
|
||||
## math
|
||||
|
||||
### dot
|
||||
### dot() <sub>function</sub>
|
||||
|
||||
Compute the dot product between two numeric arrays, returning a scalar. Extra elements are ignored.
|
||||
|
||||
### project
|
||||
### project() <sub>function</sub>
|
||||
|
||||
Project one vector onto another, returning a new array of the same dimension.
|
||||
|
||||
### rotate
|
||||
### rotate() <sub>function</sub>
|
||||
|
||||
Rotate a 2D point (or array of length 2) by the given angle (in turns) around an optional pivot.
|
||||
|
||||
### midpoint
|
||||
### midpoint() <sub>function</sub>
|
||||
|
||||
Compute the midpoint of two arrays of numbers. Only the first two entries are used if 2D is intended.
|
||||
|
||||
### reflect
|
||||
### reflect() <sub>function</sub>
|
||||
|
||||
Reflect a vector across a plane normal. Both arguments must be numeric arrays.
|
||||
|
||||
### distance
|
||||
### distance() <sub>function</sub>
|
||||
|
||||
Compute the Euclidean distance between two numeric arrays of matching length.
|
||||
|
||||
### direction
|
||||
### direction() <sub>function</sub>
|
||||
|
||||
Compute the normalized direction vector from the first array to the second.
|
||||
|
||||
### angle
|
||||
### angle() <sub>function</sub>
|
||||
|
||||
Given a 2D vector, return its angle from the X-axis in radians or some chosen units.
|
||||
|
||||
### norm
|
||||
### norm() <sub>function</sub>
|
||||
|
||||
Return a normalized copy of the given numeric array. For 2D/3D/4D or arbitrary length.
|
||||
|
||||
### angle_between
|
||||
### angle_between() <sub>function</sub>
|
||||
|
||||
Compute the angle between two vectors (2D/3D/4D).
|
||||
|
||||
### lerp
|
||||
### lerp() <sub>function</sub>
|
||||
|
||||
Linear interpolation between two numbers: lerp(a, b, t).
|
||||
|
||||
### gcd
|
||||
### gcd() <sub>function</sub>
|
||||
|
||||
Compute the greatest common divisor of two integers.
|
||||
|
||||
### lcm
|
||||
### lcm() <sub>function</sub>
|
||||
|
||||
Compute the least common multiple of two integers.
|
||||
|
||||
### clamp
|
||||
### clamp() <sub>function</sub>
|
||||
|
||||
Clamp a number between low and high. clamp(value, low, high).
|
||||
|
||||
### angledist
|
||||
### angledist() <sub>function</sub>
|
||||
|
||||
Compute the signed distance between two angles in 'turn' units, e.g. 0..1 range.
|
||||
|
||||
### jitter
|
||||
### jitter() <sub>function</sub>
|
||||
|
||||
Apply a random +/- percentage noise to a number. Example: jitter(100, 0.05) -> ~95..105.
|
||||
|
||||
### mean
|
||||
### mean() <sub>function</sub>
|
||||
|
||||
Compute the arithmetic mean of an array of numbers.
|
||||
|
||||
### sum
|
||||
### sum() <sub>function</sub>
|
||||
|
||||
Sum all elements of an array of numbers.
|
||||
|
||||
### sigma
|
||||
### sigma() <sub>function</sub>
|
||||
|
||||
Compute standard deviation of an array of numbers.
|
||||
|
||||
### median
|
||||
### median() <sub>function</sub>
|
||||
|
||||
Compute the median of an array of numbers.
|
||||
|
||||
### length
|
||||
### length() <sub>function</sub>
|
||||
|
||||
Return the length of a vector (i.e. sqrt of sum of squares).
|
||||
|
||||
### from_to
|
||||
### from_to() <sub>function</sub>
|
||||
|
||||
Return an array of points from a start to an end, spaced out by a certain distance.
|
||||
|
||||
### rand
|
||||
### rand() <sub>function</sub>
|
||||
|
||||
Return a random float in [0,1).
|
||||
|
||||
### randi
|
||||
### randi() <sub>function</sub>
|
||||
|
||||
Return a random 32-bit integer.
|
||||
|
||||
### srand
|
||||
### srand() <sub>function</sub>
|
||||
|
||||
Seed the random number generator with the given integer, or with current time if none.
|
||||
|
||||
### deg2rad(deg)
|
||||
### TAU <sub>number</sub>
|
||||
|
||||
### rad2deg(rad)
|
||||
### deg2rad(deg) <sub>function</sub>
|
||||
|
||||
### turn2rad(x)
|
||||
### rad2deg(rad) <sub>function</sub>
|
||||
|
||||
### rad2turn(x)
|
||||
### turn2rad(x) <sub>function</sub>
|
||||
|
||||
### turn2deg(x)
|
||||
### rad2turn(x) <sub>function</sub>
|
||||
|
||||
### deg2turn(x)
|
||||
### turn2deg(x) <sub>function</sub>
|
||||
|
||||
### deg2turn(x) <sub>function</sub>
|
||||
|
||||
@@ -1,3 +1,27 @@
|
||||
# miniz
|
||||
|
||||
## miniz
|
||||
### read(data) <sub>function</sub>
|
||||
|
||||
Create a zip reader from the given ArrayBuffer containing an entire ZIP archive.
|
||||
Return undefined if the data is invalid.
|
||||
|
||||
|
||||
|
||||
**data**: An ArrayBuffer with the entire ZIP file.
|
||||
|
||||
|
||||
**Returns**: A 'zip reader' object with methods for reading from the archive (mod, exists, slurp).
|
||||
|
||||
|
||||
### write(path) <sub>function</sub>
|
||||
|
||||
Create a zip writer that writes to the specified file path. Overwrites the file if
|
||||
it already exists. Return undefined on error.
|
||||
|
||||
|
||||
|
||||
**path**: The file path where the ZIP archive will be written.
|
||||
|
||||
|
||||
**Returns**: A 'zip writer' object with methods for adding files to the archive (add_file).
|
||||
|
||||
|
||||
@@ -1,103 +1,101 @@
|
||||
# os
|
||||
|
||||
## os
|
||||
|
||||
### make_transform
|
||||
### make_transform() <sub>function</sub>
|
||||
|
||||
Create a new transform object that can be used for 2D/3D positioning, scaling, and rotation.
|
||||
|
||||
### clean_transforms
|
||||
### clean_transforms() <sub>function</sub>
|
||||
|
||||
Force an update on all transforms to remove dangling references or perform house-keeping.
|
||||
|
||||
### platform
|
||||
### platform() <sub>function</sub>
|
||||
|
||||
Return a string with the underlying platform name, like 'Windows', 'Linux', or 'macOS'.
|
||||
|
||||
### arch
|
||||
### arch() <sub>function</sub>
|
||||
|
||||
Return the CPU architecture string for this system (e.g. 'x64', 'arm64').
|
||||
|
||||
### totalmem
|
||||
### totalmem() <sub>function</sub>
|
||||
|
||||
Return the total system RAM in bytes.
|
||||
|
||||
### freemem
|
||||
### freemem() <sub>function</sub>
|
||||
|
||||
Return the amount of free system RAM in bytes, if known.
|
||||
|
||||
### hostname
|
||||
### hostname() <sub>function</sub>
|
||||
|
||||
Return the system's hostname, or an empty string if not available.
|
||||
|
||||
### version
|
||||
### version() <sub>function</sub>
|
||||
|
||||
Return the OS or kernel version string, if the platform provides it.
|
||||
|
||||
### kill
|
||||
### kill() <sub>function</sub>
|
||||
|
||||
Send a signal (e.g., 'SIGINT', 'SIGTERM', etc.) to the current process.
|
||||
|
||||
### exit
|
||||
### exit() <sub>function</sub>
|
||||
|
||||
Exit the application with the specified exit code.
|
||||
|
||||
### now
|
||||
### now() <sub>function</sub>
|
||||
|
||||
Return current time (in seconds as a float) with high resolution.
|
||||
|
||||
### openurl
|
||||
### openurl() <sub>function</sub>
|
||||
|
||||
Open the provided URL in the default web browser, if possible.
|
||||
|
||||
### make_timer
|
||||
### make_timer() <sub>function</sub>
|
||||
|
||||
Create a new timer object that will call a specified function after a certain delay.
|
||||
|
||||
### update_timers
|
||||
### update_timers() <sub>function</sub>
|
||||
|
||||
Advance all timers by the provided time delta (in seconds).
|
||||
|
||||
### sleep
|
||||
### sleep() <sub>function</sub>
|
||||
|
||||
Block execution for the specified number of seconds.
|
||||
|
||||
### battery_pct
|
||||
### battery_pct() <sub>function</sub>
|
||||
|
||||
Return the battery level (percentage) or negative if unknown.
|
||||
|
||||
### battery_voltage
|
||||
### battery_voltage() <sub>function</sub>
|
||||
|
||||
Return the current battery voltage in volts, if available.
|
||||
|
||||
### battery_seconds
|
||||
### battery_seconds() <sub>function</sub>
|
||||
|
||||
Return the estimated remaining battery time in seconds, or negative if unknown.
|
||||
|
||||
### power_state
|
||||
### power_state() <sub>function</sub>
|
||||
|
||||
Return a string describing power status: 'on battery', 'charging', 'charged', etc.
|
||||
|
||||
### on
|
||||
### on() <sub>function</sub>
|
||||
|
||||
Register a global callback for certain engine-wide or system-level events.
|
||||
|
||||
### rt_info
|
||||
### rt_info() <sub>function</sub>
|
||||
|
||||
Return internal QuickJS runtime info, such as object counts.
|
||||
|
||||
### rusage
|
||||
### rusage() <sub>function</sub>
|
||||
|
||||
Return resource usage stats for this process, if the platform supports it.
|
||||
|
||||
### mallinfo
|
||||
### mallinfo() <sub>function</sub>
|
||||
|
||||
Return detailed memory allocation info (arena size, free blocks, etc.) on some platforms.
|
||||
|
||||
### env
|
||||
### env() <sub>function</sub>
|
||||
|
||||
Fetch the value of a given environment variable, or undefined if it doesn't exist.
|
||||
|
||||
### system
|
||||
### system() <sub>function</sub>
|
||||
|
||||
Execute a shell command using the system() call. Returns the command's exit code.
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# packer
|
||||
|
||||
## packer
|
||||
|
||||
### getAllFiles(dir)
|
||||
### getAllFiles(dir) <sub>function</sub>
|
||||
|
||||
|
||||
Return a list of all files in the given directory that are not matched by .prosperonignore,
|
||||
@@ -16,7 +14,7 @@ skipping directories.
|
||||
**Returns**: An array of file paths found.
|
||||
|
||||
|
||||
### gatherStats(filePaths)
|
||||
### gatherStats(filePaths) <sub>function</sub>
|
||||
|
||||
|
||||
Analyze a list of files and categorize them as modules, programs, images, or other.
|
||||
@@ -29,7 +27,7 @@ Analyze a list of files and categorize them as modules, programs, images, or oth
|
||||
**Returns**: An object { modules, programs, images, other, total } with counts.
|
||||
|
||||
|
||||
### pack(dir, outPath)
|
||||
### pack(dir, outPath) <sub>function</sub>
|
||||
|
||||
|
||||
Create a ZIP archive of all files (skipping those matched by .prosperonignore) in the
|
||||
|
||||
@@ -1,25 +1,15 @@
|
||||
# render
|
||||
|
||||
## render
|
||||
### _main <sub>object</sub>
|
||||
|
||||
A handle for low-level GPU operations via SDL GPU. Freed on GC.
|
||||
|
||||
|
||||
An application window, created via prosperon.engine_start or SDL calls. Freed on GC.
|
||||
### device <sub>object</sub>
|
||||
|
||||
### stencil_writer(...args) <sub>function</sub>
|
||||
|
||||
#### present
|
||||
|
||||
Perform the per-frame rendering and present the final swapchain image, including imgui pass if available.
|
||||
|
||||
|
||||
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### stencil_writer(...args)
|
||||
|
||||
### fillmask(ref)
|
||||
### fillmask(ref) <sub>function</sub>
|
||||
|
||||
Draw a fullscreen shape using a 'screenfill' shader to populate the stencil buffer with a given reference.
|
||||
|
||||
@@ -31,7 +21,7 @@ Draw a fullscreen shape using a 'screenfill' shader to populate the stencil buff
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### mask(image, pos, scale, rotation, ref)
|
||||
### mask(image, pos, scale, rotation, ref) <sub>function</sub>
|
||||
|
||||
Draw an image to the stencil buffer, marking its area with a specified reference value.
|
||||
|
||||
@@ -51,7 +41,7 @@ Draw an image to the stencil buffer, marking its area with a specified reference
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### viewport(rect)
|
||||
### viewport(rect) <sub>function</sub>
|
||||
|
||||
Set the GPU viewport to the specified rectangle.
|
||||
|
||||
@@ -63,7 +53,7 @@ Set the GPU viewport to the specified rectangle.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### scissor(rect)
|
||||
### scissor(rect) <sub>function</sub>
|
||||
|
||||
Set the GPU scissor region to the specified rectangle (alias of render.viewport).
|
||||
|
||||
@@ -75,7 +65,7 @@ Set the GPU scissor region to the specified rectangle (alias of render.viewport)
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### queue(cmd)
|
||||
### queue(cmd) <sub>function</sub>
|
||||
|
||||
Enqueue one or more draw commands. These commands are batched until render_camera is called.
|
||||
|
||||
@@ -87,7 +77,7 @@ Enqueue one or more draw commands. These commands are batched until render_camer
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### setup_draw
|
||||
### setup_draw() <sub>function</sub>
|
||||
|
||||
Switch the current queue to the primary scene render queue, then invoke 'prosperon.draw' if defined.
|
||||
|
||||
@@ -96,7 +86,7 @@ Switch the current queue to the primary scene render queue, then invoke 'prosper
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### setup_hud
|
||||
### setup_hud() <sub>function</sub>
|
||||
|
||||
Switch the current queue to the HUD render queue, then invoke 'prosperon.hud' if defined.
|
||||
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
# resources
|
||||
|
||||
## resources
|
||||
### scripts <sub>object</sub>
|
||||
|
||||
### canonical(file)
|
||||
### images <sub>object</sub>
|
||||
|
||||
### find_image(...args)
|
||||
### sounds <sub>object</sub>
|
||||
|
||||
### find_sound(...args)
|
||||
### fonts <sub>object</sub>
|
||||
|
||||
### find_script(...args)
|
||||
### lib <sub>object</sub>
|
||||
|
||||
### find_font(...args)
|
||||
### canonical(file) <sub>function</sub>
|
||||
|
||||
### getAllFiles(dir)
|
||||
### find_image(...args) <sub>function</sub>
|
||||
|
||||
### find_sound(...args) <sub>function</sub>
|
||||
|
||||
### find_script(...args) <sub>function</sub>
|
||||
|
||||
### find_font(...args) <sub>function</sub>
|
||||
|
||||
### getAllFiles(dir) <sub>function</sub>
|
||||
|
||||
|
||||
Return a list of recognized files in the given directory that are not matched by
|
||||
@@ -27,7 +35,7 @@ images, sounds, fonts, and libs.
|
||||
**Returns**: An array of recognized file paths.
|
||||
|
||||
|
||||
### gatherStats(filePaths)
|
||||
### gatherStats(filePaths) <sub>function</sub>
|
||||
|
||||
|
||||
Analyze a list of recognized files and categorize them by scripts, images, sounds,
|
||||
@@ -41,7 +49,7 @@ fonts, libs, or other. Return a stats object with these counts and the total.
|
||||
**Returns**: { scripts, images, sounds, fonts, lib, other, total }
|
||||
|
||||
|
||||
### pack(dir, outPath)
|
||||
### pack(dir, outPath) <sub>function</sub>
|
||||
|
||||
|
||||
Create a ZIP archive of all recognized files (skipping those matched by .prosperonignore)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# sound
|
||||
|
||||
## sound
|
||||
### undefined <sub>string</sub>
|
||||
|
||||
### pcm(file)
|
||||
### pcm(file) <sub>function</sub>
|
||||
|
||||
### play(file)
|
||||
### play(file) <sub>function</sub>
|
||||
|
||||
### cry(file)
|
||||
### cry(file) <sub>function</sub>
|
||||
|
||||
### music(file, fade = 0.5)
|
||||
### music(file, fade = 0.5) <sub>function</sub>
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
# spline
|
||||
|
||||
## spline
|
||||
|
||||
### catmull
|
||||
### catmull() <sub>function</sub>
|
||||
|
||||
Perform Catmull-Rom spline sampling on an array of 2D points, returning an array of samples.
|
||||
|
||||
### bezier
|
||||
### bezier() <sub>function</sub>
|
||||
|
||||
Perform a Bezier spline (or catmull) sampling on 2D points, returning an array of sampled points.
|
||||
|
||||
@@ -2,54 +2,102 @@
|
||||
|
||||
The main time object, handling date/time utilities in earth-seconds.
|
||||
|
||||
### now
|
||||
### now() <sub>function</sub>
|
||||
|
||||
Return the current system time in seconds (implemented in C extension).
|
||||
|
||||
### computer_dst
|
||||
### computer_dst() <sub>function</sub>
|
||||
|
||||
Return true if local system time is currently in DST (implemented in C extension).
|
||||
|
||||
### computer_zone
|
||||
### computer_zone() <sub>function</sub>
|
||||
|
||||
Return local time zone offset from UTC in hours (implemented in C extension).
|
||||
|
||||
### hour2minute
|
||||
### second <sub>number</sub>
|
||||
|
||||
Number of seconds in a (real) second (always 1).
|
||||
|
||||
### minute <sub>number</sub>
|
||||
|
||||
Number of seconds in a minute (60).
|
||||
|
||||
### hour <sub>number</sub>
|
||||
|
||||
Number of seconds in an hour (3600).
|
||||
|
||||
### day <sub>number</sub>
|
||||
|
||||
Number of seconds in a day (86400).
|
||||
|
||||
### week <sub>number</sub>
|
||||
|
||||
Number of seconds in a week (604800).
|
||||
|
||||
### weekdays <sub>object</sub>
|
||||
|
||||
Names of the days of the week, Sunday through Saturday.
|
||||
|
||||
### monthstr <sub>object</sub>
|
||||
|
||||
Full names of the months of the year, January through December.
|
||||
|
||||
### epoch <sub>number</sub>
|
||||
|
||||
Base epoch year, from which day 0 is calculated (default 1970).
|
||||
|
||||
### hour2minute() <sub>function</sub>
|
||||
|
||||
Return the ratio of hour to minute in seconds, e.g. 3600 / 60 => 60.
|
||||
|
||||
### day2hour
|
||||
### day2hour() <sub>function</sub>
|
||||
|
||||
Return the ratio of day to hour in seconds, e.g. 86400 / 3600 => 24.
|
||||
|
||||
### minute2second
|
||||
### minute2second() <sub>function</sub>
|
||||
|
||||
Return the ratio of minute to second in seconds, e.g. 60 / 1 => 60.
|
||||
|
||||
### week2day
|
||||
### week2day() <sub>function</sub>
|
||||
|
||||
Return the ratio of week to day in seconds, e.g. 604800 / 86400 => 7.
|
||||
|
||||
### isleap(year)
|
||||
### strparse <sub>object</sub>
|
||||
|
||||
Mapping of format tokens (yyyy, mm, dd, etc.) to time fields (year, month, day...).
|
||||
|
||||
### isleap(year) <sub>function</sub>
|
||||
|
||||
Return true if a given year is leap, based on whether it has 366 days.
|
||||
|
||||
### yearsize(y)
|
||||
### yearsize(y) <sub>function</sub>
|
||||
|
||||
Given a year, return 365 or 366 depending on leap-year rules.
|
||||
|
||||
### timecode(t, fps = 24)
|
||||
### timecode(t, fps = 24) <sub>function</sub>
|
||||
|
||||
Convert seconds into a "S:frames" timecode string, with optional FPS (default 24).
|
||||
|
||||
### record(num, zone = this.computer_zone()
|
||||
### monthdays <sub>object</sub>
|
||||
|
||||
An array of days in each month for a non-leap year.
|
||||
|
||||
### zones <sub>object</sub>
|
||||
|
||||
Table of recognized time zone abbreviations, with offsets (e.g., "-12" -> "IDLW").
|
||||
|
||||
### record(num, zone = this.computer_zone() <sub>function</sub>
|
||||
|
||||
Convert a timestamp (in seconds) into a record with fields like day, month, year, etc.
|
||||
|
||||
### number(rec)
|
||||
### number(rec) <sub>function</sub>
|
||||
|
||||
Convert a record back into a numeric timestamp (seconds).
|
||||
|
||||
### text(num, fmt = this.fmt, zone)
|
||||
### fmt <sub>string</sub>
|
||||
|
||||
Default format string for time.text(), containing tokens like 'yyyy', 'dd', 'hh', etc.
|
||||
|
||||
### text(num, fmt = this.fmt, zone) <sub>function</sub>
|
||||
|
||||
Format a numeric or record time into a string using a format pattern, e.g. 'hh:nn:ss'.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# tween
|
||||
|
||||
## tween
|
||||
### Tween <sub>object</sub>
|
||||
|
||||
|
||||
An object providing methods to create and control tweens with additional features
|
||||
@@ -13,17 +13,7 @@ Methods:
|
||||
- make: Alias of start.
|
||||
|
||||
|
||||
#### start(obj, target, tvals, options)
|
||||
|
||||
|
||||
Alias of Tween.start. See Tween.start for usage details.
|
||||
|
||||
|
||||
#### make(obj, target, tvals, options)
|
||||
|
||||
|
||||
Alias of Tween.start. See Tween.start for usage details.
|
||||
|
||||
### Ease <sub>object</sub>
|
||||
|
||||
|
||||
This object provides multiple easing functions that remap a 0..1 input to produce
|
||||
@@ -44,15 +34,7 @@ Available functions:
|
||||
All easing functions expect t in [0..1] and return a remapped value in [0..1].
|
||||
|
||||
|
||||
#### linear(t)
|
||||
|
||||
#### in(t)
|
||||
|
||||
#### out(t)
|
||||
|
||||
#### inout(t)
|
||||
|
||||
### tween(from, to, time, fn, cb)
|
||||
### tween(from, to, time, fn, cb) <sub>function</sub>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ A collection of general-purpose utility functions for object manipulation, mergi
|
||||
deep copying, safe property access, etc.
|
||||
|
||||
|
||||
### guid
|
||||
### guid() <sub>function</sub>
|
||||
|
||||
|
||||
Return a random 32-character hexadecimal UUID-like string (not guaranteed RFC4122-compliant).
|
||||
@@ -14,7 +14,7 @@ Return a random 32-character hexadecimal UUID-like string (not guaranteed RFC412
|
||||
**Returns**: A random 32-character string (hex).
|
||||
|
||||
|
||||
### insertion_sort(arr, cmp)
|
||||
### insertion_sort(arr, cmp) <sub>function</sub>
|
||||
|
||||
|
||||
In-place insertion sort of an array using cmp(a,b)->Number for ordering.
|
||||
@@ -28,7 +28,7 @@ In-place insertion sort of an array using cmp(a,b)->Number for ordering.
|
||||
**Returns**: The same array, sorted in-place.
|
||||
|
||||
|
||||
### deepfreeze(obj)
|
||||
### deepfreeze(obj) <sub>function</sub>
|
||||
|
||||
|
||||
Recursively freeze an object and all of its nested objects so they cannot be modified.
|
||||
@@ -40,7 +40,7 @@ Recursively freeze an object and all of its nested objects so they cannot be mod
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### dainty_assign(target, source)
|
||||
### dainty_assign(target, source) <sub>function</sub>
|
||||
|
||||
|
||||
Copy non-function properties from source into matching keys of target without overwriting
|
||||
@@ -55,7 +55,7 @@ keys that don't exist in target. Arrays are deep-copied, and objects are recursi
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### get(obj, path, defValue)
|
||||
### get(obj, path, defValue) <sub>function</sub>
|
||||
|
||||
|
||||
Safely retrieve a nested property from obj at path (array or dot-string).
|
||||
@@ -72,7 +72,7 @@ Returns defValue if the property is undefined.
|
||||
**Returns**: The nested property or defValue.
|
||||
|
||||
|
||||
### isEmpty(o)
|
||||
### isEmpty(o) <sub>function</sub>
|
||||
|
||||
|
||||
Return true if the object has no own properties, otherwise false.
|
||||
@@ -84,7 +84,7 @@ Return true if the object has no own properties, otherwise false.
|
||||
**Returns**: Boolean indicating if the object is empty.
|
||||
|
||||
|
||||
### dig(obj, path, def)
|
||||
### dig(obj, path, def) <sub>function</sub>
|
||||
|
||||
|
||||
Ensure a nested path of objects exists inside obj; create objects if missing, and set
|
||||
@@ -101,7 +101,7 @@ the final path component to def.
|
||||
**Returns**: The assigned final value.
|
||||
|
||||
|
||||
### access(obj, name)
|
||||
### access(obj, name) <sub>function</sub>
|
||||
|
||||
|
||||
Traverse obj by dot-separated path name, returning the final value or undefined
|
||||
@@ -116,7 +116,7 @@ if any step is missing.
|
||||
**Returns**: The value at that path, or undefined if missing.
|
||||
|
||||
|
||||
### mergekey(o1, o2, k)
|
||||
### mergekey(o1, o2, k) <sub>function</sub>
|
||||
|
||||
|
||||
Helper for merge, updating key k from o2 into o1. Arrays are deep-copied and objects are
|
||||
@@ -133,7 +133,7 @@ recursively merged.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### merge(target, objs)
|
||||
### merge(target, objs) <sub>function</sub>
|
||||
|
||||
|
||||
Merge all passed objects into target, copying or merging each key as needed.
|
||||
@@ -148,7 +148,7 @@ Arrays are deep-copied, objects are recursively merged, etc.
|
||||
**Returns**: The updated target object.
|
||||
|
||||
|
||||
### copy(proto, objs)
|
||||
### copy(proto, objs) <sub>function</sub>
|
||||
|
||||
|
||||
Create a new object with proto as its prototype, then mix in additional objects’ properties.
|
||||
@@ -162,7 +162,7 @@ Create a new object with proto as its prototype, then mix in additional objects
|
||||
**Returns**: The newly created object.
|
||||
|
||||
|
||||
### obj_lerp(a, b, t)
|
||||
### obj_lerp(a, b, t) <sub>function</sub>
|
||||
|
||||
|
||||
Linearly interpolate between two objects a and b by factor t, assuming each property
|
||||
@@ -179,7 +179,7 @@ supports .lerp().
|
||||
**Returns**: A new object with interpolated properties.
|
||||
|
||||
|
||||
### normalizeSpacing(spacing)
|
||||
### normalizeSpacing(spacing) <sub>function</sub>
|
||||
|
||||
|
||||
Normalize any spacing input into a {l, r, t, b} object.
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# video
|
||||
|
||||
## video
|
||||
|
||||
### make_video
|
||||
### make_video() <sub>function</sub>
|
||||
|
||||
Decode a video file (MPEG, etc.) from an ArrayBuffer, returning a datastream object.
|
||||
|
||||
@@ -1,51 +1,103 @@
|
||||
# prosperon
|
||||
|
||||
## prosperon
|
||||
### c_types <sub>object</sub>
|
||||
|
||||
### engine_start
|
||||
### argv <sub>object</sub>
|
||||
|
||||
### on(type, callback)
|
||||
### version <sub>string</sub>
|
||||
|
||||
### dispatch(type, data)
|
||||
### revision <sub>string</sub>
|
||||
|
||||
### appupdate(...args)
|
||||
### engine_start() <sub>function</sub>
|
||||
|
||||
### update(...args)
|
||||
### DOC <sub>symbol</sub>
|
||||
|
||||
### physupdate(...args)
|
||||
### on(type, callback) <sub>function</sub>
|
||||
|
||||
### gui(...args)
|
||||
### dispatch(type, data) <sub>function</sub>
|
||||
|
||||
### hud(...args)
|
||||
### PATH <sub>object</sub>
|
||||
|
||||
### draw(...args)
|
||||
### appupdate(...args) <sub>function</sub>
|
||||
|
||||
### imgui(...args)
|
||||
### update(...args) <sub>function</sub>
|
||||
|
||||
### app(...args)
|
||||
### physupdate(...args) <sub>function</sub>
|
||||
|
||||
### camera
|
||||
### gui(...args) <sub>function</sub>
|
||||
|
||||
A hierarchical transform storing 3D or 2D position, rotation (as a quaternion),
|
||||
and scale. Can have a parent transform. Freed automatically on GC.
|
||||
### hud(...args) <sub>function</sub>
|
||||
|
||||
### draw(...args) <sub>function</sub>
|
||||
|
||||
### imgui(...args) <sub>function</sub>
|
||||
|
||||
### app(...args) <sub>function</sub>
|
||||
|
||||
### date <sub>string</sub>
|
||||
|
||||
### camera <sub>object</sub>
|
||||
|
||||
### debug <sub>boolean</sub>
|
||||
|
||||
### semver <sub>object</sub>
|
||||
|
||||
### title <sub>string</sub>
|
||||
|
||||
### width <sub>number</sub>
|
||||
|
||||
### height <sub>number</sub>
|
||||
|
||||
### size <sub>object</sub>
|
||||
|
||||
### icon <sub>object</sub>
|
||||
|
||||
### high_dpi <sub>number</sub>
|
||||
|
||||
### alpha <sub>number</sub>
|
||||
|
||||
### fullscreen <sub>number</sub>
|
||||
|
||||
### sample_count <sub>number</sub>
|
||||
|
||||
### enable_clipboard <sub>boolean</sub>
|
||||
|
||||
### enable_dragndrop <sub>boolean</sub>
|
||||
|
||||
### max_dropped_files <sub>number</sub>
|
||||
|
||||
### swap_interval <sub>number</sub>
|
||||
|
||||
### name <sub>string</sub>
|
||||
|
||||
### identifier <sub>string</sub>
|
||||
|
||||
### creator <sub>string</sub>
|
||||
|
||||
### copyright <sub>string</sub>
|
||||
|
||||
### type <sub>string</sub>
|
||||
|
||||
### url <sub>string</sub>
|
||||
|
||||
### postvals <sub>object</sub>
|
||||
|
||||
### hudcam <sub>object</sub>
|
||||
|
||||
### appcam <sub>object</sub>
|
||||
|
||||
### screencolor <sub>object</sub>
|
||||
|
||||
### window <sub>object</sub>
|
||||
|
||||
An application window, created via prosperon.engine_start or SDL calls. Freed on GC.
|
||||
|
||||
|
||||
### font <sub>object</sub>
|
||||
|
||||
### gpu <sub>object</sub>
|
||||
|
||||
A handle for low-level GPU operations via SDL GPU. Freed on GC.
|
||||
|
||||
|
||||
An application window, created via prosperon.engine_start or SDL calls. Freed on GC.
|
||||
|
||||
|
||||
#### present
|
||||
|
||||
Perform the per-frame rendering and present the final swapchain image, including imgui pass if available.
|
||||
|
||||
|
||||
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### exit
|
||||
### exit() <sub>function</sub>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
A file handle opened via PhysFS for writing or reading. Freed automatically when references go away.
|
||||
|
||||
|
||||
### close
|
||||
### close() <sub>function</sub>
|
||||
|
||||
Close this file handle. Throws on error.
|
||||
|
||||
@@ -12,7 +12,7 @@ Close this file handle. Throws on error.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### write(data)
|
||||
### write(data) <sub>function</sub>
|
||||
|
||||
Write data (string or ArrayBuffer) to the file. Throws on error.
|
||||
|
||||
@@ -24,7 +24,7 @@ Write data (string or ArrayBuffer) to the file. Throws on error.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### buffer(size)
|
||||
### buffer(size) <sub>function</sub>
|
||||
|
||||
Enable an internal write buffer of the given size on this file.
|
||||
|
||||
@@ -36,7 +36,7 @@ Enable an internal write buffer of the given size on this file.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### tell
|
||||
### tell() <sub>function</sub>
|
||||
|
||||
Return the current position in the file.
|
||||
|
||||
@@ -45,7 +45,7 @@ Return the current position in the file.
|
||||
**Returns**: A numeric offset.
|
||||
|
||||
|
||||
### eof
|
||||
### eof() <sub>function</sub>
|
||||
|
||||
Return whether the file pointer is at end-of-file.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
A handle to a physical camera device. Freed when references drop or camera is closed.
|
||||
|
||||
|
||||
### frame
|
||||
### frame() <sub>function</sub>
|
||||
|
||||
Acquire the latest camera frame (as an SDL_Surface). Returns undefined if no
|
||||
new frame is available yet. Throws on error.
|
||||
@@ -13,7 +13,7 @@ new frame is available yet. Throws on error.
|
||||
**Returns**: SDL_Surface or undefined.
|
||||
|
||||
|
||||
### release_frame(surface)
|
||||
### release_frame(surface) <sub>function</sub>
|
||||
|
||||
Release a frame surface previously acquired via camera.frame(). Must be
|
||||
done for each acquired frame.
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# SDL_GPUBuffer
|
||||
|
||||
## SDL_GPUBuffer
|
||||
|
||||
### name
|
||||
### name() <sub>function</sub>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
A command buffer that accumulates rendering, copy, and compute operations. Freed after submission or GC.
|
||||
|
||||
|
||||
### render_pass(passDesc)
|
||||
### render_pass(passDesc) <sub>function</sub>
|
||||
|
||||
Begin a render pass with color/depth attachments. Provide an object with
|
||||
'color_targets' and optional 'depth_stencil'. Returns an SDL_GPURenderPass handle.
|
||||
@@ -16,7 +16,7 @@ Begin a render pass with color/depth attachments. Provide an object with
|
||||
**Returns**: SDL_GPURenderPass
|
||||
|
||||
|
||||
### compute_pass(storageTextures, storageBuffers)
|
||||
### compute_pass(storageTextures, storageBuffers) <sub>function</sub>
|
||||
|
||||
Begin a compute pass reading/writing given arrays of textures and buffers.
|
||||
|
||||
@@ -30,7 +30,7 @@ Begin a compute pass reading/writing given arrays of textures and buffers.
|
||||
**Returns**: SDL_GPUComputePass
|
||||
|
||||
|
||||
### swapchain_pass(clearColor)
|
||||
### swapchain_pass(clearColor) <sub>function</sub>
|
||||
|
||||
Begin a render pass that directly targets the swapchain (the window). Clears
|
||||
with the specified color.
|
||||
@@ -43,7 +43,7 @@ with the specified color.
|
||||
**Returns**: SDL_GPURenderPass
|
||||
|
||||
|
||||
### acquire_swapchain
|
||||
### acquire_swapchain() <sub>function</sub>
|
||||
|
||||
Acquire the current swapchain texture from the window. Internal usage.
|
||||
|
||||
@@ -52,7 +52,7 @@ Acquire the current swapchain texture from the window. Internal usage.
|
||||
**Returns**: SDL_GPUTexture handle
|
||||
|
||||
|
||||
### bind_vertex_buffer(slot, buffer)
|
||||
### bind_vertex_buffer(slot, buffer) <sub>function</sub>
|
||||
|
||||
Bind a GPU buffer as the vertex buffer at a given slot.
|
||||
|
||||
@@ -66,7 +66,7 @@ Bind a GPU buffer as the vertex buffer at a given slot.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### bind_index_buffer(buffer, offset)
|
||||
### bind_index_buffer(buffer, offset) <sub>function</sub>
|
||||
|
||||
Bind a GPU buffer as the index buffer (16-bit or 32-bit).
|
||||
|
||||
@@ -80,7 +80,7 @@ Bind a GPU buffer as the index buffer (16-bit or 32-bit).
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### bind_fragment_sampler(slot, texture, sampler)
|
||||
### bind_fragment_sampler(slot, texture, sampler) <sub>function</sub>
|
||||
|
||||
Bind a texture+sampler pair to a particular fragment shader slot.
|
||||
|
||||
@@ -96,7 +96,7 @@ Bind a texture+sampler pair to a particular fragment shader slot.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### push_vertex_uniform_data(slot, data)
|
||||
### push_vertex_uniform_data(slot, data) <sub>function</sub>
|
||||
|
||||
Push raw data to a vertex shader uniform block.
|
||||
|
||||
@@ -110,7 +110,7 @@ Push raw data to a vertex shader uniform block.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### push_fragment_uniform_data(slot, data)
|
||||
### push_fragment_uniform_data(slot, data) <sub>function</sub>
|
||||
|
||||
Push raw data to a fragment shader uniform block.
|
||||
|
||||
@@ -124,7 +124,7 @@ Push raw data to a fragment shader uniform block.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### push_compute_uniform_data(slot, data)
|
||||
### push_compute_uniform_data(slot, data) <sub>function</sub>
|
||||
|
||||
Push raw data to a compute shader uniform buffer.
|
||||
|
||||
@@ -138,7 +138,7 @@ Push raw data to a compute shader uniform buffer.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### submit
|
||||
### submit() <sub>function</sub>
|
||||
|
||||
Submit this command buffer to the GPU and return a fence for synchronization.
|
||||
|
||||
@@ -147,7 +147,7 @@ Submit this command buffer to the GPU and return a fence for synchronization.
|
||||
**Returns**: An SDL_GPUFence
|
||||
|
||||
|
||||
### cancel
|
||||
### cancel() <sub>function</sub>
|
||||
|
||||
Cancel (discard) this command buffer without submitting.
|
||||
|
||||
@@ -156,7 +156,7 @@ Cancel (discard) this command buffer without submitting.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### camera(cameraTransform, uniformSlot)
|
||||
### camera(cameraTransform, uniformSlot) <sub>function</sub>
|
||||
|
||||
Write a camera transform (projection/view) to a uniform slot for 3D or 2D usage.
|
||||
|
||||
@@ -170,7 +170,7 @@ Write a camera transform (projection/view) to a uniform slot for 3D or 2D usage.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### hud(sizeVec2, uniformSlot)
|
||||
### hud(sizeVec2, uniformSlot) <sub>function</sub>
|
||||
|
||||
Write an orthographic full-screen "HUD" matrix to a uniform slot. Typically used
|
||||
for 2D overlays.
|
||||
@@ -185,7 +185,7 @@ for 2D overlays.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### push_debug_group(name)
|
||||
### push_debug_group(name) <sub>function</sub>
|
||||
|
||||
Push a named debug group marker onto the GPU command list (for debuggers/profilers).
|
||||
|
||||
@@ -197,7 +197,7 @@ Push a named debug group marker onto the GPU command list (for debuggers/profile
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### pop_debug_group
|
||||
### pop_debug_group() <sub>function</sub>
|
||||
|
||||
Pop the most recent debug group marker.
|
||||
|
||||
@@ -206,7 +206,7 @@ Pop the most recent debug group marker.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### debug_label(label)
|
||||
### debug_label(label) <sub>function</sub>
|
||||
|
||||
Insert a one-off debug label at the current spot in the command list.
|
||||
|
||||
@@ -218,7 +218,7 @@ Insert a one-off debug label at the current spot in the command list.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### blit(blitDesc)
|
||||
### blit(blitDesc) <sub>function</sub>
|
||||
|
||||
Blit one GPU texture to another with optional flip mode, filter, and clear operations.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
A compute pass for dispatching compute pipelines. Freed after end() or GC.
|
||||
|
||||
|
||||
### dispatch(x, y, z)
|
||||
### dispatch(x, y, z) <sub>function</sub>
|
||||
|
||||
Dispatch the compute pipeline with the specified threadgroup counts.
|
||||
|
||||
@@ -19,7 +19,7 @@ Dispatch the compute pipeline with the specified threadgroup counts.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### end
|
||||
### end() <sub>function</sub>
|
||||
|
||||
End this compute pass.
|
||||
|
||||
@@ -28,7 +28,7 @@ End this compute pass.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### pipeline(computePipeline)
|
||||
### pipeline(computePipeline) <sub>function</sub>
|
||||
|
||||
Bind a compute pipeline in this pass.
|
||||
|
||||
@@ -40,7 +40,7 @@ Bind a compute pipeline in this pass.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### samplers(arrayOfSamplerBindings, firstSlot)
|
||||
### samplers(arrayOfSamplerBindings, firstSlot) <sub>function</sub>
|
||||
|
||||
Bind a set of texture/sampler pairs for compute usage.
|
||||
|
||||
@@ -54,7 +54,7 @@ Bind a set of texture/sampler pairs for compute usage.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### storage_buffers(arrayOfBuffers, firstSlot)
|
||||
### storage_buffers(arrayOfBuffers, firstSlot) <sub>function</sub>
|
||||
|
||||
Bind an array of storage buffers for the compute shader.
|
||||
|
||||
@@ -68,7 +68,7 @@ Bind an array of storage buffers for the compute shader.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### storage_textures(arrayOfTextures, firstSlot)
|
||||
### storage_textures(arrayOfTextures, firstSlot) <sub>function</sub>
|
||||
|
||||
Bind an array of storage textures for the compute shader.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
A handle for low-level GPU operations via SDL GPU. Freed on GC.
|
||||
|
||||
|
||||
### claim_window(window)
|
||||
### claim_window(window) <sub>function</sub>
|
||||
|
||||
Claim an existing SDL_Window so this GPU device can render to it.
|
||||
|
||||
@@ -15,7 +15,7 @@ Claim an existing SDL_Window so this GPU device can render to it.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### make_pipeline(pipelineDesc)
|
||||
### make_pipeline(pipelineDesc) <sub>function</sub>
|
||||
|
||||
Create a new graphics pipeline from a descriptor object specifying shaders,
|
||||
blend states, vertex format, etc.
|
||||
@@ -28,7 +28,7 @@ blend states, vertex format, etc.
|
||||
**Returns**: A SDL_GPUGraphicsPipeline handle.
|
||||
|
||||
|
||||
### compute_pipeline(desc)
|
||||
### compute_pipeline(desc) <sub>function</sub>
|
||||
|
||||
Create a compute pipeline from a descriptor (shader code, threadgroup sizes, etc.).
|
||||
|
||||
@@ -40,7 +40,7 @@ Create a compute pipeline from a descriptor (shader code, threadgroup sizes, etc
|
||||
**Returns**: SDL_GPUComputePipeline handle.
|
||||
|
||||
|
||||
### set_swapchain(composition, presentMode)
|
||||
### set_swapchain(composition, presentMode) <sub>function</sub>
|
||||
|
||||
Specify how the swapchain (final rendered image) is composed, e.g. 'sdr', 'hdr',
|
||||
and present mode like 'vsync' or 'immediate'.
|
||||
@@ -55,7 +55,7 @@ and present mode like 'vsync' or 'immediate'.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### sort_sprite(a, b)
|
||||
### sort_sprite(a, b) <sub>function</sub>
|
||||
|
||||
A comparator function used for sorting sprite objects by layer, y, and texture.
|
||||
Usually used internally.
|
||||
@@ -70,7 +70,7 @@ Usually used internally.
|
||||
**Returns**: <0, 0, or >0 for sort ordering.
|
||||
|
||||
|
||||
### make_sampler(samplerDesc)
|
||||
### make_sampler(samplerDesc) <sub>function</sub>
|
||||
|
||||
Create a sampler object specifying filtering, wrapping, anisotropy, etc.
|
||||
|
||||
@@ -82,7 +82,7 @@ Create a sampler object specifying filtering, wrapping, anisotropy, etc.
|
||||
**Returns**: SDL_GPUSampler handle.
|
||||
|
||||
|
||||
### load_texture(surface, compressionLevel)
|
||||
### load_texture(surface, compressionLevel) <sub>function</sub>
|
||||
|
||||
Upload an SDL_Surface into a GPU texture, optionally compressing with DXT. Freed automatically.
|
||||
|
||||
@@ -96,7 +96,7 @@ Upload an SDL_Surface into a GPU texture, optionally compressing with DXT. Freed
|
||||
**Returns**: SDL_GPUTexture
|
||||
|
||||
|
||||
### texture(desc)
|
||||
### texture(desc) <sub>function</sub>
|
||||
|
||||
Create a GPU texture with the specified format usage.
|
||||
|
||||
@@ -108,7 +108,7 @@ Create a GPU texture with the specified format usage.
|
||||
**Returns**: SDL_GPUTexture
|
||||
|
||||
|
||||
### make_quad
|
||||
### make_quad() <sub>function</sub>
|
||||
|
||||
Return a simple 2-triangle quad geometry covering [0,1]x[0,1].
|
||||
Useful for post-processing passes.
|
||||
@@ -118,7 +118,7 @@ Useful for post-processing passes.
|
||||
**Returns**: A mesh {pos, uv, color, indices}.
|
||||
|
||||
|
||||
### driver
|
||||
### driver() <sub>function</sub>
|
||||
|
||||
Return the name of the underlying GPU driver in use (e.g. 'OpenGL').
|
||||
|
||||
@@ -127,7 +127,7 @@ Return the name of the underlying GPU driver in use (e.g. 'OpenGL').
|
||||
**Returns**: A string with driver name.
|
||||
|
||||
|
||||
### make_shader(desc)
|
||||
### make_shader(desc) <sub>function</sub>
|
||||
|
||||
Compile raw shader code (vertex or fragment) in e.g. SPIR-V, MSL, or DXIL format.
|
||||
|
||||
@@ -139,7 +139,7 @@ Compile raw shader code (vertex or fragment) in e.g. SPIR-V, MSL, or DXIL format
|
||||
**Returns**: SDL_GPUShader object
|
||||
|
||||
|
||||
### acquire_cmd_buffer
|
||||
### acquire_cmd_buffer() <sub>function</sub>
|
||||
|
||||
Obtain a new command buffer for recording GPU commands. Must be submitted or canceled.
|
||||
|
||||
@@ -148,7 +148,7 @@ Obtain a new command buffer for recording GPU commands. Must be submitted or can
|
||||
**Returns**: SDL_GPUCommandBuffer handle
|
||||
|
||||
|
||||
### upload(cmdBuffer, buffers, transferBuffer)
|
||||
### upload(cmdBuffer, buffers, transferBuffer) <sub>function</sub>
|
||||
|
||||
Upload CPU data into a list of GPU buffers, optionally reusing or returning a
|
||||
transfer buffer. Typically you provide (cmdBuf, arrayOfTypedArrays, [transferBuffer]).
|
||||
@@ -165,7 +165,7 @@ transfer buffer. Typically you provide (cmdBuf, arrayOfTypedArrays, [transferBuf
|
||||
**Returns**: The transfer buffer used or newly created.
|
||||
|
||||
|
||||
### wait_for_fences(fences, waitAll)
|
||||
### wait_for_fences(fences, waitAll) <sub>function</sub>
|
||||
|
||||
Wait on an array of GPU fence objects, optionally requiring all or any.
|
||||
|
||||
@@ -179,7 +179,7 @@ Wait on an array of GPU fence objects, optionally requiring all or any.
|
||||
**Returns**: True if fences signaled, false on timeout or error.
|
||||
|
||||
|
||||
### query_fence(fence)
|
||||
### query_fence(fence) <sub>function</sub>
|
||||
|
||||
Check if the given fence has been signaled yet. Non-blocking.
|
||||
|
||||
@@ -191,7 +191,7 @@ Check if the given fence has been signaled yet. Non-blocking.
|
||||
**Returns**: True if signaled, false if still pending
|
||||
|
||||
|
||||
### shader_format
|
||||
### shader_format() <sub>function</sub>
|
||||
|
||||
Return an array of supported GPU shader binary formats (like 'spv', 'dxbc', etc.).
|
||||
|
||||
@@ -200,7 +200,7 @@ Return an array of supported GPU shader binary formats (like 'spv', 'dxbc', etc.
|
||||
**Returns**: Array of strings naming supported formats.
|
||||
|
||||
|
||||
### slice9(texture, dstRect, edges)
|
||||
### slice9(texture, dstRect, edges) <sub>function</sub>
|
||||
|
||||
Generate a 9-slice tiling geometry in one shot. For advanced usage with GPU pipeline.
|
||||
|
||||
@@ -216,7 +216,7 @@ Generate a 9-slice tiling geometry in one shot. For advanced usage with GPU pipe
|
||||
**Returns**: A mesh object
|
||||
|
||||
|
||||
### tile(texture, srcRect, dstRect, tileInfo)
|
||||
### tile(texture, srcRect, dstRect, tileInfo) <sub>function</sub>
|
||||
|
||||
Generate geometry to tile a texture portion inside a dest rect.
|
||||
Often used for repeating backgrounds.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
A single pass of drawing commands with color/depth attachments. Freed after end() or GC.
|
||||
|
||||
|
||||
### bind_pipeline(pipeline)
|
||||
### bind_pipeline(pipeline) <sub>function</sub>
|
||||
|
||||
Bind a previously created graphics pipeline (shaders, states, vertex layouts, etc.).
|
||||
|
||||
@@ -15,7 +15,7 @@ Bind a previously created graphics pipeline (shaders, states, vertex layouts, et
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### viewport(rect)
|
||||
### viewport(rect) <sub>function</sub>
|
||||
|
||||
Set the viewport for clipping or scaling draws, in pass-local coordinates.
|
||||
|
||||
@@ -27,7 +27,7 @@ Set the viewport for clipping or scaling draws, in pass-local coordinates.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### scissor(rect)
|
||||
### scissor(rect) <sub>function</sub>
|
||||
|
||||
Set a scissor rectangle for discarding pixels outside it.
|
||||
|
||||
@@ -39,7 +39,7 @@ Set a scissor rectangle for discarding pixels outside it.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### draw(primitiveType, baseVertex, firstVertex, vertexCount)
|
||||
### draw(primitiveType, baseVertex, firstVertex, vertexCount) <sub>function</sub>
|
||||
|
||||
Issue a non-indexed draw call.
|
||||
|
||||
@@ -57,7 +57,7 @@ Issue a non-indexed draw call.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### draw_indexed(primitiveType, baseVertex, firstIndex, indexCount, instanceCount)
|
||||
### draw_indexed(primitiveType, baseVertex, firstIndex, indexCount, instanceCount) <sub>function</sub>
|
||||
|
||||
Issue an indexed draw call from the bound index buffer.
|
||||
|
||||
@@ -77,7 +77,7 @@ Issue an indexed draw call from the bound index buffer.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### end
|
||||
### end() <sub>function</sub>
|
||||
|
||||
End this render pass, finalizing the draw operations.
|
||||
|
||||
@@ -86,7 +86,7 @@ End this render pass, finalizing the draw operations.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### bind_index_buffer(buffer, elementSize16bit)
|
||||
### bind_index_buffer(buffer, elementSize16bit) <sub>function</sub>
|
||||
|
||||
Bind an index buffer inside this pass, possibly overriding the global one.
|
||||
|
||||
@@ -100,7 +100,7 @@ Bind an index buffer inside this pass, possibly overriding the global one.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### bind_buffers(firstSlot, arrayOfBuffers)
|
||||
### bind_buffers(firstSlot, arrayOfBuffers) <sub>function</sub>
|
||||
|
||||
Bind multiple vertex buffers at consecutive slots.
|
||||
|
||||
@@ -114,7 +114,7 @@ Bind multiple vertex buffers at consecutive slots.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### bind_samplers(vertexOrFragment, firstSlot, samplerBindings)
|
||||
### bind_samplers(vertexOrFragment, firstSlot, samplerBindings) <sub>function</sub>
|
||||
|
||||
Bind multiple texture/sampler pairs to either vertex or fragment slots.
|
||||
|
||||
@@ -130,7 +130,7 @@ Bind multiple texture/sampler pairs to either vertex or fragment slots.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### bind_storage_buffers(firstSlot, buffers)
|
||||
### bind_storage_buffers(firstSlot, buffers) <sub>function</sub>
|
||||
|
||||
Bind one or more storage buffers for read/write in the pipeline.
|
||||
|
||||
@@ -144,7 +144,7 @@ Bind one or more storage buffers for read/write in the pipeline.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### bind_storage_textures(firstSlot, textures)
|
||||
### bind_storage_textures(firstSlot, textures) <sub>function</sub>
|
||||
|
||||
Bind one or more storage textures for read/write in the pipeline.
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# SDL_GPUTexture
|
||||
|
||||
## SDL_GPUTexture
|
||||
|
||||
### name
|
||||
### name() <sub>function</sub>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
A 2D rendering context using the SDL renderer API. Freed automatically.
|
||||
|
||||
|
||||
### draw_color(color)
|
||||
### draw_color(color) <sub>function</sub>
|
||||
|
||||
Set the render draw color for subsequent primitive calls (rect, line, etc.).
|
||||
|
||||
@@ -15,7 +15,7 @@ Set the render draw color for subsequent primitive calls (rect, line, etc.).
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### present
|
||||
### present() <sub>function</sub>
|
||||
|
||||
Display whatever has been rendered (swap buffers). Must be called each frame.
|
||||
|
||||
@@ -24,7 +24,7 @@ Display whatever has been rendered (swap buffers). Must be called each frame.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### clear
|
||||
### clear() <sub>function</sub>
|
||||
|
||||
Clear the current render target with the renderer's draw color.
|
||||
|
||||
@@ -33,7 +33,7 @@ Clear the current render target with the renderer's draw color.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### rect(rectOrArray, color)
|
||||
### rect(rectOrArray, color) <sub>function</sub>
|
||||
|
||||
Draw one or more outlines of rectangles.
|
||||
|
||||
@@ -47,7 +47,7 @@ Draw one or more outlines of rectangles.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### fillrect(rectOrArray, color)
|
||||
### fillrect(rectOrArray, color) <sub>function</sub>
|
||||
|
||||
Fill one or more rectangles with the renderer's current color or an optional override.
|
||||
|
||||
@@ -61,7 +61,7 @@ Fill one or more rectangles with the renderer's current color or an optional ove
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### line(points, color)
|
||||
### line(points, color) <sub>function</sub>
|
||||
|
||||
Draw a sequence of lines connecting points in an array.
|
||||
|
||||
@@ -75,7 +75,7 @@ Draw a sequence of lines connecting points in an array.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### point(points, color)
|
||||
### point(points, color) <sub>function</sub>
|
||||
|
||||
Draw a list of points (pixels).
|
||||
|
||||
@@ -89,7 +89,7 @@ Draw a list of points (pixels).
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### load_texture(surface)
|
||||
### load_texture(surface) <sub>function</sub>
|
||||
|
||||
Create an SDL_Texture from a given SDL_Surface for use with this renderer.
|
||||
|
||||
@@ -101,7 +101,7 @@ Create an SDL_Texture from a given SDL_Surface for use with this renderer.
|
||||
**Returns**: An SDL_Texture object.
|
||||
|
||||
|
||||
### texture(tex, dstRect, srcRect, color)
|
||||
### texture(tex, dstRect, srcRect, color) <sub>function</sub>
|
||||
|
||||
Draw a texture onto the render target.
|
||||
|
||||
@@ -119,7 +119,7 @@ Draw a texture onto the render target.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### slice9(tex, dstRect, edges, srcRect)
|
||||
### slice9(tex, dstRect, edges, srcRect) <sub>function</sub>
|
||||
|
||||
Draw a texture with 9-slice scaling. The argument includes edges {l, r, t, b}
|
||||
for the corners/borders that remain unscaled. The rest is tiled or stretched.
|
||||
@@ -138,7 +138,7 @@ for the corners/borders that remain unscaled. The rest is tiled or stretched.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### tile(tex, dstRect, srcRect, scale)
|
||||
### tile(tex, dstRect, srcRect, scale) <sub>function</sub>
|
||||
|
||||
Tile a texture repeatedly within the specified region. Optionally use a srcRect.
|
||||
|
||||
@@ -156,7 +156,7 @@ Tile a texture repeatedly within the specified region. Optionally use a srcRect.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### get_image(rect)
|
||||
### get_image(rect) <sub>function</sub>
|
||||
|
||||
Read back the rendered pixels into a new SDL_Surface. If rect is undefined, capture entire output.
|
||||
|
||||
@@ -168,7 +168,7 @@ Read back the rendered pixels into a new SDL_Surface. If rect is undefined, capt
|
||||
**Returns**: An SDL_Surface with the requested region's pixels.
|
||||
|
||||
|
||||
### fasttext(text, pos, color)
|
||||
### fasttext(text, pos, color) <sub>function</sub>
|
||||
|
||||
Draw debug text using an internal fast path. Typically used for quick debugging overlays.
|
||||
|
||||
@@ -184,7 +184,7 @@ Draw debug text using an internal fast path. Typically used for quick debugging
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### geometry(texture, meshObject)
|
||||
### geometry(texture, meshObject) <sub>function</sub>
|
||||
|
||||
Render custom geometry from a mesh object {pos, uv, color, indices, count} with an optional texture.
|
||||
|
||||
@@ -198,7 +198,7 @@ Render custom geometry from a mesh object {pos, uv, color, indices, count} with
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### scale(scaleVec2)
|
||||
### scale(scaleVec2) <sub>function</sub>
|
||||
|
||||
Set a scaling factor for all subsequent rendering on this renderer.
|
||||
|
||||
@@ -210,7 +210,7 @@ Set a scaling factor for all subsequent rendering on this renderer.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### logical_size(size)
|
||||
### logical_size(size) <sub>function</sub>
|
||||
|
||||
Set a "logical" size that the renderer will scale to.
|
||||
For example, (320, 240) can auto-scale up to the window resolution.
|
||||
@@ -223,7 +223,7 @@ For example, (320, 240) can auto-scale up to the window resolution.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### viewport(rect)
|
||||
### viewport(rect) <sub>function</sub>
|
||||
|
||||
Set the clipping viewport for rendering. Pass undefined to use the full render target.
|
||||
|
||||
@@ -235,7 +235,7 @@ Set the clipping viewport for rendering. Pass undefined to use the full render t
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### clip(rect)
|
||||
### clip(rect) <sub>function</sub>
|
||||
|
||||
Set or clear the clipping rectangle for drawing. Pass undefined to clear.
|
||||
|
||||
@@ -247,7 +247,7 @@ Set or clear the clipping rectangle for drawing. Pass undefined to clear.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### vsync(flag)
|
||||
### vsync(flag) <sub>function</sub>
|
||||
|
||||
Enable or disable vertical sync. This may have no effect depending on the driver.
|
||||
|
||||
@@ -259,7 +259,7 @@ Enable or disable vertical sync. This may have no effect depending on the driver
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### coords(pos)
|
||||
### coords(pos) <sub>function</sub>
|
||||
|
||||
Convert window coordinates to this renderer's coordinate space.
|
||||
|
||||
@@ -271,7 +271,7 @@ Convert window coordinates to this renderer's coordinate space.
|
||||
**Returns**: [x, y] in renderer coordinate space.
|
||||
|
||||
|
||||
### camera(cameraTransform, centered)
|
||||
### camera(cameraTransform, centered) <sub>function</sub>
|
||||
|
||||
Set up a basic 2D camera matrix from a given transform. If 'centered' is true,
|
||||
the origin is the center of the viewport, else top-left.
|
||||
@@ -286,7 +286,7 @@ the origin is the center of the viewport, else top-left.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### get_viewport
|
||||
### get_viewport() <sub>function</sub>
|
||||
|
||||
Return the current viewport rect.
|
||||
|
||||
@@ -295,7 +295,7 @@ Return the current viewport rect.
|
||||
**Returns**: {x, y, w, h}
|
||||
|
||||
|
||||
### screen2world(pos)
|
||||
### screen2world(pos) <sub>function</sub>
|
||||
|
||||
Convert a screen coordinate to world space based on the current camera transform.
|
||||
|
||||
@@ -307,7 +307,7 @@ Convert a screen coordinate to world space based on the current camera transform
|
||||
**Returns**: [wx, wy] in world space
|
||||
|
||||
|
||||
### target(texture)
|
||||
### target(texture) <sub>function</sub>
|
||||
|
||||
Set or clear the current render target texture. Pass undefined to reset to the default/window.
|
||||
|
||||
@@ -319,7 +319,7 @@ Set or clear the current render target texture. Pass undefined to reset to the d
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### make_sprite_mesh(sprites)
|
||||
### make_sprite_mesh(sprites) <sub>function</sub>
|
||||
|
||||
Generate a mesh from an array of sprite objects, combining their positions, UVs,
|
||||
and colors into a single geometry block.
|
||||
|
||||
@@ -4,7 +4,7 @@ A software (CPU) image in memory. Freed when references vanish. Typically conver
|
||||
to SDL_Texture for drawing, or used as raw pixel data.
|
||||
|
||||
|
||||
### blit(dstRect, srcSurface, srcRect)
|
||||
### blit(dstRect, srcSurface, srcRect) <sub>function</sub>
|
||||
|
||||
Blit (copy) another surface onto this surface, scaling if needed.
|
||||
|
||||
@@ -20,7 +20,7 @@ Blit (copy) another surface onto this surface, scaling if needed.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### scale(newSize)
|
||||
### scale(newSize) <sub>function</sub>
|
||||
|
||||
Return a new SDL_Surface scaled to [width, height] using linear filtering.
|
||||
|
||||
@@ -32,7 +32,7 @@ Return a new SDL_Surface scaled to [width, height] using linear filtering.
|
||||
**Returns**: A new SDL_Surface with the scaled result.
|
||||
|
||||
|
||||
### fill(color)
|
||||
### fill(color) <sub>function</sub>
|
||||
|
||||
Fill the entire surface with a single color.
|
||||
|
||||
@@ -44,7 +44,7 @@ Fill the entire surface with a single color.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### rect(rect, color)
|
||||
### rect(rect, color) <sub>function</sub>
|
||||
|
||||
Fill a sub-rectangle of the surface with a color.
|
||||
|
||||
@@ -58,7 +58,7 @@ Fill a sub-rectangle of the surface with a color.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### dup
|
||||
### dup() <sub>function</sub>
|
||||
|
||||
Make a copy of this surface in RGBA format.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
A 2D GPU-accelerated texture for rendering with SDL_Renderer. Freed automatically.
|
||||
|
||||
|
||||
### mode(mode)
|
||||
### mode(mode) <sub>function</sub>
|
||||
|
||||
Set texture scale mode or filtering mode (nearest/linear).
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ A handle to an SDL-created thread. Freed on GC after join.
|
||||
Note: The engine generally doesn't expose custom usage for threads.
|
||||
|
||||
|
||||
### wait
|
||||
### wait() <sub>function</sub>
|
||||
|
||||
Block until this thread terminates.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
An application window, created via prosperon.engine_start or SDL calls. Freed on GC.
|
||||
|
||||
|
||||
### fullscreen
|
||||
### fullscreen() <sub>function</sub>
|
||||
|
||||
Toggle fullscreen mode for this window (SDL_WINDOW_FULLSCREEN).
|
||||
|
||||
@@ -12,7 +12,7 @@ Toggle fullscreen mode for this window (SDL_WINDOW_FULLSCREEN).
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### make_renderer(name)
|
||||
### make_renderer(name) <sub>function</sub>
|
||||
|
||||
Create an SDL_Renderer for 2D rendering tied to this window.
|
||||
|
||||
@@ -24,7 +24,7 @@ Create an SDL_Renderer for 2D rendering tied to this window.
|
||||
**Returns**: An SDL_Renderer object.
|
||||
|
||||
|
||||
### make_gpu(debug, driverName)
|
||||
### make_gpu(debug, driverName) <sub>function</sub>
|
||||
|
||||
Create an SDL_GPUDevice for low-level GPU rendering on this window.
|
||||
|
||||
@@ -38,7 +38,7 @@ Create an SDL_GPUDevice for low-level GPU rendering on this window.
|
||||
**Returns**: An SDL_GPUDevice.
|
||||
|
||||
|
||||
### keyboard_shown
|
||||
### keyboard_shown() <sub>function</sub>
|
||||
|
||||
Return whether the on-screen keyboard is visible (mobile/tablet).
|
||||
|
||||
@@ -47,7 +47,7 @@ Return whether the on-screen keyboard is visible (mobile/tablet).
|
||||
**Returns**: True if shown, false otherwise.
|
||||
|
||||
|
||||
### theme
|
||||
### theme() <sub>function</sub>
|
||||
|
||||
Currently returns undefined. Placeholder for retrieving OS window theme info.
|
||||
|
||||
@@ -56,7 +56,7 @@ Currently returns undefined. Placeholder for retrieving OS window theme info.
|
||||
**Returns**: undefined
|
||||
|
||||
|
||||
### safe_area
|
||||
### safe_area() <sub>function</sub>
|
||||
|
||||
Return a rect describing any OS-specific "safe" region for UI, e.g. on iPhone with a notch.
|
||||
|
||||
@@ -65,7 +65,7 @@ Return a rect describing any OS-specific "safe" region for UI, e.g. on iPhone wi
|
||||
**Returns**: A rect object {x, y, w, h}.
|
||||
|
||||
|
||||
### bordered(flag)
|
||||
### bordered(flag) <sub>function</sub>
|
||||
|
||||
Enable or disable window borders.
|
||||
|
||||
@@ -77,7 +77,7 @@ Enable or disable window borders.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### set_icon(surface)
|
||||
### set_icon(surface) <sub>function</sub>
|
||||
|
||||
Set the window's icon from an SDL_Surface.
|
||||
|
||||
@@ -89,7 +89,7 @@ Set the window's icon from an SDL_Surface.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### title
|
||||
### title <sub>accessor</sub>
|
||||
|
||||
Get or set the window's title text in the title bar.
|
||||
|
||||
@@ -101,7 +101,7 @@ Get or set the window's title text in the title bar.
|
||||
**Returns**: The current title if getting, or None if setting.
|
||||
|
||||
|
||||
### size
|
||||
### size <sub>accessor</sub>
|
||||
|
||||
Get or set the window's size as [width, height].
|
||||
|
||||
@@ -113,7 +113,7 @@ Get or set the window's size as [width, height].
|
||||
**Returns**: The current [width, height] or None if setting.
|
||||
|
||||
|
||||
### mouse_grab(flag)
|
||||
### mouse_grab(flag) <sub>function</sub>
|
||||
|
||||
Grab or ungrab the mouse for this window (so the pointer won't leave).
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
A streaming media handle, typically for MPEG video. Freed automatically.
|
||||
|
||||
|
||||
### time
|
||||
### time() <sub>function</sub>
|
||||
|
||||
Return the current playback time in seconds.
|
||||
|
||||
@@ -12,7 +12,7 @@ Return the current playback time in seconds.
|
||||
**Returns**: Current time as a float in seconds.
|
||||
|
||||
|
||||
### seek(seconds)
|
||||
### seek(seconds) <sub>function</sub>
|
||||
|
||||
Seek to the specified time (in seconds).
|
||||
|
||||
@@ -24,7 +24,7 @@ Seek to the specified time (in seconds).
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### advance(seconds)
|
||||
### advance(seconds) <sub>function</sub>
|
||||
|
||||
Advance by a certain number of seconds, decoding video as needed.
|
||||
|
||||
@@ -36,7 +36,7 @@ Advance by a certain number of seconds, decoding video as needed.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### duration
|
||||
### duration() <sub>function</sub>
|
||||
|
||||
Return the total duration of the video stream, in seconds, if known.
|
||||
|
||||
@@ -45,7 +45,7 @@ Return the total duration of the video stream, in seconds, if known.
|
||||
**Returns**: Float seconds duration, or 0 if unknown.
|
||||
|
||||
|
||||
### framerate
|
||||
### framerate() <sub>function</sub>
|
||||
|
||||
Return the framerate (FPS) of the stream if known.
|
||||
|
||||
@@ -54,7 +54,7 @@ Return the framerate (FPS) of the stream if known.
|
||||
**Returns**: Float frames per second, or 0 if unknown.
|
||||
|
||||
|
||||
### callback
|
||||
### callback <sub>accessor</sub>
|
||||
|
||||
A function to call whenever a new frame is decoded. If not set, no callback is invoked.
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ A bitmap or TTF-based font object storing glyph data.
|
||||
Used for measuring/drawing text. Freed when GC sees no references.
|
||||
|
||||
|
||||
### linegap
|
||||
### linegap <sub>accessor</sub>
|
||||
|
||||
Get or set the font's additional line spacing above the built-in metrics.
|
||||
|
||||
@@ -16,7 +16,7 @@ Get or set the font's additional line spacing above the built-in metrics.
|
||||
**Returns**: The current line gap (when getting), or None (when setting).
|
||||
|
||||
|
||||
### height
|
||||
### height <sub>accessor</sub>
|
||||
|
||||
(read only)
|
||||
|
||||
@@ -27,7 +27,7 @@ The baseline-to-baseline height in pixels.
|
||||
**Returns**: The font's total height in px.
|
||||
|
||||
|
||||
### ascent
|
||||
### ascent <sub>accessor</sub>
|
||||
|
||||
(read only)
|
||||
|
||||
@@ -38,7 +38,7 @@ How far above the baseline the font extends.
|
||||
**Returns**: A scalar float for ascent.
|
||||
|
||||
|
||||
### descent
|
||||
### descent <sub>accessor</sub>
|
||||
|
||||
(read only)
|
||||
|
||||
@@ -49,7 +49,7 @@ How far below baseline the font extends.
|
||||
**Returns**: A scalar float for descent.
|
||||
|
||||
|
||||
### text_size(text, letterSpacing, wrap)
|
||||
### text_size(text, letterSpacing, wrap) <sub>function</sub>
|
||||
|
||||
Measure a piece of text's width/height when rendered with this font.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
An R-tree for spatial lookups. Insert bounding boxes, query by bounding box, etc.
|
||||
|
||||
|
||||
### add(obj)
|
||||
### add(obj) <sub>function</sub>
|
||||
|
||||
Insert an object that has a 'rect' property {x, y, w, h} into the tree.
|
||||
|
||||
@@ -15,7 +15,7 @@ Insert an object that has a 'rect' property {x, y, w, h} into the tree.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### delete(obj)
|
||||
### delete(obj) <sub>function</sub>
|
||||
|
||||
Remove an object from the tree. Must match the same rect as used when adding.
|
||||
|
||||
@@ -27,7 +27,7 @@ Remove an object from the tree. Must match the same rect as used when adding.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### query(rect)
|
||||
### query(rect) <sub>function</sub>
|
||||
|
||||
Return an array of objects whose bounding boxes intersect the given rect.
|
||||
|
||||
@@ -39,7 +39,18 @@ Return an array of objects whose bounding boxes intersect the given rect.
|
||||
**Returns**: Array of objects that overlap that region.
|
||||
|
||||
|
||||
### forEach(callback)
|
||||
### size <sub>accessor</sub>
|
||||
|
||||
(read only)
|
||||
|
||||
Indicates how many items are stored in the rtree.
|
||||
|
||||
|
||||
|
||||
**Returns**: Integer count of items in the tree.
|
||||
|
||||
|
||||
### forEach(callback) <sub>function</sub>
|
||||
|
||||
Call a function for every item in the rtree.
|
||||
|
||||
@@ -51,7 +62,7 @@ Call a function for every item in the rtree.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### has(obj)
|
||||
### has(obj) <sub>function</sub>
|
||||
|
||||
Return true if the specified object is in the tree, false otherwise.
|
||||
|
||||
@@ -63,7 +74,7 @@ Return true if the specified object is in the tree, false otherwise.
|
||||
**Returns**: True if found, else false.
|
||||
|
||||
|
||||
### values
|
||||
### values() <sub>function</sub>
|
||||
|
||||
Return an array of all items currently in the rtree.
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ UV coordinates, color, and layer, as well as an associated 'image' object. The s
|
||||
can be drawn via GPU or SDL_Renderer. Freed when no JS references remain.
|
||||
|
||||
|
||||
### set_affine(transform)
|
||||
### set_affine(transform) <sub>function</sub>
|
||||
|
||||
Update this sprite's position and size from a transform's pos and scale.
|
||||
|
||||
@@ -17,7 +17,7 @@ Update this sprite's position and size from a transform's pos and scale.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### set_rect(rect)
|
||||
### set_rect(rect) <sub>function</sub>
|
||||
|
||||
Set the sprite's rect (x, y, w, h) directly.
|
||||
|
||||
@@ -29,7 +29,7 @@ Set the sprite's rect (x, y, w, h) directly.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### set_image(image)
|
||||
### set_image(image) <sub>function</sub>
|
||||
|
||||
Assign or replace the sprite's underlying image. Automatically updates UV if
|
||||
the image has a 'rect' property.
|
||||
@@ -42,7 +42,7 @@ the image has a 'rect' property.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### layer
|
||||
### layer <sub>accessor</sub>
|
||||
|
||||
Get or set the sprite's z-layer integer. Sprites with higher layers typically
|
||||
draw on top of lower layers.
|
||||
@@ -55,7 +55,7 @@ draw on top of lower layers.
|
||||
**Returns**: The current layer (when getting), or None (when setting).
|
||||
|
||||
|
||||
### color
|
||||
### color <sub>accessor</sub>
|
||||
|
||||
Get or set the sprite's color tint as [r, g, b, a].
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ A scheduled callback or countdown. Freed automatically once no longer referenced
|
||||
or once it completes.
|
||||
|
||||
|
||||
### remain
|
||||
### remain <sub>accessor</sub>
|
||||
|
||||
Get or set how many seconds remain before the timer triggers.
|
||||
|
||||
@@ -16,7 +16,7 @@ Get or set how many seconds remain before the timer triggers.
|
||||
**Returns**: The current time left (when getting), or None (when setting).
|
||||
|
||||
|
||||
### fn
|
||||
### fn <sub>accessor</sub>
|
||||
|
||||
Get or set the function called when the timer expires.
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ A hierarchical transform storing 3D or 2D position, rotation (as a quaternion),
|
||||
and scale. Can have a parent transform. Freed automatically on GC.
|
||||
|
||||
|
||||
### pos
|
||||
### pos <sub>accessor</sub>
|
||||
|
||||
Get or set the transform's position as a 3D vector [x, y, z].
|
||||
|
||||
@@ -16,7 +16,7 @@ Get or set the transform's position as a 3D vector [x, y, z].
|
||||
**Returns**: The current position vector (when getting), or None (when setting).
|
||||
|
||||
|
||||
### scale
|
||||
### scale <sub>accessor</sub>
|
||||
|
||||
Get or set the transform's scale as a 3D vector [x, y, z].
|
||||
For 2D usage, z is often 1.
|
||||
@@ -29,7 +29,7 @@ For 2D usage, z is often 1.
|
||||
**Returns**: The current scale (when getting), or None (when setting).
|
||||
|
||||
|
||||
### rotation
|
||||
### rotation <sub>accessor</sub>
|
||||
|
||||
Get or set the transform's rotation as a quaternion [x, y, z, w].
|
||||
Angles in degrees or radians must first be converted prior to making a quaternion.
|
||||
@@ -42,7 +42,7 @@ Angles in degrees or radians must first be converted prior to making a quaternio
|
||||
**Returns**: The current quaternion (when getting), or None (when setting).
|
||||
|
||||
|
||||
### parent
|
||||
### parent <sub>accessor</sub>
|
||||
|
||||
Get or set the transform's parent. If set, this transform becomes a child of
|
||||
the parent (re-parenting). Must be another transform object or undefined.
|
||||
@@ -55,7 +55,7 @@ the parent (re-parenting). Must be another transform object or undefined.
|
||||
**Returns**: The current parent transform (when getting), or None (when setting).
|
||||
|
||||
|
||||
### change_hook
|
||||
### change_hook <sub>accessor</sub>
|
||||
|
||||
A user-supplied function that's called whenever the transform's local matrix changes.
|
||||
If undefined, no hook is called.
|
||||
@@ -68,7 +68,7 @@ If undefined, no hook is called.
|
||||
**Returns**: The current function or undefined.
|
||||
|
||||
|
||||
### trs(pos, quat, scale)
|
||||
### trs(pos, quat, scale) <sub>function</sub>
|
||||
|
||||
Set the transform's position, rotation, and scale in one call.
|
||||
|
||||
@@ -84,7 +84,7 @@ Set the transform's position, rotation, and scale in one call.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### phys2d(velocity, angularVel, dt)
|
||||
### phys2d(velocity, angularVel, dt) <sub>function</sub>
|
||||
|
||||
Apply simple 2D velocity and angular velocity to this transform.
|
||||
|
||||
@@ -100,7 +100,7 @@ Apply simple 2D velocity and angular velocity to this transform.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### move(delta)
|
||||
### move(delta) <sub>function</sub>
|
||||
|
||||
Translate this transform by the specified vector.
|
||||
|
||||
@@ -112,7 +112,7 @@ Translate this transform by the specified vector.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### rotate(axis, angle)
|
||||
### rotate(axis, angle) <sub>function</sub>
|
||||
|
||||
Rotate this transform by an axis+angle.
|
||||
|
||||
@@ -126,7 +126,7 @@ Rotate this transform by an axis+angle.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### angle(axis)
|
||||
### angle(axis) <sub>function</sub>
|
||||
|
||||
Return the transform's rotation about a specified axis (x, y, or z).
|
||||
For example, angle([1,0,0]) returns the roll about the X-axis.
|
||||
@@ -139,7 +139,7 @@ For example, angle([1,0,0]) returns the roll about the X-axis.
|
||||
**Returns**: The numeric angle in 'turns' or radians, depending on usage.
|
||||
|
||||
|
||||
### lookat(target)
|
||||
### lookat(target) <sub>function</sub>
|
||||
|
||||
Rotate this transform so it looks toward the given world position.
|
||||
|
||||
@@ -151,7 +151,7 @@ Rotate this transform so it looks toward the given world position.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### direction(localDir)
|
||||
### direction(localDir) <sub>function</sub>
|
||||
|
||||
Rotate a vector by this transform's rotation, effectively "transforming"
|
||||
a direction from local space to world space.
|
||||
@@ -164,7 +164,7 @@ a direction from local space to world space.
|
||||
**Returns**: [dx', dy', dz'] direction in world space.
|
||||
|
||||
|
||||
### unit
|
||||
### unit() <sub>function</sub>
|
||||
|
||||
Reset position, rotation, and scale to [0,0,0], identity rotation, and [1,1,1].
|
||||
|
||||
@@ -173,7 +173,7 @@ Reset position, rotation, and scale to [0,0,0], identity rotation, and [1,1,1].
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### rect(rect)
|
||||
### rect(rect) <sub>function</sub>
|
||||
|
||||
Set this transform's pos and scale from a 2D rect object {x, y, w, h}.
|
||||
|
||||
@@ -185,7 +185,7 @@ Set this transform's pos and scale from a 2D rect object {x, y, w, h}.
|
||||
**Returns**: None
|
||||
|
||||
|
||||
### array
|
||||
### array() <sub>function</sub>
|
||||
|
||||
Return this transform's matrix as a 16-element float array in column-major order.
|
||||
|
||||
@@ -194,7 +194,7 @@ Return this transform's matrix as a 16-element float array in column-major order
|
||||
**Returns**: An array of 16 floats.
|
||||
|
||||
|
||||
### torect
|
||||
### torect() <sub>function</sub>
|
||||
|
||||
Convert transform's 2D position/scale to a rect {x, y, w, h}.
|
||||
Rotation is currently ignored.
|
||||
@@ -204,7 +204,7 @@ Rotation is currently ignored.
|
||||
**Returns**: A rect object {x, y, w, h}.
|
||||
|
||||
|
||||
### children
|
||||
### children() <sub>function</sub>
|
||||
|
||||
Return an array of child transforms belonging to this transform.
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# use
|
||||
|
||||
## use
|
||||
### length <sub>number</sub>
|
||||
|
||||
### name <sub>string</sub>
|
||||
|
||||
### prototype <sub>object</sub>
|
||||
|
||||
Reference in New Issue
Block a user