Compatibility notes and global API example.
This commit is contained in:
parent
71b3d7e581
commit
ffceab636a
15
README.md
15
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
|
||||
|
17
examples/lua_global_api.lua
Normal file
17
examples/lua_global_api.lua
Normal 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()
|
Loading…
Reference in New Issue
Block a user