cray-raygui
cray-raygui

Raygui bindings for Crystal, meant to be used with cray library. Cray is Raylib bindings.
Installation
Add this to your application's shard.yml:
dependencies:
cray-raygui:
gitlab: TeddyDD/cray-raygui
branch: raylib-2
Usage
require "cray"
require "cray_raygui"
TODO: Write usage instructions here
Development
Bindings are generated using libgen tool. Generating bindings from scratch is manual process for simplicity. Fortunetly, for normal usage it is not required, and small chagnes in Raygui could be covered manually on bindigs side.
It looks like this:
- Install and build libgen: https://github.com/olbat/libgen
- Download Raygui and copy
src/raygui.htosrc/cray_raygui/raygui.h - Modify
raygui.h: replace#define RAYGUI_STANDALONEwith
#define RAYGUI_IMPLEMENTATION
#define RAYGUI_STYLE_SAVE_LOAD
- Generate bindings using libgen:
libgen ./lib-raygui.yml - libgen will create two files in
src/cray_raygui
- generated/cray_raygui/application.cr
- generated/cray_raygui/cray_raygui.cr
- Now you have to combine functions from those files into single
src/cray_raygui/gui.crfile. Beware of duplicates. Don't copy type definitions, they are declared inLibRayin cray. - Fix type names (Rectangle -> LibRay::Rectangle, same for Vector2, Color)
- Remove generated files
- Remove
gui_prefixes fromgui.cr, who needs that? - Bind load/save functions manually (
src/cray_raygui/load_save.cr) - Create enums definitions in
src/cray_raylib/enums.cr
As you can see process of generating bindings from scratch is quite complicated. It's not needed for using library, and in the future I might write script to automate it.
Contributing
- Fork it (https://gitlab.com/TeddyDD/cray-raygui/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Format crystal files with
crystal tool format **.cr - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- TeddyDD Daniel Lewan - creator, maintainer
Repository
cray-raygui
Owner
Statistic
- 0
- 0
- 0
- 1
- 0
- about 7 years ago
- September 8, 2018
License
zlib License
Links
Synced at
Tue, 11 Nov 2025 19:52:34 GMT
Languages