Project

white_gold

0.0
The project is in a healthy, maintained state
Ruby gem for building pure ruby graphical user interface. Uses TGUI & SFML as a backend. Dedicated to creating single-file applications and learning programming.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.1
 Project Readme

White Gold

Ruby gem for building pure ruby graphical user interface.
Uses TGUI & SFML as a backend.
Dedicated to creating single-file applications and learning programming.

Taste

require 'white_gold'

title! "Greeting app"
text_size! 30

label! text: "Enter your name:", position: [100, 150], size: [340, 44]
@name = editbox! position: [375, 146], size: [280, 44]
button! text: "Then press the button", position: [200, 250] do
  on_press! do
    text = @name.text
    text = "world" if text.strip.empty?
    gui.messagebox! text: "Hello #{text}!", position: :center do
      button! text: "Close", on_press: proc{ window.close }
    end
  end
end

Output:

Check out sample for more.

Requirements

  • Ruby >= 3.2.2
  • Fiddle >= 1.1.1

Binaries for Windows and Linux os are bundled with the gem.

Installation

  1. From official
gem install white_gold
  1. From source
git clone https://github.com/lpogic/white_gold
cd white_gold
gem build white_gold.gemspec
gem install white_gold-0.0.4.gem

Basic usage

require 'white_gold'

button! text: "Exit", position: :center, on_press: proc.exit

def exit
  window.close
end

Advanced usage

require 'white_gold/master'

class FirstPage < Page
  def build
    button! text: "Second Page", position: :center, on_press: proc{ go SecondPage }
  end

end

class SecondPage < Page
  def build
    button! text: "Exit", position: :center, on_press: proc.exit
  end

  def exit
    window.close
  end
end

WhiteGold.new.run FirstPage

Check out documentation for more info.

Status

A hobby project maintained by one person.

Authors

Łukasz Pomietło(oficjalnyadreslukasza@gmail.com)