Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gosu/gosu.cr

Shard for the Gosu game library
https://github.com/gosu/gosu.cr

crystal-lang game-development game-engine gosu

Last synced: 12 days ago
JSON representation

Shard for the Gosu game library

Awesome Lists containing this project

README

        

[![Actions Status](https://github.com/gosu/gosu.cr/workflows/Crystal%20CI/badge.svg?branch=master)](https://github.com/gosu/gosu.cr/actions)
# 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

1. Add the dependency to your `shard.yml`:

```yaml
dependencies:
gosu:
github: gosu/gosu.cr
```

2. Run `shards install`

## Usage

```crystal
require "gosu"

class Window < Gosu::Window
def initialize
super(512, 512)
end
end

Window.new.show
```

Where possible gosu.cr imitates the [Ruby gem](https://rubydoc.info/gems/gosu).

## Development
### Unix
1. Install [gosu](https://github.com/gosu/gosu) as a system library, [see wiki](https://github.com/gosu/gosu/wiki/Getting-Started-on-Linux#compiling-gosu-for-c).
(Note: may need to edit `gosu/cmake/build/cmake_install.cmake` to change `set(CMAKE_INSTALL_PREFIX "/usr/local")` to `set(CMAKE_INSTALL_PREFIX "/usr")`)
2. Run your project: `crystal run --link-flags -lgosu-ffi YOU_PROGRAM.cr`

### Windows
1. Build [gosu](https://github.com/gosu/gosu) using Visual Studio or MSBuild (GosuFFI project)
2. Copy `Gosu.lib` and `gosu-ffi.lib` into the /lib directory of your crystal-lang install
3. Copy `SDL2.dll` and `gosu-ffi.dll` into your project directory
4. Run your project: `crystal run YOUR_PROGRAM.cr`

## Contributing

1. Fork it ()
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

## Contributors

- [Cyberarm](https://github.com/cyberarm) - creator and maintainer