fidgit 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +7 -7
- data/.rspec +2 -2
- data/CHANGELOG.md +30 -30
- data/Gemfile +3 -3
- data/LICENSE.txt +19 -19
- data/README.textile +139 -139
- data/Rakefile +37 -37
- data/config/default_schema.yml +216 -216
- data/examples/_all_examples.rb +9 -9
- data/examples/align_example.rb +55 -55
- data/examples/button_and_toggle_button_example.rb +37 -37
- data/examples/color_picker_example.rb +16 -16
- data/examples/color_well_example.rb +24 -24
- data/examples/combo_box_example.rb +23 -23
- data/examples/file_dialog_example.rb +41 -41
- data/examples/grid_packer_example.rb +28 -28
- data/examples/helpers/example_window.rb +16 -16
- data/examples/label_example.rb +22 -22
- data/examples/list_example.rb +22 -22
- data/examples/menu_pane_example.rb +26 -26
- data/examples/message_dialog_example.rb +64 -64
- data/examples/radio_button_example.rb +36 -36
- data/examples/readme_example.rb +31 -31
- data/examples/scroll_window_example.rb +48 -48
- data/examples/slider_example.rb +33 -33
- data/examples/splash_example.rb +41 -41
- data/examples/text_area_example.rb +32 -32
- data/fidgit.gemspec +35 -35
- data/lib/fidgit.rb +50 -50
- data/lib/fidgit/chingu_ext/window.rb +5 -5
- data/lib/fidgit/cursor.rb +37 -37
- data/lib/fidgit/elements/button.rb +112 -112
- data/lib/fidgit/elements/color_picker.rb +62 -62
- data/lib/fidgit/elements/color_well.rb +38 -38
- data/lib/fidgit/elements/combo_box.rb +113 -113
- data/lib/fidgit/elements/composite.rb +16 -16
- data/lib/fidgit/elements/container.rb +208 -208
- data/lib/fidgit/elements/element.rb +297 -297
- data/lib/fidgit/elements/file_browser.rb +151 -151
- data/lib/fidgit/elements/grid.rb +226 -226
- data/lib/fidgit/elements/group.rb +64 -64
- data/lib/fidgit/elements/horizontal.rb +11 -11
- data/lib/fidgit/elements/image_frame.rb +64 -64
- data/lib/fidgit/elements/label.rb +84 -84
- data/lib/fidgit/elements/list.rb +46 -46
- data/lib/fidgit/elements/main_packer.rb +24 -24
- data/lib/fidgit/elements/menu_pane.rb +160 -160
- data/lib/fidgit/elements/packer.rb +41 -41
- data/lib/fidgit/elements/radio_button.rb +85 -85
- data/lib/fidgit/elements/scroll_area.rb +67 -67
- data/lib/fidgit/elements/scroll_bar.rb +127 -127
- data/lib/fidgit/elements/scroll_window.rb +82 -82
- data/lib/fidgit/elements/slider.rb +124 -124
- data/lib/fidgit/elements/text_area.rb +493 -493
- data/lib/fidgit/elements/text_line.rb +91 -91
- data/lib/fidgit/elements/toggle_button.rb +66 -66
- data/lib/fidgit/elements/tool_tip.rb +34 -34
- data/lib/fidgit/elements/vertical.rb +11 -11
- data/lib/fidgit/event.rb +158 -158
- data/lib/fidgit/gosu_ext/color.rb +135 -135
- data/lib/fidgit/gosu_ext/gosu_module.rb +24 -24
- data/lib/fidgit/history.rb +90 -90
- data/lib/fidgit/redirector.rb +82 -82
- data/lib/fidgit/schema.rb +123 -123
- data/lib/fidgit/selection.rb +105 -105
- data/lib/fidgit/standard_ext/hash.rb +20 -20
- data/lib/fidgit/states/dialog_state.rb +51 -51
- data/lib/fidgit/states/file_dialog.rb +24 -24
- data/lib/fidgit/states/gui_state.rb +329 -329
- data/lib/fidgit/states/message_dialog.rb +60 -60
- data/lib/fidgit/version.rb +4 -4
- data/lib/fidgit/window.rb +19 -19
- data/spec/fidgit/elements/helpers/helper.rb +2 -2
- data/spec/fidgit/elements/helpers/tex_play_helper.rb +8 -8
- data/spec/fidgit/elements/image_frame_spec.rb +68 -68
- data/spec/fidgit/elements/label_spec.rb +36 -36
- data/spec/fidgit/event_spec.rb +209 -209
- data/spec/fidgit/gosu_ext/color_spec.rb +129 -129
- data/spec/fidgit/gosu_ext/helpers/helper.rb +2 -2
- data/spec/fidgit/helpers/helper.rb +3 -3
- data/spec/fidgit/history_spec.rb +153 -153
- data/spec/fidgit/redirector_spec.rb +77 -77
- data/spec/fidgit/schema_spec.rb +66 -66
- data/spec/fidgit/schema_test.yml +32 -32
- metadata +67 -22
@@ -1,38 +1,38 @@
|
|
1
|
-
require_relative 'helpers/example_window'
|
2
|
-
|
3
|
-
# Example for Button and ToggleButton
|
4
|
-
class ExampleState < Fidgit::GuiState
|
5
|
-
def initialize
|
6
|
-
super
|
7
|
-
|
8
|
-
vertical do
|
9
|
-
my_label = label "Label", tip: "I'm a label"
|
10
|
-
|
11
|
-
buttons = []
|
12
|
-
|
13
|
-
# A plain button, with some text on it.
|
14
|
-
buttons << button("Button", tip: "I'm a button; press me!", shortcut: :auto) do
|
15
|
-
my_label.text = "Pressed the button!"
|
16
|
-
end
|
17
|
-
|
18
|
-
# Buttons with icons in each possible positions.
|
19
|
-
[:left, :right, :top, :bottom].each do |position|
|
20
|
-
buttons << button("Icon at #{position}", icon: Gosu::Image["head_icon.png"], icon_position: position, icon_options: { factor: 2 }, tip: "I'm a button; press me!", shortcut: :auto) do
|
21
|
-
my_label.text = "Pressed the button (icon to #{position})!"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
# A toggling button.
|
26
|
-
buttons << toggle_button("ToggleButton", tip: "I'm a button that toggles", shortcut: :o) do |sender, value|
|
27
|
-
my_label.text = "Turned the toggle button #{value ? "on" : "off"}!"
|
28
|
-
end
|
29
|
-
|
30
|
-
# A toggle-button that controls whether all the other buttons are enabled.
|
31
|
-
toggle_button("Enable other two buttons", value: true) do |sender, value|
|
32
|
-
buttons.each {|button| button.enabled = value }
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
1
|
+
require_relative 'helpers/example_window'
|
2
|
+
|
3
|
+
# Example for Button and ToggleButton
|
4
|
+
class ExampleState < Fidgit::GuiState
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
|
8
|
+
vertical do
|
9
|
+
my_label = label "Label", tip: "I'm a label"
|
10
|
+
|
11
|
+
buttons = []
|
12
|
+
|
13
|
+
# A plain button, with some text on it.
|
14
|
+
buttons << button("Button", tip: "I'm a button; press me!", shortcut: :auto) do
|
15
|
+
my_label.text = "Pressed the button!"
|
16
|
+
end
|
17
|
+
|
18
|
+
# Buttons with icons in each possible positions.
|
19
|
+
[:left, :right, :top, :bottom].each do |position|
|
20
|
+
buttons << button("Icon at #{position}", icon: Gosu::Image["head_icon.png"], icon_position: position, icon_options: { factor: 2 }, tip: "I'm a button; press me!", shortcut: :auto) do
|
21
|
+
my_label.text = "Pressed the button (icon to #{position})!"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# A toggling button.
|
26
|
+
buttons << toggle_button("ToggleButton", tip: "I'm a button that toggles", shortcut: :o) do |sender, value|
|
27
|
+
my_label.text = "Turned the toggle button #{value ? "on" : "off"}!"
|
28
|
+
end
|
29
|
+
|
30
|
+
# A toggle-button that controls whether all the other buttons are enabled.
|
31
|
+
toggle_button("Enable other two buttons", value: true) do |sender, value|
|
32
|
+
buttons.each {|button| button.enabled = value }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
38
|
ExampleWindow.new.show
|
@@ -1,17 +1,17 @@
|
|
1
|
-
require_relative 'helpers/example_window'
|
2
|
-
|
3
|
-
class ExampleState < Fidgit::GuiState
|
4
|
-
def initialize
|
5
|
-
super
|
6
|
-
|
7
|
-
vertical do
|
8
|
-
my_label = label 'No color picked'
|
9
|
-
|
10
|
-
color_picker(width: 100) do |sender, color|
|
11
|
-
my_label.text = color.to_s
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
1
|
+
require_relative 'helpers/example_window'
|
2
|
+
|
3
|
+
class ExampleState < Fidgit::GuiState
|
4
|
+
def initialize
|
5
|
+
super
|
6
|
+
|
7
|
+
vertical do
|
8
|
+
my_label = label 'No color picked'
|
9
|
+
|
10
|
+
color_picker(width: 100) do |sender, color|
|
11
|
+
my_label.text = color.to_s
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
17
|
ExampleWindow.new.show
|
@@ -1,25 +1,25 @@
|
|
1
|
-
require_relative 'helpers/example_window'
|
2
|
-
|
3
|
-
class ExampleState < Fidgit::GuiState
|
4
|
-
def initialize
|
5
|
-
super
|
6
|
-
|
7
|
-
vertical do
|
8
|
-
my_label = label "No color selected."
|
9
|
-
|
10
|
-
group do
|
11
|
-
grid num_columns: 15, padding: 0, spacing: 4 do
|
12
|
-
150.times do
|
13
|
-
color_well(color: Gosu::Color.rgb(rand(255), rand(255), rand(255)))
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
subscribe :changed do |sender, color|
|
18
|
-
my_label.text = color.to_s
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
1
|
+
require_relative 'helpers/example_window'
|
2
|
+
|
3
|
+
class ExampleState < Fidgit::GuiState
|
4
|
+
def initialize
|
5
|
+
super
|
6
|
+
|
7
|
+
vertical do
|
8
|
+
my_label = label "No color selected."
|
9
|
+
|
10
|
+
group do
|
11
|
+
grid num_columns: 15, padding: 0, spacing: 4 do
|
12
|
+
150.times do
|
13
|
+
color_well(color: Gosu::Color.rgb(rand(255), rand(255), rand(255)))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
subscribe :changed do |sender, color|
|
18
|
+
my_label.text = color.to_s
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
25
|
ExampleWindow.new.show
|
@@ -1,24 +1,24 @@
|
|
1
|
-
require_relative 'helpers/example_window'
|
2
|
-
|
3
|
-
# Example for Button and ToggleButton
|
4
|
-
class ExampleState < Fidgit::GuiState
|
5
|
-
def initialize
|
6
|
-
super
|
7
|
-
|
8
|
-
vertical do
|
9
|
-
my_label = label "Label", tip: "I'm a label"
|
10
|
-
|
11
|
-
combo_box(value: 1, tip: "I'm a combo box; press me and make a selection!") do
|
12
|
-
subscribe :changed do |sender, value|
|
13
|
-
my_label.text = "Chose #{value}!"
|
14
|
-
end
|
15
|
-
|
16
|
-
item "One", 1
|
17
|
-
item "Two", 2
|
18
|
-
item "Three", 3
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
1
|
+
require_relative 'helpers/example_window'
|
2
|
+
|
3
|
+
# Example for Button and ToggleButton
|
4
|
+
class ExampleState < Fidgit::GuiState
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
|
8
|
+
vertical do
|
9
|
+
my_label = label "Label", tip: "I'm a label"
|
10
|
+
|
11
|
+
combo_box(value: 1, tip: "I'm a combo box; press me and make a selection!") do
|
12
|
+
subscribe :changed do |sender, value|
|
13
|
+
my_label.text = "Chose #{value}!"
|
14
|
+
end
|
15
|
+
|
16
|
+
item "One", 1
|
17
|
+
item "Two", 2
|
18
|
+
item "Three", 3
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
24
|
ExampleWindow.new.show
|
@@ -1,42 +1,42 @@
|
|
1
|
-
require_relative 'helpers/example_window'
|
2
|
-
|
3
|
-
|
4
|
-
Fidgit::Element.schema.merge_elements!(Element: { font_height: 15 })
|
5
|
-
|
6
|
-
class ExampleState < Fidgit::GuiState
|
7
|
-
def initialize
|
8
|
-
super
|
9
|
-
|
10
|
-
container.background_color = Gosu::Color.rgb(50, 50, 50)
|
11
|
-
vertical align: :center do
|
12
|
-
full_base_directory = ''
|
13
|
-
restricted_base_directory = File.expand_path(File.join(__FILE__, '..', '..'))
|
14
|
-
directory = File.join(restricted_base_directory, 'media', 'images')
|
15
|
-
|
16
|
-
my_label = label "No files are actually loaded or saved by this example"
|
17
|
-
button("Load...(limited path access)") do
|
18
|
-
file_dialog(:open, base_directory: restricted_base_directory, directory: directory, pattern: "*.png") do |result, file|
|
19
|
-
case result
|
20
|
-
when :open
|
21
|
-
my_label.text = "Loaded #{file}"
|
22
|
-
when :cancel
|
23
|
-
my_label.text = "Loading cancelled"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
button("Save...(unrestricted path access)") do
|
29
|
-
file_dialog(:save, base_directory: full_base_directory, directory: directory, pattern: "*.png") do |result, file|
|
30
|
-
case result
|
31
|
-
when :save
|
32
|
-
my_label.text = "Saved #{file}"
|
33
|
-
when :cancel
|
34
|
-
my_label.text = "Save cancelled"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
1
|
+
require_relative 'helpers/example_window'
|
2
|
+
|
3
|
+
|
4
|
+
Fidgit::Element.schema.merge_elements!(Element: { font_height: 15 })
|
5
|
+
|
6
|
+
class ExampleState < Fidgit::GuiState
|
7
|
+
def initialize
|
8
|
+
super
|
9
|
+
|
10
|
+
container.background_color = Gosu::Color.rgb(50, 50, 50)
|
11
|
+
vertical align: :center do
|
12
|
+
full_base_directory = ''
|
13
|
+
restricted_base_directory = File.expand_path(File.join(__FILE__, '..', '..'))
|
14
|
+
directory = File.join(restricted_base_directory, 'media', 'images')
|
15
|
+
|
16
|
+
my_label = label "No files are actually loaded or saved by this example"
|
17
|
+
button("Load...(limited path access)") do
|
18
|
+
file_dialog(:open, base_directory: restricted_base_directory, directory: directory, pattern: "*.png") do |result, file|
|
19
|
+
case result
|
20
|
+
when :open
|
21
|
+
my_label.text = "Loaded #{file}"
|
22
|
+
when :cancel
|
23
|
+
my_label.text = "Loading cancelled"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
button("Save...(unrestricted path access)") do
|
29
|
+
file_dialog(:save, base_directory: full_base_directory, directory: directory, pattern: "*.png") do |result, file|
|
30
|
+
case result
|
31
|
+
when :save
|
32
|
+
my_label.text = "Saved #{file}"
|
33
|
+
when :cancel
|
34
|
+
my_label.text = "Save cancelled"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
42
|
ExampleWindow.new.show
|
@@ -1,29 +1,29 @@
|
|
1
|
-
require_relative 'helpers/example_window'
|
2
|
-
|
3
|
-
class ExampleState < Fidgit::GuiState
|
4
|
-
BORDER_COLOR = Gosu::Color.rgb(255, 0, 0)
|
5
|
-
FIXED_NUM = 5
|
6
|
-
NUM_CELLS = 17
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
super
|
10
|
-
|
11
|
-
vertical do
|
12
|
-
label "Grid with #{FIXED_NUM} columns"
|
13
|
-
grid num_columns: FIXED_NUM, border_color: BORDER_COLOR, cell_border_color: Gosu::Color.rgba(0, 255, 0, 255), cell_border_thickness: 1 do
|
14
|
-
NUM_CELLS.times do |i|
|
15
|
-
label "Cell #{i}", font_height: rand(15) + 15, border_color: BORDER_COLOR, border_thickness: 1
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
label "Grid with #{FIXED_NUM} rows"
|
20
|
-
grid num_rows: FIXED_NUM, border_color: BORDER_COLOR, cell_background_color: Gosu::Color.rgba(0, 100, 100, 255) do
|
21
|
-
NUM_CELLS.times do |i|
|
22
|
-
label "Cell #{i}", font_height: rand(15) + 15, border_color: BORDER_COLOR, border_thickness: 1
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
1
|
+
require_relative 'helpers/example_window'
|
2
|
+
|
3
|
+
class ExampleState < Fidgit::GuiState
|
4
|
+
BORDER_COLOR = Gosu::Color.rgb(255, 0, 0)
|
5
|
+
FIXED_NUM = 5
|
6
|
+
NUM_CELLS = 17
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
super
|
10
|
+
|
11
|
+
vertical do
|
12
|
+
label "Grid with #{FIXED_NUM} columns"
|
13
|
+
grid num_columns: FIXED_NUM, border_color: BORDER_COLOR, cell_border_color: Gosu::Color.rgba(0, 255, 0, 255), cell_border_thickness: 1 do
|
14
|
+
NUM_CELLS.times do |i|
|
15
|
+
label "Cell #{i}", font_height: rand(15) + 15, border_color: BORDER_COLOR, border_thickness: 1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
label "Grid with #{FIXED_NUM} rows"
|
20
|
+
grid num_rows: FIXED_NUM, border_color: BORDER_COLOR, cell_background_color: Gosu::Color.rgba(0, 100, 100, 255) do
|
21
|
+
NUM_CELLS.times do |i|
|
22
|
+
label "Cell #{i}", font_height: rand(15) + 15, border_color: BORDER_COLOR, border_thickness: 1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
29
|
ExampleWindow.new.show
|
@@ -1,17 +1,17 @@
|
|
1
|
-
require_relative '../../lib/fidgit'
|
2
|
-
|
3
|
-
media_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'media'))
|
4
|
-
Gosu::Image.autoload_dirs << File.join(media_dir, 'images')
|
5
|
-
Gosu::Sample.autoload_dirs << File.join(media_dir, 'samples')
|
6
|
-
Gosu::Font.autoload_dirs << File.join(media_dir, 'fonts')
|
7
|
-
|
8
|
-
class ExampleWindow < Chingu::Window
|
9
|
-
def initialize(options = {})
|
10
|
-
super(640, 480, false)
|
11
|
-
|
12
|
-
on_input(:escape) { close }
|
13
|
-
|
14
|
-
caption = "#{File.basename($0).chomp(".rb").tr('_', ' ')} #{ENV['FIDGIT_EXAMPLES_TEXT']}"
|
15
|
-
push_game_state ExampleState
|
16
|
-
end
|
1
|
+
require_relative '../../lib/fidgit'
|
2
|
+
|
3
|
+
media_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'media'))
|
4
|
+
Gosu::Image.autoload_dirs << File.join(media_dir, 'images')
|
5
|
+
Gosu::Sample.autoload_dirs << File.join(media_dir, 'samples')
|
6
|
+
Gosu::Font.autoload_dirs << File.join(media_dir, 'fonts')
|
7
|
+
|
8
|
+
class ExampleWindow < Chingu::Window
|
9
|
+
def initialize(options = {})
|
10
|
+
super(640, 480, false)
|
11
|
+
|
12
|
+
on_input(:escape) { close }
|
13
|
+
|
14
|
+
caption = "#{File.basename($0).chomp(".rb").tr('_', ' ')} #{ENV['FIDGIT_EXAMPLES_TEXT']}"
|
15
|
+
push_game_state ExampleState
|
16
|
+
end
|
17
17
|
end
|
data/examples/label_example.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
require_relative 'helpers/example_window'
|
2
|
-
|
3
|
-
# Labels can have text and/or icons.
|
4
|
-
class ExampleState < Fidgit::GuiState
|
5
|
-
def initialize
|
6
|
-
super
|
7
|
-
|
8
|
-
vertical background_color: Gosu::Color.rgb(255, 0, 0) do
|
9
|
-
label "Hello!", tip: 'A label with text'
|
10
|
-
label "Hello!", icon: Gosu::Image["head_icon.png"], tip: 'A label with text & icon'
|
11
|
-
label '', icon: Gosu::Image["head_icon.png"], tip: 'A label with just icon'
|
12
|
-
label '', background_color: Gosu::Color.rgb(0, 255, 0), tip: 'No text or icon'
|
13
|
-
end
|
14
|
-
|
15
|
-
vertical do
|
16
|
-
label ":left justification", width: 400, background_color: Gosu::Color.rgb(0, 100, 0), justify: :left, tip: 'A label with text'
|
17
|
-
label ":right justification", width: 400, background_color: Gosu::Color.rgb(0, 100, 0), justify: :right, tip: 'A label with text'
|
18
|
-
label ":center justification", width: 400, background_color: Gosu::Color.rgb(0, 100, 0), justify: :center, tip: 'A label with text'
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
1
|
+
require_relative 'helpers/example_window'
|
2
|
+
|
3
|
+
# Labels can have text and/or icons.
|
4
|
+
class ExampleState < Fidgit::GuiState
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
|
8
|
+
vertical background_color: Gosu::Color.rgb(255, 0, 0) do
|
9
|
+
label "Hello!", tip: 'A label with text'
|
10
|
+
label "Hello!", icon: Gosu::Image["head_icon.png"], tip: 'A label with text & icon'
|
11
|
+
label '', icon: Gosu::Image["head_icon.png"], tip: 'A label with just icon'
|
12
|
+
label '', background_color: Gosu::Color.rgb(0, 255, 0), tip: 'No text or icon'
|
13
|
+
end
|
14
|
+
|
15
|
+
vertical do
|
16
|
+
label ":left justification", width: 400, background_color: Gosu::Color.rgb(0, 100, 0), justify: :left, tip: 'A label with text'
|
17
|
+
label ":right justification", width: 400, background_color: Gosu::Color.rgb(0, 100, 0), justify: :right, tip: 'A label with text'
|
18
|
+
label ":center justification", width: 400, background_color: Gosu::Color.rgb(0, 100, 0), justify: :center, tip: 'A label with text'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
23
|
ExampleWindow.new.show
|
data/examples/list_example.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
require_relative 'helpers/example_window'
|
2
|
-
|
3
|
-
# Labels can have text and/or icons.
|
4
|
-
class ExampleState < Fidgit::GuiState
|
5
|
-
def initialize
|
6
|
-
super
|
7
|
-
|
8
|
-
vertical do
|
9
|
-
my_label = label "No clicky"
|
10
|
-
|
11
|
-
list do
|
12
|
-
item "chunky bacon", :CHUNKYBACON, tip: "You prefer Chunky Bacon, don't you?"
|
13
|
-
item "lentils", :LENTILS, tip: "Lentils? Well, I suppose someone has to like them"
|
14
|
-
|
15
|
-
subscribe :changed do |sender, value|
|
16
|
-
my_label.text = "I like #{value} more than anything in the world!"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
1
|
+
require_relative 'helpers/example_window'
|
2
|
+
|
3
|
+
# Labels can have text and/or icons.
|
4
|
+
class ExampleState < Fidgit::GuiState
|
5
|
+
def initialize
|
6
|
+
super
|
7
|
+
|
8
|
+
vertical do
|
9
|
+
my_label = label "No clicky"
|
10
|
+
|
11
|
+
list do
|
12
|
+
item "chunky bacon", :CHUNKYBACON, tip: "You prefer Chunky Bacon, don't you?"
|
13
|
+
item "lentils", :LENTILS, tip: "Lentils? Well, I suppose someone has to like them"
|
14
|
+
|
15
|
+
subscribe :changed do |sender, value|
|
16
|
+
my_label.text = "I like #{value} more than anything in the world!"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
23
|
ExampleWindow.new.show
|