Repository navigation
OpenECS-std 0.3.0
Pre-releaseOpenECS-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)andweb.request(method, url, headers, body, done)start a request.donegets it on the main thread once it is done, andrequest:status(),request:body()andrequest:header(name)give the answer.web.socket(url)opens a WebSocket connection, to aws://orwss://URL.socket:send,socket:receive,socket:statusandsocket:closeuse it, as net's connections are used.- HTTPS checks servers against the system's trusted certificates. The setting
web.timeoutlimits 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,trianglesandmeshdraw shapes, as draw does for pixels.meshblends a colour for each point across its triangles.gpu.texturemakes a texture from pixels, whichimageandimageTransformeddraw. 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.bufferholds vertices or indices,gpu.shadertakes compiled SPIR-V, DXIL or MSL,gpu.pipelinejoins two shaders, andgpu.drawdraws 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; andnumber, 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 = truebreaks into lines at its column's width. ui.rect(panel, id)gives an element's rectangle.- ui in C:
ui.hhas macros in the manner of Clay's, such asUI_COLUMN,UI_BUTTONandUI_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.newStreammakes a sound whose samples your plugin gives while it plays.mixer.panmoves a voice between left and right.mixer.filtercuts a voice's sound above or below a frequency, andmixer.echogives it an echo.mixer.reverbadds a reverb to everything that plays, as in a room.audio.streamplays a long sound file without reading it all first.
Draw, read and write images.
- draw draws lines and circles with smooth edges, and has
roundedandroundedOutlinefor rectangles with rounded corners. draw.imageTransformeddraws an image turned by an angle and tinted by a colour, with smooth edges.image.savewrites an image to a PNG, JPG, BMP or TGA file, anddraw.imagePixelsgives its pixels.image.loadFramesreads the frames of an animated GIF, each with how long it shows.image.decodereads an image from the bytes of its file, such as one inside a model.
Animate models with gltf.
gltf.posegives each node's matrix at a time of an animation.gltf.skingives the positions of a skinned mesh at a time of an animation.gltf.imagegives 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.