gosu.cr
Shard for using Gosu with Crystal
Under development: implementation is incomplete.
Status
Implemented
- [x] Gosu
- [x] Window
- [x] TextInput
- [x] Font
- [X] Song
- [X] Sample
- [X] Channel
- [X] Image
- [X] GLTexInfo
- [ ] Color (in-progress)
- [ ] Numeric helper functions e.g.
90.degrees_to_radians
Installation
-
Add the dependency to your
shard.yml:dependencies: gosu: github: gosu/gosu.cr -
Run
shards install
Usage
require "gosu"
class Window < Gosu::Window
def initialize
super(512, 512)
end
end
Window.new.show
Where possible gosu.cr imitates the Ruby gem.
Development
Unix
- Install gosu as a system library, see wiki.
(Note: may need to edit
gosu/cmake/build/cmake_install.cmaketo changeset(CMAKE_INSTALL_PREFIX "/usr/local")toset(CMAKE_INSTALL_PREFIX "/usr")) - Run your project:
crystal run --link-flags -lgosu-ffi YOU_PROGRAM.cr
Windows
- Build gosu using Visual Studio or MSBuild (GosuFFI project)
- Copy
Gosu.libandgosu-ffi.libinto the /lib directory of your crystal-lang install - Copy
SDL2.dllandgosu-ffi.dllinto your project directory - Run your project:
crystal run YOUR_PROGRAM.cr
Contributing
- Fork it (https://github.com/gosu/gosu.cr/fork)
- Create your feature branch (
git checkout -b my-new-feature) - 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
- Cyberarm - creator and maintainer