class Gosu::Grid
Constants
- VERSION
Attributes
cells[R]
columns[RW]
default_cell[RW]
rows[RW]
window[R]
x[RW]
y[RW]
z[RW]
Public Class Methods
new(window)
click to toggle source
# File lib/gosu/grid.rb, line 9 def initialize(window) @window, @cells = window, [] end
Public Instance Methods
draw()
click to toggle source
# File lib/gosu/grid.rb, line 37 def draw default_cells.each do |cell| cell.draw end cells.each do |cell| cell.draw end end
Private Instance Methods
default_cells()
click to toggle source
# File lib/gosu/grid.rb, line 57 def default_cells @default_cells ||= Matrix.build(rows, columns) do |row, column| default_cell.dup.tap do |cell| cell.row = row cell.column = column end end end
default_columns()
click to toggle source
# File lib/gosu/grid.rb, line 53 def default_columns (window.height / default_cell.size).to_i end
default_rows()
click to toggle source
# File lib/gosu/grid.rb, line 49 def default_rows (window.width / default_cell.size).to_i end