https://github.com/robloach/raylib-duktape
https://github.com/robloach/raylib-duktape
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/robloach/raylib-duktape
- Owner: RobLoach
- License: zlib
- Created: 2019-08-06T03:50:43.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-10-16T01:04:53.000Z (over 3 years ago)
- Last Synced: 2023-04-09T06:57:33.027Z (about 3 years ago)
- Language: C++
- Size: 228 KB
- Stars: 30
- Watchers: 4
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# raylib-duktape
Embedded JavaScript bindings for [raylib](https://www.raylib.com/), a simple and easy-to-use library to learn videogames programming.
`raylib-duktape` uses [Duktape](https://duktape.org/) and [Dukglue](https://github.com/Aloshi/dukglue).
## Example
``` js
const screenWidth = 800
const screenHeight = 450
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
SetTargetFPS(60)
while (!WindowShouldClose()) {
BeginDrawing()
ClearBackground(RAYWHITE)
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY)
EndDrawing()
}
CloseWindow()
```
## CLI
A [raylib-duktape](bin/raylib-duktape.cpp) CLI launcher is provided to allow running raylib JavaScript files.
``` bash
raylib-duktape core_basic_window.js
```
## API
Initialize raylib-duktape through your Duktape context.
``` c
#include "raylib-duktape.h"
// After initializing the Duktape heap...
duk_raylib_init(ctx, 0);
```
## Build
``` bash
git clone https://github.com/RobLoach/raylib-duktape.git
cd raylib-duktape
mkdir build
cd build
cmake ..
make
make test
```
## License
[zlib](LICENSE)