An open API service indexing awesome lists of open source software.

https://github.com/robloach/raylib-duktape


https://github.com/robloach/raylib-duktape

Last synced: over 1 year ago
JSON representation

Awesome Lists containing this project

README

          

![logo.png](examples/shapes/logo.png)

# 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)