6 theme :name => 'Layouts/Cool',
7 :keywords => %w(layout)
9 # values relative to unit = 1
12 CLOCK_HEIGHT_RATIO = 0.4
20 def layout(rect, elements)
21 xrel = @size.x + MARGIN * 3 + CLOCK_WIDTH
22 yrel = @size.y + MARGIN * 2
23 unit = [rect.width / xrel, rect.height / yrel].min.floor
24 margin = MARGIN * unit
25 clock_width = CLOCK_WIDTH * unit
27 base = Qt::Point.new((rect.width - xrel * unit) / 2,
28 (rect.height - yrel * unit) / 2)
30 board_rect = Qt::Rect.new(
31 base.x + margin, base.y + margin,
32 @size.x * unit, @size.y * unit)
33 elements[:board].flip(@flipped)
34 elements[:board].set_geometry(board_rect)
36 if @game.respond_to? :pool
37 pool_height = (board_rect.height - margin) / @game.players.size
40 pools_rect = @game.players.reverse.map do |player|
42 board_rect.right + margin,
46 elements[:pools][player].flip(flip = !flip)
47 elements[:pools][player].set_geometry(r)