Shard Detail

cray v0.1.1

raylib bindings for Crystal

Install & Use

Add the following code to your project's shard.yml under:

dependencies to use in production
- OR -
development_dependencies to use in development

  github: mswieboda/cray



Complete RayLib 2.6 bindings to Crystal.

Original GitLab cray repo created/maintained by Zatherz with RayLib 1.8 bindings


Add this to your application's shard.yml:

    github: mswieboda/cray

The RayLib libraries are copied to your projects lib_ext folder.

Currently they contain:

libraylib.261.dylib # (TBD: need to compile and add to repo)

*.dylib is used for MacOS, while *.so will be for Linux.

TODO: will try to have MacOS compile to *.so as well so only one file is needed regardless of platform.

Use these environment variables to load the library when building or running your project:


env LIBRARY_PATH="$(PWD)/lib_ext" crystal build src/


env LD_LIBRARY_PATH="$(PWD)/lib_ext" crystal build ./your_project

See the Makefile for building and running the examples and how you might setup your Makefile for easier development.


Check out the examples in the examples directory.

You can run make run_examples to run all of the examples one after another.

The function names are the same as the names in the cheatsheet, with the following differences:

  • All of the functions, structs and constants are prefixed with LibRay. IsWindowMinimized => LibRay.window_minimized? Vector2 => LibRay::Vector2 FLAG_WINDOW_RESIZABLE => LibRay::FLAG_WINDOW_RESIZABLE
  • PascalCase is changed into snake_case (so for example InitWindow is init_window).
  • Functions returning booleans end with a question mark and the Is prefixes are stripped. For example, IsWindowMinimized is window_minimized?
  • Any other name inconsistency is a bug.