A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Spooner/fidgit below:

gosu/fidgit: Ruby GUI framework using Gosu (⚠️ unmaintained)

Fidgit is a GUI framework built on Gosu and Chingu

⚠️ Neither Fidgit nor Chingu are being actively maintained. The current version mostly works, but only when installed from git (not gem install fidgit).

The API is inspired by Shoes, but since Shoes is very simplistic, the level of functionality is based around FXRuby and other GUI APIs. Fidgit was originally developed as a part of the Sidney game, but as it got more complex, it was obvious it would be useful to separate them.

Read the Yard documentation at rubydoc.info

Fidgit aims to be a toolkit which will provide the building blocks to quickly create a GUI either for a GUI-based game or for options screens and menus within a regular Gosu game.

MIT (see COPYING.txt)

# examples/readme_example.rb
require 'fidgit'

class MyGame < Chingu::Window
  def initialize
    super(640, 480, false)

    # To use the Fidgit features, a Fidgit::GuiState must be active.
    push_game_state MyGuiState
  end
end

class MyGuiState < Fidgit::GuiState
  def initialize
    super

    # Create a vertically packed section, centred in the window.
    vertical align: :center do
      # Create a label with a dark green background.
      my_label = label "Hello world!", background_color: Gosu::Color.rgb(0, 100, 0)

      # Create a button that, when clicked, changes the label.
      button("Goodbye", align_h: :center, tip: "Press me and be done with it!") do
        my_label.text = "Goodbye cruel world!"
      end
    end
  end
end

MyGame.new.show

As well as a cursor and tool-tips that are managed by the GuiState for you, there are several elements you can use inside your GuiState.

Elements are best added by using simple methods (listed below). Most of these method accept a block, some offering access to public methods of the element and others being default event handlers.

The GuiState itself only accepts #vertical/#horizontal/#grid, but any packer or group accepts any other element method.

Fidgit uses automatic packers to manage layout.

Elements can be placed inside a packer or group.

These should be placed within a group (directly or indirectly) and only one of them will be selected. The group manages which one is selected.

These elements contain items, which can easily be added from within a block passed to them. One can subscribe to the :changed event, which is usually easier than managing each item separately.

Alternative GUI frameworks

There are two other GUI tool-kits that work with Gosu:

Remember that if you primarily want a GUI for your GUI application, not just a GUI in your Gosu game, consider using a dedicated GUI tool-kit, such as Shoes or wxruby-ruby19


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4