JavaScript
This plugin enables full access to Tellusim API from the JavaScript programming language. It is compatible only with Emscripten-enabled builds targeting WebGL and WebGPU. The plugin also includes a comprehensive and user-friendly 3D math library designed for high-performance graphics development in web environments.
info
The plugins/binding/javascript/include
directory contains binding headers.
The plugins/binding/javascript/source
directory contains JavaScript and binding sources.
// create window
let window = new ts.Window(app.platform, app.device);
if(!window.isValidPtr()) return;
window.setSize(app.width, app.height);
// set close callback
window.setCloseClickedCallback(function() {
window.stop();
});
// set keyboard callback
window.setKeyboardPressedCallback(function(key, code) {
if(key == ts.Window.Key.Esc) window.stop();
});
// create and show the window
let title = window.platform_name + ' Tellusim::JavaScript';
if(!window.create(title, ts.Window.Flags.DefaultFlags | ts.Window.Flags.VerticalSync) || !window.setHidden(false)) return;