Compatibility notes and global API example.

This commit is contained in:
TSnake41 2020-03-01 14:09:48 +01:00
parent 71b3d7e581
commit ffceab636a
2 changed files with 32 additions and 0 deletions

View File

@ -101,6 +101,21 @@ end
rl.CloseWindow()
```
### Compatibility
raylib-lua (raylua) is currently compatible with raylib v3.0 API.
There is currently no support for rlgl and raygui, but it may be considered
in the future.
#### Global API
You can make raylib-lua (raylua) partially compatible with
[original raylib-lua](https://github.com/raysan5/raylib-lua) or
[raylib-lua-sol](https://github.com/RobLoach/raylib-lua-sol) with global API by
adding `setmetatable(_G, { __index = rl })` on the first line.
This will allow direct use of raylib binding through globals instead of `rl` table.
### Licence
Copyright (C) 2020 Astie Teddy

View File

@ -0,0 +1,17 @@
setmetatable(_G, { __index = rl })
SetConfigFlags(FLAG_VSYNC_HINT)
SetTargetFPS(60)
InitWindow(800, 450, "raylib [lua] example - global api")
while not WindowShouldClose() do
BeginDrawing()
ClearBackground(RAYWHITE)
DrawText("Global API !", 350, 200, 20, LIGHTGRAY)
EndDrawing()
end
CloseWindow()