Project

gosu_grid

0.0
No commit activity in last 3 years
No release in over 3 years
This gem provide basic functional to draw game grid and move stuff around
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
>= 0
>= 0

Runtime

>= 0
 Project Readme

Gosu::Grid

This gem just provides some methods to get game grid, fill it with cells, and move stuff around. You can easely modify it for your needs. Feel free to contribute in this project if you find it useful or interesting.

Installation

Add this line to your application's Gemfile:

gem 'gosu_grid'

And then execute:

$ bundle

Or install it yourself as:

$ gem install gosu_grid

Usage

How to Draw default grid

class DeadCell < Gosu::Grid::Cell
  def size
    object.width
  end

  private

  def object
    @object ||= Gosu::Image.new(window, 'assets/dead_cell.png', true)
  end
end

class GridGameExample < Gosu::Window
  def initialize
    super(540, 320, false)
    @grid = Gosu::Grid.new(self)
    @grid.default_cell = DeadCell.new(self, 0, 0)
  end

  def draw
    @grid.draw && sleep(0.05)
  end
end

more examples here

Contributing

  1. Fork it ( https://github.com/shemerey/gosu_grid/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