0.0.52 • Published 6 years ago
glfwjs v0.0.52
This is currently a very barebones addon/toy project that introduces simple, lightweight bindings to GLFW in JavaScript.
The module is organized as a namespace, with each function matching its C equivalent sans the 'glfw'.
The code below will create a 800x600 application titled 'Hello, World!' that consists of a black screen, and exits upon hitting Escape.
const glfw = require('glfwjs');
if (glfw.Init()) {
let window = glfw.CreateWindow(800, 600, 'Hello, World!');
// The monitor and share parameters still exist,
// but hold values of 0 (aka NULL) by default.
while (glfw.WindowShouldClose(window) && glfw.GetKey(window, glfw.Keys.ESCAPE) != glfw.KeyActions.PRESS) {
glfw.SwapBuffers(window);
glfw.PollEvents();
}
glfw.DestroyWindow(window);
glfw.Terminate();
}