From ffceab636a36b3ebf004c9826f4dee32be3a186c Mon Sep 17 00:00:00 2001 From: TSnake41 Date: Sun, 1 Mar 2020 14:09:48 +0100 Subject: [PATCH] Compatibility notes and global API example. --- README.md | 15 +++++++++++++++ examples/lua_global_api.lua | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 examples/lua_global_api.lua diff --git a/README.md b/README.md index 933ba1e..bb80340 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/examples/lua_global_api.lua b/examples/lua_global_api.lua new file mode 100644 index 0000000..22c0cdf --- /dev/null +++ b/examples/lua_global_api.lua @@ -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()