gosu

Version, currently master branch1 version
  • master branchlatestOct 6, 2023

github.com/gosu/gosu.cr

Shard for the Gosu game library

32 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  gosu:
    github: gosu/gosu.cr
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
>= 0.35, < 2.0
License
MIT
Author
Cyberarm <matthewlikesrobots@gmail.com>

Dependencies

This version declares no dependencies.

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 (<https://github.com/gosu/gosu.cr/fork>)
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