Skip to content

OpenECS-std 0.3.0

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 19 Oct 05:14
· 459 commits to dev since this release
ff06627

OpenECS-std 0.3.0 adds two standard plugins: web, for HTTP, HTTPS and WebSocket connections, and gpu, which draws on the GPU. The plugins of 0.2.0 grow too: ui has trees, tables, tabs, tooltips and number fields, and can be used from C; mixer has streams, panning, filters, an echo and a reverb; gltf reads skins and animations; net speaks TLS; fs watches folders.

It comes out with OpenECS 0.3.0, which ships these plugins built, in its plugins/ folder. The examples of OpenECS-examples 0.3.0 show each new function.

What you can do

Talk to web servers. The new web plugin makes HTTP and HTTPS requests on a thread of its own, so they never block your panels.

  • web.get(url, done) and web.request(method, url, headers, body, done) start a request. done gets it on the main thread once it is done, and request:status(), request:body() and request:header(name) give the answer.
  • web.socket(url) opens a WebSocket connection, to a ws:// or wss:// URL. socket:send, socket:receive, socket:status and socket:close use it, as net's connections are used.
  • HTTPS checks servers against the system's trusted certificates. The setting web.timeout limits how long a request takes.

Draw on the GPU. The new gpu plugin draws into a GPU panel (OpenECS 0.3.0), from Lua or C.

  • clear, fill, line, triangles and mesh draw shapes, as draw does for pixels. mesh blends a colour for each point across its triangles.
  • gpu.texture makes a texture from pixels, which image and imageTransformed draw. It stays on the GPU, so drawing it each frame costs no upload.
  • gpu.text(surface, draw.font("ui"), "Hello", 8, 8, 16, "text") draws text in draw's fonts.
  • For your own shaders: gpu.buffer holds vertices or indices, gpu.shader takes compiled SPIR-V, DXIL or MSL, gpu.pipeline joins two shaders, and gpu.draw draws with them. The draws of a frame share a depth texture.
  • Shapes, text and your pipelines keep the order you draw them in.

Build richer interfaces with ui.

  • New elements: tree, with nodes that open and close; table, with titles that sort and rows that scroll under them; tabs; and number, a field kept between a minimum and a maximum.
  • Any element can have a tooltip.
  • Text fields have a cursor, and select text with Shift, the mouse and Ctrl+A. Ctrl+C, Ctrl+X and Ctrl+V copy, cut and paste, and Ctrl moves by words.
  • Tab and Shift+Tab move the keys from element to element, and Return or Space presses the chosen one.
  • Text with wrap = true breaks into lines at its column's width.
  • ui.rect(panel, id) gives an element's rectangle.
  • ui in C: ui.h has macros in the manner of Clay's, such as UI_COLUMN, UI_BUTTON and UI_FIELD, whose blocks hold their children. A C plugin describes its controls with them, and ui shows them.
  • Each element's props have a type, so your editor completes them.

Play richer sound with mixer and audio.

  • mixer.newStream makes a sound whose samples your plugin gives while it plays.
  • mixer.pan moves a voice between left and right.
  • mixer.filter cuts a voice's sound above or below a frequency, and mixer.echo gives it an echo.
  • mixer.reverb adds a reverb to everything that plays, as in a room.
  • audio.stream plays a long sound file without reading it all first.

Draw, read and write images.

  • draw draws lines and circles with smooth edges, and has rounded and roundedOutline for rectangles with rounded corners.
  • draw.imageTransformed draws an image turned by an angle and tinted by a colour, with smooth edges.
  • image.save writes an image to a PNG, JPG, BMP or TGA file, and draw.imagePixels gives its pixels.
  • image.loadFrames reads the frames of an animated GIF, each with how long it shows.
  • image.decode reads an image from the bytes of its file, such as one inside a model.

Animate models with gltf.

  • gltf.pose gives each node's matrix at a time of an animation.
  • gltf.skin gives the positions of a skinned mesh at a time of an animation.
  • gltf.image gives the bytes of a model's images, also those inside a .glb.

Write terminals with textgrid. Cells can be bold and underlined, and wide characters, such as East Asian scripts and most emoji, take two cells. Resizing wraps the lines again at the new width, and keeps the cursor.

Secure connections with net. net.connectTLS opens a TLS connection, checked against the system's trusted certificates. net.listenTLS waits for TLS connections with a certificate and its key. net.trust trusts the certificates of a file, such as a test server's own.

Follow folders with fs. fs.watch tells your plugin each entry added, removed or changed in a folder. It works on Linux; other systems give nil and a warning.

Use handles as objects. In Lua, each plugin's handles have methods, such as connection:send(data) for net.send(connection, data), and image:size() for draw.imageSize(image).

Go to another tool from any tool. Every tool loads the launcher now. Alt+W, then / opens it.

Small fixes

  • web: a request that cannot start frees what it took.
  • fs: a busy folder never holds the program up.
  • net: TLS that cannot start frees what it made, so a later connection tries again.
  • image: GIF frames that restore the frame before them show right.
  • textgrid: wide characters follow Unicode 15.1, and a line never runs past the grid's edge.
  • ui: text that is not valid UTF-8 no longer raises an error, and numbers show with 14 digits.
  • gltf: a file with fewer skin matrices than joints, or one that asks for more values than memory can hold, no longer reads past its buffers.
  • mixer: a reverb that rings out over silence no longer slows the sound thread.

What will break

The launcher. launcher.open now opens the launcher, as settings.open and panels.open do. launcher.start starts the chosen preset or session, which launcher.open did before.

Downloads

  • openecs-std-0.3.0-source.tar.gz: the source with the libraries it compiles in. Build it inside a checkout of OpenECS, as README.md says.
  • SHA256SUMS: the checksum of the archive.

The standard plugins are under the zlib license. The libraries in dependencies/ keep their own licenses, which OpenECS's release lists.