Sha256: e222fe6237c3d1ebd78fba6e512f139ad191288738056e1aea39af6d9982a7d0

Contents?: true

Size: 957 Bytes

Versions: 5

Compression:

Stored size: 957 Bytes

Contents

require_relative 'helpers/example_window'

class ExampleState < Fidgit::GuiState
  BORDER_COLOR = Gosu::Color.rgb(255, 0, 0)
  FIXED_NUM = 5
  NUM_CELLS = 17

  def initialize
    super

    pack :vertical do
      label "Grid with #{FIXED_NUM} columns"
      pack :grid, num_columns: FIXED_NUM, border_color: BORDER_COLOR, cell_border_color: Gosu::Color.rgba(0, 255, 0, 255), cell_border_thickness: 1 do
        NUM_CELLS.times do |i|
          label "Cell #{i}", font_size: rand(15) + 15, border_color: BORDER_COLOR, border_thickness: 1
        end
      end

      label "Grid with #{FIXED_NUM} rows"
      pack :grid, num_rows: FIXED_NUM, border_color: BORDER_COLOR, cell_background_color: Gosu::Color.rgba(0, 100, 100, 255) do
        NUM_CELLS.times do |i|
          label "Cell #{i}", font_size: rand(15) + 15, border_color: BORDER_COLOR, border_thickness: 1
        end
      end
    end
  end
end

ExampleWindow.new.show

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fidgit-0.0.6alpha examples/grid_packer_example.rb
fidgit-0.0.5alpha examples/grid_packer_example.rb
fidgit-0.0.4alpha examples/grid_packer_example.rb
fidgit-0.0.3alpha examples/grid_packer_example.rb
fidgit-0.0.2alpha examples/grid_packer_example.rb