Sha256: a704746ea38d2483a222dc081cddaa70c49548c12d7661e3430b5a09425c624e

Contents?: true

Size: 1.12 KB

Versions: 16

Compression:

Stored size: 1.12 KB

Contents

require_relative 'helpers/example_window'

# By using a splash screen of some sort, one can switch to another resolution for the main game.
class ExampleState < Fidgit::GuiState
  def initialize
    super
    vertical do
      horizontal do
        text = label "Width:"

        @width_combo = combo_box(value: [640, 480]) do
          [[640, 480], [800, 600], [Gosu::screen_width, Gosu::screen_height]].each do |width, height|
            item "#{width}x#{height}", [width, height]
          end
        end
      end

      @full_screen_button = toggle_button "Fullscreen?"

      button "Load game", icon: Gosu::Image["head_icon.png"] do
        $window.close
        window = Chingu::Window.new(*@width_combo.value, @full_screen_button.value)
        window.push_game_state ExampleAfterState
        window.show
      end
    end
  end
end

class ExampleAfterState < GuiState
  def initialize
    super

    on_input(:esc, :exit)

    vertical do
      label "Game loaded!", icon: Gosu::Image["head_icon.png"], border_color: Gosu::Color.rgb(255, 255, 255)
    end
  end
end

ExampleWindow.new.show

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fidgit-0.2.4 examples/splash_example.rb
fidgit-0.2.3 examples/splash_example.rb
fidgit-0.2.2 examples/splash_example.rb
fidgit-0.2.1 examples/splash_example.rb
fidgit-0.2.0 examples/splash_example.rb
fidgit-0.1.10 examples/splash_example.rb
fidgit-0.1.9 examples/splash_example.rb
fidgit-0.1.8 examples/splash_example.rb
fidgit-0.1.7 examples/splash_example.rb
fidgit-0.1.6 examples/splash_example.rb
fidgit-0.1.5 examples/splash_example.rb
fidgit-0.1.4 examples/splash_example.rb
fidgit-0.1.3 examples/splash_example.rb
fidgit-0.1.2 examples/splash_example.rb
fidgit-0.1.1 examples/splash_example.rb
fidgit-0.1.0 examples/splash_example.rb