Skip to content

kieselsteini/raylua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rayLua - a simple new Lua binding for raylib

Why?

Why yet another Lua binding for raylib if there are so many others already out there?

Well most Lua bindings I have found on GitHub were using the LuaJIT "ffi" package, which is a viable option when using LuaJIT, but not for usage with vanilla Lua. And then, all the other bindings seemed to be abandoned for years and programmed against an ancient version of raylib. I also wanted to use the real C structures for objects and not parse Lua tables on the fly when using them.

Last but not least, fun. I just discovered raylib and I enjoy Lua programming, so I thought I would be a perfect side-project for me (and the upcoming raylib game jam).

Difference to programming raylib in C99

  • there are no UnloadXXX functions as the Lua garbage collector will collect and finalize unused resources
  • all LoadXXXFromMemory functions are renamed to LoadXXXFromString which allows the user to pass a Lua byte string
  • all GetXXXWidth / GetXXXHeight functions are renamed to GetXXXSize which will return 2 values for width and height
  • all "basic" objects like Vector2, Vector3 etc. have a function named like this to create them
    • e.g. Vector2(), Vector3(), Rectangle(), Camera2D(), Camera3D()
    • or with parameters like Vector2(1, 2), Vector2(other_vector)
  • all objects with resources bound to them like Image, Texture use the corresponding raylib function to create them
  • vector objects Vector2, Vector3 take advantage of metatables so you can write simpler code
    • you can add a vector with a vector or a number etc.
    • e.g. vector = Vector2(10, 10) * 100
  • all functions which take an object as its first parameter are exposed as methods on the object itself
    • e.g. ImageColorInvert(image) can be written as image:ColorInvert()
    • e.g. DrawTextureV(texture, Vector2(10, 10), WHITE) can be written as texture:DrawV(Vector(10, 10), WHITE)
  • functions returning a FilePathList return a simple Lua array with strings instead

State of the binding

  • module: rcore 🚧
    • Window-related functions ✅ (100%)
      • GetWindowHandle ❌ (useless in Lua)
      • GetScreenWidth / GetScreenHeight 🌔 GetScreenSize
      • GetRenderWidth / GetRenderHeight 🌔 GetRenderSize
      • GetMonitorWidth / GetMonitorHeight 🌔 GetMonitorSize
      • GetMonitorPhysicalWidth / GetMonitorPhysicalHeight 🌔 GetMonitorPhysicalSize
    • Custom frame control functions ✅ (100%)
    • Cursor-related functions ✅ (100%)
    • Drawing-related functions 🚧 (64%)
      • BeginTextureMode / EndTextureMode ❌
      • BeginShaderMode / EndShaderMode ❌
      • BeginVrStereoMode / EndVrStereoMode ❌
    • VR stereo config functions for VR simulator ❌
    • Shader management functions ❌
    • Screen-space-related functions ❌
    • Timing-related functions ✅ (100%)
    • Misc. functions ❌
    • Files management functions ✅ (100%)
    • Compression/Encoding functionality ✅ (100%)
    • Input-related functions: keyboard ✅ (100%)
    • Input-related functions: gamepads ✅ (100%)
    • Input-related functions: mouse ✅ (100%)
    • Input-related functions: touch ✅ (100%)
  • module: rgestures ✅ (100%)
  • module: rcamera ✅ (100%)
  • module: rshapes ✅ (100%)
  • module: rtextures 🚧
    • Image loading functions ✅ (100%)
      • LoadImageFromMemory 🌔 LoadImageFromString
    • Image generation functions ✅ (100%)
    • Image manipulation functions ✅ (100%)
    • Image drawing functions ✅ (100%)
    • Texture loading functions 🚧 (25%)
      • LoadTextureFromImage ❌
      • LoadTextureCubemap ❌
      • LoadRenderTexture ❌
    • Texture configuration functions ✅ (100%)
    • Texture drawing functions ✅ (100%)
    • Color/pixel related functions 🚧
      • Fade is implemeted on the Color object
  • module: rtext 🚧
    • Font loading/unloading functions 🚧 (42%)
      • LoadFontEx ❌
      • LoadFontFromImage ❌
      • LoadFontFromMemory 🌔 LoadFontFromString
      • LoadFontData ❌
      • GenImageFontAtlas ❌
    • Text drawing functions ✅ (83%)
      • DrawTextCodepoints ❌
    • Text font info functions 🚧
      • GetGlyphIndex ❌
      • GetGlyphInfo ❌
      • GetGlyphAtlasRec ❌
    • Text codepoints management functions (unicode characters) ❌ use utf8. module*
    • Text strings management functions (no UTF-8 strings, only byte chars) ❌ use string. module*
  • module: rmodels
  • module: raudio ✅ (AudioStream)
    • Audio device management functions ✅ (100%)
    • Wave/Sound loading/unloading functions ✅
      • LoadWaveFromMemory 🌔 LoadWaveFromString
    • Music management functions ✅
      • LoadMusicStreamFromMemory 🌔 LoadMusicStreamFromString
    • AudioStream management functions ❌
  • module: raygui (3.2)
    • Global gui state control functions ✅
    • Font set/get functions ✅
    • Style set/get functions ✅
    • Container/separator controls, useful for controls organization ✅
    • Basic controls set ✅
    • Advance controls set 🚧
      • GuiListView ❌
      • GuiListViewEx ❌
      • GuiTextInputBox ❌
    • Styles loading functions ✅
    • Icons functionality 🚧
      • GuiGetIcons ❌
      • GuiGetIconData ❌
      • GuiSetIconData ❌
  • structs (objects)
    • Vector2
    • Vector3
    • Vector4
    • Quaternion
    • Matrix
    • Color
    • Rectangle
    • Image
    • Texture
    • RenderTexture
    • NPatchInfo
    • GlyphInfo
    • Font
    • Camera3D
    • Camera2D
    • Mesh
    • Shader
    • MaterialMap
    • Material
    • Model
    • Transform
    • BoneInfo
    • ModelAnimation
    • Ray
    • RayCollision
    • BoundingBox
    • Wave
    • Sound
    • Music
    • AudioStream
    • VrDeviceInfo
    • VrStereoConfig
    • FilePathList 🌔
      • will be converted "in-place" to Lua tables in functions which will return this

About

A new simple raylib binding for Lua

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors