public
Description: Gosu implementation of classic Tetris
Homepage:
Clone URL: git://github.com/angryrabbit/gosu-tetris.git
Daniel Waite (author)
Sat Apr 05 20:45:19 -0700 2008
commit  3f49a4fd0cc7bafd9bcc369196689b5a65bf6daa
tree    6b01a58526eeb2dc2ca94178cb42579c9e91fce5
parent  c19ed18bcb36eba2c62d22e2048516d24db02161
gosu-tetris / straight.rb
100644 31 lines (27 sloc) 0.544 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class Straight < Shape
  
  def initialize(window)
    super
    @poses = []
  end
  
  def draw
    case @direction
    when :north: render_north
    when :east: render_east
    when :south: render_south
    when :west: render_west
    end
  end
  
  def render_north
    [
      [ 0, 1, 0 ],
      [ 1, 1, 0 ],
      [ 1, 0, 0 ]
    ].each_with_index do |row, pos_y|
      row.each_with_index do |col, pos_x|
        if col == 1
          @block_image.draw(pos_x * block_size, pos_y * block_size, 0)
        end
      end
    end
  end
  
end