Skip to content

gosu/gosu.cr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Actions Status

gosu.cr

Shard for using Gosu with Crystal

Under development: implementation is incomplete.

Status

Implemented

  • Gosu
  • Window
  • TextInput
  • Font
  • Song
  • Sample
  • Channel
  • Image
  • GLTexInfo
  • Color (in-progress)
  • Numeric helper functions e.g. 90.degrees_to_radians

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      gosu:
        github: gosu/gosu.cr
  2. 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

  1. Install gosu as a system library, see wiki. (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 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