Hi everyone! I'm trying to make a chess game. To draw the board, I thought
of placing 8 flows, and 8 stack inside of each flow. And finally, each stack
would have a PNG image inside.
Instead of simple stacks, i decided to create a widget, so that it would be
easier to change the image inside of it (that happens whenever a player
makes a move).
The problem with the widget is that i can't put one next to each other. They
insist on putting themselves below the previous one, which isn't the case
with simple stacks.

class Casillero < Widget
    attr_accessor :img, :back, :color
    def initialize opts = {}
        @stack = stack :width =>100, :height=>100
        @back = @stack.background(*opts[:color]) if opts[:color]
    end
end

Shoes.app{
    flow :width => 900 do
        8.times do |i|
            @c = casillero :color => black if i%2==0
            @c = casillero :color => white if i%2!=0
        end
    end
}

Reply via email to