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.h
tosrc/cray_raygui/raygui.h
- Modify
raygui.h
: replace#define RAYGUI_STANDALONE
with
#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.cr
file. Beware of duplicates. Don't copy type definitions, they are declared inLibRay
in 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 6 years ago
- September 8, 2018
License
zlib License
Links
Synced at
Sun, 17 Nov 2024 22:22:29 GMT
Languages