Code Monkey home page Code Monkey logo

raylua's Introduction

Cross-Platform, Modern, Handwritten, Updated LuaJIT bindings for raylib library.

Contains

  1. raylib
  2. RLGL
  3. raylib easings (easings.h)
  4. rlights (raylib.lights)
  5. raymath
  6. physac
  7. raygui

NOTE: You need to build shared lib of physac and raygui.

Supports

  1. Microsoft Windows (32-bit and 64-bit)
  2. Mac (64-bit)
  3. Linux (64-bit)
  4. Android (ARM64)

Example

Link raylib.lua (Via require or dofile), Then start coding!

local rl = require("raylib")

local screenWidth = 800
local screenHeight = 450

rl.InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
rl.SetTargetFPS(60)

while not rl.WindowShouldClose() do
  rl.BeginDrawing()
  rl.ClearBackground(rl.RAYWHITE)
  rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY)
  rl.EndDrawing()
end

rl.CloseWindow()

For examples that binded see here

All contained functions and variables called from rl namespace/table.

NOTES

  1. This is a direct bindings of the original C version, It implements the same content.
  2. Hacks and fallbacks of raylib 2 implemented from original C version, raylib 2 functions will still works if you use raylib 3.

And i didn't copy-pasted from any gist, Even that gist made by Alexander Matz, All bindings were written by me.

Compatibility

See compatibility.md for info about this.

Autocompletion

I finally did autocompletion for raylib Lua/LuaJIT bindings to use in ZeroBrane Studio,See here about that and how to use it.

Using this on cherry

raylua is also available as package for cherry, And it's easy to install and setup!

cherry new D:\cherry-raylua-game
cherry add Rabios/raylua D:\cherry-raylua-game

Then edit main file of package in directory D:\cherry-raylua-game and require raylib with writing game code!

Running and installing this on LPM

raylua is also available as a package for LPM. To setup, install, and run it just use this command:

lpm install raylua

and to run:

lpm jitrun main.lua

Replace main.lua with your main file.

Running this on PUC-RIO Lua (Not LuaJIT)

If you use PUC-RIO Lua (Not LuaJIT), You have to install luaffi rock with luarocks!

Using luarocks install --server=https://luarocks.org/dev luaffi command.

However, I don't guarantee that it works same as LuaJIT FFI.

TSnake41's version

I did custom version using TSnake41's raylib-lua, Currently works only on 64-bit versions of Microsoft Windows and 64-bit versions of LuaJIT.

To get it see tsnake41-raylib-lua folder.

Special thanks

  1. Ramon Santamaria (@raysan5), Who created raylib.
  2. Astie Teddy (@TSnake41), Cause my bindings inspired by his bindings.
  3. Alexander Matz (@alexander-matz), Cause his gist was the first reason to write my own bindings from zero.

License

See LICENSE.txt for bindings license and LICENSES.txt for third party licenses.

raylua's People

Contributors

mattroelle avatar rabios avatar yaumama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

raylua's Issues

Raylua error

Describe the bug
In raylib.lua, I get an error called that says .\raylua-master/raylib.lua:2353: cannot load module 'libraylib64.dll': The specified module could not be found. I don't know why this is happening because libraylib64.dll is in the same folder as raylib.lua.

To Reproduce
Steps to reproduce the behavior:

  1. Download the raylua github zip file
  2. Extract the zip file to the project root
  3. Paste in the new window example into main.lua in the project root file but replace require("raylib") with require("raylua-master/raylib")
  4. Run luajit main.lua in the terminal
  5. See the error

Expected behavior
I expected a window to pop up

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Browser version: 98.0.4758.102
  • OS version: Windows 11

Additional context
Here is the code:

local rl = require("raylua-master/raylib")

local screenWidth = 800
local screenHeight = 450

rl.InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window")
rl.SetTargetFPS(60)

while not rl.WindowShouldClose() do
  rl.BeginDrawing()
  rl.ClearBackground(rl.RAYWHITE)
  rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY)
  rl.EndDrawing()
end

rl.CloseWindow()

How to use physac and raygui?

This is giving me a headache. How do I use physac.lua and raygui.lua? If I have to compile something, how do I do it? I'm having a lot of problems with this.

Grateful for the answer!

Error running example "models_waving_cubes.lua"

Describe the bug
The models_waving_cubes.lua example references the ffi module, but does not import it.
... rl.ColorFromHSV(ffi.new("Vector3", ...

To Reproduce
lua models_waving_cubes.lua

lua: models_waving_cubes.lua:40: missing declaration for symbol 'ffi'
stack traceback:
	[C]: in function '__index'
	models_waving_cubes.lua:40: in main chunk
	[C]: at 0x004061b0

Adding a local ff = require("ffi") results in this error

lua: models_waving_cubes.lua:41: bad argument #1 to 'ColorFromHSV' (cannot convert 'struct Vector3' to 'float')
stack traceback:
	[C]: in function 'ColorFromHSV'
	models_waving_cubes.lua:41: in main chunk
	[C]: at 0x004061b0

Desktop (please complete the following information):

  • OS: NixOS

Cannot require raygui

trying to load raygui via:
local rl = require ("raylib")
local gui = require("raygui")

but I always get "cannot load module 'raygui'". Requiring raylib or other lua files works as expected, though. I feel like I am missing something important? (I am very new to raylib)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.