ChaiLove API  2.0.0
ChaiLove API

ChaiLove is a framework for making 2D games in the ChaiScript scripting language. ChaiLove is totally free, and can be used in anything from friendly open-source hobby projects, to evil, closed-source commercial ones.

Some interesting places to go from here:

ChaiScript

Never used ChaiScript before? It's a really cool language! This manual won't teach you ChaiScript, but fortunately there are other good resources for that.

Hello World

This is the full source for "hello world" in ChaiLove, using a main.chai file. Running this code will cause an 640 by 480 window to appear, and display white text on a black background.

def load() {
global logo = love.graphics.newImage("logo.png")
global x = 10.0f
}
def draw() {
love.graphics.print("Hello World!", 400, 300)
love.graphics.draw(logo, x, 100)
}
def update(dt) {
x = x + 20.0f * dt
}
The primary purpose of the graphics module is to draw to the screen.
Definition: graphics.h:25
graphics & draw(Image *image, int x, int y, float r, float sx, float sy, float ox, float oy)
Draws an image with the given angle, zoom, and origin.
graphics & print(const std::string &text, int x, int y)
Prints the given text to the screen.
Image * newImage(const std::string &filename)
Creates a new Image from a given filepath.
This covers all the modules available through ChaiLove.
Definition: audio.h:9

To run the above, execute it with retroarch -L chailove_libretro.so main.chai .