Class: GTK::Args

Inherits:
Object show all
Extended by:
ArgsDocs, Docs
Includes:
ArgsDeprecated, Serialize
Defined in:
dragon/args.rb,
dragon/args_docs.rb

Overview

This class is the one you'll interact with the most. It's constructed by the DragonRuby Runtime and is provided to you on each tick.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ArgsDocs

docs_audio, docs_method_sort_order

Methods included from Docs

__docs_append_true_line__, __docs_line_to_html__, __docs_search__, __docs_search_help_text__, __docs_search_results__, __docs_to_html__, __export_docs__!, docs, docs_all, docs_classes, docs_method_sort_order, docs_search, export_docs!, extended

Constructor Details

#initialize(runtime, recording) ⇒ Args

Returns a new instance of Args.


67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'dragon/args.rb', line 67

def initialize runtime, recording
  @inputs = Inputs.new
  @outputs = Outputs.new args: self
  @audio = {}
  @passes = []
  @state = OpenEntity.new
  @state.tick_count = -1
  @runtime = runtime
  @recording = recording
  @grid = Grid.new runtime
  @render_targets = {}
  @pixel_arrays = {}
  @all_tests = []
  @geometry = GTK::Geometry
  @fn = GTK::Fn
  @wizards = Wizards.new
  @layout = GTK::Layout.new @grid.w, @grid.h
  @easing = GTK::Easing
  @string = String
end

Instance Attribute Details

#audioHash

Contains the means to interact with the audio mixer.

Returns:

  • (Hash)

27
28
29
# File 'dragon/args.rb', line 27

def audio
  @audio
end

#easingObject

Returns the value of attribute easing


63
64
65
# File 'dragon/args.rb', line 63

def easing
  @easing
end

#fnObject

Returns the value of attribute fn


44
45
46
# File 'dragon/args.rb', line 44

def fn
  @fn
end

#geometryGeometry

Gives you access to geometry related functions.

Returns:


42
43
44
# File 'dragon/args.rb', line 42

def geometry
  @geometry
end

#gridGrid

Contains display size information to assist in positioning things on the screen.

Returns:


32
33
34
# File 'dragon/args.rb', line 32

def grid
  @grid
end

#inputsInputs

Contains information related to input devices and input events.

Returns:


17
18
19
# File 'dragon/args.rb', line 17

def inputs
  @inputs
end

#layoutObject

Returns the value of attribute layout


61
62
63
# File 'dragon/args.rb', line 61

def layout
  @layout
end

#outputsOutputs

Contains the means to interact with output devices such as the screen.

Returns:


22
23
24
# File 'dragon/args.rb', line 22

def outputs
  @outputs
end

#passesObject

Returns the value of attribute passes


57
58
59
# File 'dragon/args.rb', line 57

def passes
  @passes
end

#recordingRecording

Provides access to game play recording facilities within Game Toolkit.

Returns:

  • (Recording)

37
38
39
# File 'dragon/args.rb', line 37

def recording
  @recording
end

#runtimeRuntime Also known as: gtk

Gives you access to the top level DragonRuby runtime.

Returns:


54
55
56
# File 'dragon/args.rb', line 54

def runtime
  @runtime
end

#stateOpenEntity

This is where you'll put state associated with your video game.

Returns:

  • (OpenEntity)

49
50
51
# File 'dragon/args.rb', line 49

def state
  @state
end

#stringObject

Returns the value of attribute string


65
66
67
# File 'dragon/args.rb', line 65

def string
  @string
end

#wizardsObject

Returns the value of attribute wizards


59
60
61
# File 'dragon/args.rb', line 59

def wizards
  @wizards
end

Instance Method Details

#autocomplete_methodsObject


235
236
237
# File 'dragon/args.rb', line 235

def autocomplete_methods
  [:inputs, :outputs, :gtk, :state, :geometry, :audio, :grid, :layout, :fn]
end

#bordersObject


187
188
189
# File 'dragon/args.rb', line 187

def borders
  @outputs.borders
end

#clear_pixel_arraysObject


114
115
116
# File 'dragon/args.rb', line 114

def clear_pixel_arrays
  pixel_arrays_clear
end

#clear_render_targetsObject


134
135
136
# File 'dragon/args.rb', line 134

def clear_render_targets
  render_targets_clear
