Module: CyberarmEngine::DSL

Included in:
GuiState
Defined in:
lib/cyberarm_engine/ui/dsl.rb

Instance Method Summary collapse

Instance Method Details

#background(color = Gosu::Color::NONE) ⇒ Object



103
104
105
# File 'lib/cyberarm_engine/ui/dsl.rb', line 103

def background(color = Gosu::Color::NONE)
  element_parent.style.default[:background] = color
end

#button(text, options = {}, &block) ⇒ Object



33
34
35
36
37
38
# File 'lib/cyberarm_engine/ui/dsl.rb', line 33

def button(text, options = {}, &block)
  options[:parent] ||= element_parent
  options[:theme] ||= current_theme

  add_element(Element::Button.new(text, options, block) { block.call if block.is_a?(Proc) })
end

#check_box(text, options = {}, &block) ⇒ Object



75
76
77
78
79
80
# File 'lib/cyberarm_engine/ui/dsl.rb', line 75

def check_box(text, options = {}, &block)
  options[:parent] ||= element_parent
  options[:theme] ||= current_theme

  add_element(Element::CheckBox.new(text, options, block))
end

#current_themeObject



111
112
113
# File 'lib/cyberarm_engine/ui/dsl.rb', line 111

def current_theme
  element_parent.options[:theme]
end

#edit_box(text, options = {}, &block) ⇒ Object



61
62
63
64
65
66
# File 'lib/cyberarm_engine/ui/dsl.rb', line 61

def edit_box(text, options = {}, &block)
  options[:parent] ||= element_parent
  options[:theme] ||= current_theme

  add_element(Element::EditBox.new(text, options, block))
end

#edit_line(text, options = {}, &block) ⇒ Object



54
55
56
57
58
59
# File 'lib/cyberarm_engine/ui/dsl.rb', line 54

def edit_line(text, options = {}, &block)
  options[:parent] ||= element_parent
  options[:theme] ||= current_theme

  add_element(Element::EditLine.new(text, options, block))
end

#flow(options = {}, &block) ⇒ Object



3
4
5
# File 'lib/cyberarm_engine/ui/dsl.rb', line 3

def flow(options = {}, &block)
  container(CyberarmEngine::Element::Flow, options, &block)
end

#image(path, options = {}, &block) ⇒ Object



82
83
84
85
86
87
# File 'lib/cyberarm_engine/ui/dsl.rb', line 82

def image(path, options = {}, &block)
  options[:parent] ||= element_parent
  options[:theme] ||= current_theme

  add_element(Element::Image.new(path, options, block))
end

#list_box(options = {}, &block) ⇒ Object



40
41
42
43
44
45
# File 'lib/cyberarm_engine/ui/dsl.rb', line 40

def list_box(options = {}, &block)
  options[:parent] ||= element_parent
  options[:theme] ||= current_theme

  add_element(Element::ListBox.new(options, block) { block.call if block.is_a?(Proc) })
end


11
12
13
# File 'lib/cyberarm_engine/ui/dsl.rb', line 11

def menu(options = {}, &block)
  container(CyberarmEngine::Element::Menu, options, &block)
end


47
48
49
50
51
52
# File 'lib/cyberarm_engine/ui/dsl.rb', line 47

def menu_item(text, options = {}, &block)
  options[:parent] ||= element_parent
  options[:theme] ||= current_theme

  add_element(Element::MenuItem.new(text, options, block) { block.call if block.is_a?(Proc) })
end

#progress(options = {}, &block) ⇒ Object



89
90
91
92
93
94
# File 'lib/cyberarm_engine/ui/dsl.rb', line 89

def progress(options = {}, &block)
  options[:parent] ||= element_parent
  options[:theme] ||= current_theme

  add_element(Element::Progress.new(options, block))
end

#slider(options = {}, &block) ⇒ Object



96
97
98
99
100
101
# File 'lib/cyberarm_engine/ui/dsl.rb', line 96

def slider(options = {}, &block)
  options[:parent] ||= element_parent
  options[:theme] ||= current_theme

  add_element(Element::Slider.new(options, block))
end

#stack(options = {}, &block) ⇒ Object



7
8
9
# File 'lib/cyberarm_engine/ui/dsl.rb', line 7

def stack(options = {}, &block)
  container(CyberarmEngine::Element::Stack, options, &block)
end

#theme(theme) ⇒ Object



107
108
109
# File 'lib/cyberarm_engine/ui/dsl.rb', line 107

def theme(theme)
  element_parent.options[:theme] ||= theme
end

#toggle_button(options = {}, &block) ⇒ Object



68
69
70
71
72
73
# File 'lib/cyberarm_engine/ui/dsl.rb', line 68

def toggle_button(options = {}, &block)
  options[:parent] ||= element_parent
  options[:theme] ||= current_theme

  add_element(Element::ToggleButton.new(options, block))
end