Code Monkey home page Code Monkey logo

crystalray's Introduction

logo

Windows - Build Examples Ubuntu - Build Examples

raylib-cr

Crystal Bindings for raylib, a small and easy to use game development library.
As for now the bindings only support the raw function calls from raylib itself. raymath functions are also supported, as are infix operators for vectors, matricies, and quaternions.

Supported platforms

These platforms are supported out of the box and are linked statically

  1. 64-bit Linux
  2. 64-bit Windows

Weak/Broken support

  1. Mac OS

Hopefully soon

  • Raspberry PI

Installation

Linux

  1. Run
sh rsrc/native/ubuntu/install.sh
  1. Add raylib-cr to your shard.yml:
dependencies:
  raylib-cr:
    github: sol-vin/raylib-cr
  1. Run shards install
  2. Get programming!

Windows

  1. Follow the instructions at https://github.com/neatorobito/scoop-crystal to add the crystal-preview bucket to scoop
  2. Install crystal with scoop install crystal
  3. powershell ./rsrc/native/windows/install.ps1
  4. Run in powershell
$env:LIB="${env:LIB};C:\raylib"
$env:PATH="${env:PATH};C:\raylib"

OR

Run in cmd

set PATH=%PATH%;C:\raylib
set LIB=%LIB%;C:\raylib
  1. Add raylib-cr to your shard.yml:
dependencies:
  raylib-cr:
    github: sol-vin/raylib-cr
  1. Run shards install
  2. Get programming!

Usage Example

main.cr

require "raylib-cr"

Raylib.init_window(800, 450, "Hello World")
Raylib.set_target_fps(60)

until Raylib.close_window?
  Raylib.begin_drawing
  Raylib.clear_background(Raylib::RAYWHITE)
  
  Raylib.draw_text("Hello World!", 190, 200, 20, Raylib::BLACK)
  Raylib.end_drawing
end

Raylib.close_window
  1. Add raylib-cr to shard.yml dependencies.
  2. shards install
  3. Run in powershell (only needs to be run once per new console window opened)
$env:LIB="${env:LIB};C:\raylib"
$env:PATH="${env:PATH};C:\raylib"
  1. shards run

RayGUI, RLGL, Audio, and Lights

If you need to extra functionality, RLGL, RAudio and Lights can be included with the following.

require "raylib-cr/raygui"
require "raylib-cr/rlgl"
require "raylib-cr/audio"
require "raylib-cr/lights"

Contributing

  1. Fork it (https://github.com/sol-vin/raylib-cr)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Owner

Major Contributors

Minor Contributors

Inactive Contributors

crystalray's People

Contributors

sol-vin avatar aregevdev avatar rightbrace avatar rishavs avatar d-shwagginz avatar bararchy avatar shawsumma avatar eddyluten avatar b1tlet avatar

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.