Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reon90/glfwjs
The N-API bindings for GLFW
https://github.com/reon90/glfwjs
c glfw javascript n-api nodejs opengl vulkan
Last synced: about 8 hours ago
JSON representation
The N-API bindings for GLFW
- Host: GitHub
- URL: https://github.com/reon90/glfwjs
- Owner: Reon90
- License: mit
- Created: 2020-02-20T10:07:33.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-29T00:33:30.000Z (about 3 years ago)
- Last Synced: 2024-08-09T12:11:33.617Z (3 months ago)
- Topics: c, glfw, javascript, n-api, nodejs, opengl, vulkan
- Language: C
- Homepage:
- Size: 2.66 MB
- Stars: 49
- Watchers: 3
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# glfwJS
The N-API bindings for [GLFW](https://www.glfw.org/) multi-platform library for OpenGL, OpenGL ES and Vulkan development on the desktop. It provides a simple API for creating windows, contexts and surfaces, receiving input and events.
## Example
```js
if (!glfwInit()) {
process.exit(1);
}const window = glfwCreateWindow(kWidth, kHeight, "Simple example", null, null);
if (!window) {
glfwTerminate();
process.exit(1);
}
glfwMakeContextCurrent(window);glfwSwapInterval(1);
glfwSetKeyCallback(window, key_callback);function drawLoop() {
if (!glfwWindowShouldClose(window)) {
setTimeout(drawLoop, 0);
} else {
glfwDestroyWindow(window);
glfwTerminate();
process.exit(0);
}glfwSwapBuffers(window);
glfwPollEvents();
}
drawLoop();
```