end

#clickObject


207
208
209
210
211
# File 'dragon/args.rb', line 207

def click
  return nil unless @inputs.mouse.click

  @inputs.mouse.click.point
end

#click_atObject


213
214
215
216
217
# File 'dragon/args.rb', line 213

def click_at
  return nil unless @inputs.mouse.click

  @inputs.mouse.click.created_at
end

#controller_oneController

Returns:

See Also:


225
226
227
# File 'dragon/args.rb', line 225

def controller_one
  @inputs.controller_one
end

#controller_twoController

Returns:

See Also:


231
232
233
# File 'dragon/args.rb', line 231

def controller_two
  @inputs.controller_two
end

#destructureObject


110
111
112
# File 'dragon/args.rb', line 110

def destructure
  [grid, inputs, state, outputs, runtime, passes]
end

#keyboardObject


203
204
205
# File 'dragon/args.rb', line 203

def keyboard
  @inputs.keyboard
end

#labelsObject


171
172
173
# File 'dragon/args.rb', line 171

def labels
  @outputs.labels
end

#linesObject


179
180
181
# File 'dragon/args.rb', line 179

def lines
  @outputs.lines
end

#mouseObject


219
220
221
# File 'dragon/args.rb', line 219

def mouse
  @inputs.mouse
end

#pixel_array(name) ⇒ Object


126
127
128
129
130
131
132
# File 'dragon/args.rb', line 126

def pixel_array name
  name = name.to_s
  if !@pixel_arrays[name]
    @pixel_arrays[name] = PixelArray.new
  end
  @pixel_arrays[name]
end

#pixel_arraysObject


122
123
124
# File 'dragon/args.rb', line 122

def pixel_arrays
  @pixel_arrays
end

#pixel_arrays_clearObject


118
119
120
# File 'dragon/args.rb', line 118

def pixel_arrays_clear
  @pixel_arrays = {}
end

#primitivesObject


195
196
197
# File 'dragon/args.rb', line 195

def primitives
  @outputs.primitives
end

#render_target(name) ⇒ Object


146
147
148
149
150
151
152
153
# File 'dragon/args.rb', line 146

def render_target name
  name = name.to_s
  if !@render_targets[name]
    @render_targets[name] = Outputs.new(args: self, target: name, background_color_override: [255, 255, 255, 0])
    @passes << @render_targets[name]
  end
  @render_targets[name]
end

#render_targetsObject


142
143
144
# File 'dragon/args.rb', line 142

def render_targets
  @render_targets
end

#render_targets_clearObject


138
139
140
# File 'dragon/args.rb', line 138

def render_targets_clear
  @render_targets = {}
end

#serializeObject


100
101
102
103
104
105
106
107
108
# File 'dragon/args.rb', line 100

def serialize
  {
    state: state.as_hash,
    inputs: inputs.serialize,
    passes: passes.serialize,
    outputs: outputs.serialize,
    grid: grid.serialize
  }
end

#solidsObject


155
156
157
# File 'dragon/args.rb', line 155

def solids
  @outputs.solids
end

#spritesObject


163
164
165
# File 'dragon/args.rb', line 163

def sprites
  @outputs.sprites
end

#static_bordersObject


191
192
193
# File 'dragon/args.rb', line 191

def static_borders
  @outputs.static_borders
end

#static_labelsObject


175
176
177
# File 'dragon/args.rb', line 175

def static_labels
  @outputs.static_labels
end

#static_linesObject


183
184
185
# File 'dragon/args.rb', line 183

def static_lines
  @outputs.static_lines
end

#static_primitivesObject


199
200
201
# File 'dragon/args.rb', line 199

def static_primitives
  @outputs.static_primitives
end

#static_solidsObject


159
160
161
# File 'dragon/args.rb', line 159

def static_solids
  @outputs.static_solids
end

#static_spritesObject


167
168
169
# File 'dragon/args.rb', line 167

def static_sprites
  @outputs.static_sprites
end

#tick_countInteger

The number of ticks since the start of the game.

Returns:


92
93
94
# File 'dragon/args.rb', line 92

def tick_count
  @state.tick_count
end

#tick_count=(value) ⇒ Object


96
97
98
# File 'dragon/args.rb', line 96

def tick_count= value
  @state.tick_count = value
end