Class: Metro::Game::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/metro/game/dsl.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.parse(&block) ⇒ Object



7
8
9
10
11
# File 'lib/metro/game/dsl.rb', line 7

def self.parse(&block)
  config = new
  config.instance_eval(&block)
  config
end

Instance Method Details

#author(name) ⇒ Object Also known as: artist, designer



41
42
43
# File 'lib/metro/game/dsl.rb', line 41

def author(name)
  authors.push name
end

#authorsObject



45
46
47
# File 'lib/metro/game/dsl.rb', line 45

def authors
  @authors ||= []
end

#contact(game_contact = nil) ⇒ Object



56
57
58
# File 'lib/metro/game/dsl.rb', line 56

def contact(game_contact = nil)
  game_contact ? @contact = game_contact : @contact
end

#controls(&block) ⇒ Object



60
61
62
63
64
# File 'lib/metro/game/dsl.rb', line 60

def controls(&block)
  @controls ||= Controls.new
  @controls.instance_eval(&block) if block
  @controls
end

#debug(set_debug = nil) ⇒ Object



33
34
35
# File 'lib/metro/game/dsl.rb', line 33

def debug(set_debug = nil)
  set_debug.nil? ? @debug : @debug = set_debug
end

#first_scene(scene_name = nil) ⇒ Object



13
14
15
# File 'lib/metro/game/dsl.rb', line 13

def first_scene(scene_name = nil)
  scene_name ? @first_scene = scene_name : @first_scene
end

#fullscreen(set_fullscreen = nil) ⇒ Object



29
30
31
# File 'lib/metro/game/dsl.rb', line 29

def fullscreen(set_fullscreen = nil)
  set_fullscreen.nil? ? @fullscreen : @fullscreen = set_fullscreen
end

#height(game_height = nil) ⇒ Object



21
22
23
# File 'lib/metro/game/dsl.rb', line 21

def height(game_height = nil)
  game_height ? @height = game_height : @height
end

#name(set_name = nil) ⇒ Object



37
38
39
# File 'lib/metro/game/dsl.rb', line 37

def name(set_name = nil)
  set_name.nil? ? @name : @name = set_name
end

#resolution(w, h) ⇒ Object



25
26
27
# File 'lib/metro/game/dsl.rb', line 25

def resolution(w,h)
  [ width(w), height(h) ]
end

#website(game_website = nil) ⇒ Object



52
53
54
# File 'lib/metro/game/dsl.rb', line 52

def website(game_website = nil)
  game_website ? @website = game_website : @website
end

#width(game_width = nil) ⇒ Object



17
18
19
# File 'lib/metro/game/dsl.rb', line 17

def width(game_width = nil)
  game_width ? @width = game_width : @width
end