1 require 'plugins/plugin'
2 require 'plugins/background'
4 class DefaultBackground
8 plugin :name => 'Default',
9 :keywords => %w(chess board)
12 @squares = opts[:board_size] || opts[:game].size
16 Qt::Image.painted(Qt::Point.new(size.x * @squares.x, size.y * @squares.y)) do |p|
17 (0...@squares.x).each do |x|
18 (0...@squares.y).each do |y|
19 rect = Qt::RectF.new(size.x * x, size.y * y, size.x, size.y)
20 color = if (x + y) % 2 == 0
21 Qt::Color.new(0x6b, 0x82, 0x9c)
23 Qt::Color.new(0xb8, 0xc0, 0xc0)
25 p.fill_rect(rect, Qt::Brush.new(color))