A simple and easy-to-use ChaiScript library to enjoy videogames programming
Clone or download
RobLoach Merge pull request #6 from RobLoach/tool
Rename rChaiScriptLauncher to raylib-chaiscript
Latest commit acbaa6c Jan 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples/core Add enums Jan 2, 2019
include/chaiscript/extras Update API Jan 13, 2019
logo Update documentation Jan 2, 2019
tests Update raylib.cpp Jan 2, 2019
tools/raylib-chaiscript Fix CLI Jan 13, 2019
vendor Update raylib Jan 13, 2019
.editorconfig Add Raylib ChaiScript Jan 2, 2019
.gitignore Initial commit Jan 1, 2019
.gitmodules Add Raylib ChaiScript Jan 2, 2019
CMakeLists.txt Update Raylib Jan 13, 2019
LICENSE Add Raylib ChaiScript Jan 2, 2019
README.md Rename rChaiScriptLauncher to raylib-chaiscript Jan 13, 2019

README.md

raylib-chaiscript

ChaiScript bindings for raylib, a simple and easy-to-use library to enjoy videogames programming (www.raylib.com)

Example

The following is an example of what raylib looks like through ChaiScript:

var screenWidth = 800
var 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()        // Close window and OpenGL context

Check for more examples organized by raylib modules.

Usage

There are a number of ways to use raylib-chaiscript. The following covers its API binding, and a launcher tool...

API Binding

To integrate raylib-chaiscript directly into an existing project, the single header-only file, raylib.hpp, is used. To add the raylib bindings to your project you will need to...

  1. Include that file in your project:

    #include "chaiscript/extras/raylib.hpp"
  2. Add the module to your ChaiScript instance:

    auto raylib = chaiscript::extras::raylib::bootstrap();
    chai.add(raylib);
  3. Evaluate a file with some raylib code:

    chai.eval_file("core_basic_window.chai");

CLI

There is a command-line interface tool to quickly launch .chai files with raylib, named raylib-chaiscript. This allows running raylib-chaiscript .chai scripts directly from the command line, or just with drag & drop of .chai files into raylib-chaiscript.exe.

./raylib-chaiscript core_basic_window.chai

It can be compiled for other platforms, just need to link with ChaiScript library and raylib library. For more details, just check comments on raylib-chaiscript.cpp.

License

raylib-chaiscript is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check LICENSE for further details.

Copyright (c) 2018 Rob Loach (@RobLoach)