Giter Club home page Giter Club logo

raylua's Introduction

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

raylua's People

Contributors

kieselsteini avatar

Stargazers

 avatar Teddy Astie avatar Christoph Polcin avatar

Watchers

 avatar

Forkers

meowboy326

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.