Class: SpriteKit::Scene
- Inherits:
-
Object
- Object
- SpriteKit::Scene
- Defined in:
- mygame/lib/sprite_kit/scene.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#audio ⇒ Object
Returns the value of attribute audio.
-
#draw_buffer ⇒ Object
Returns the value of attribute draw_buffer.
-
#events ⇒ Object
Returns the value of attribute events.
-
#inputs ⇒ Object
Returns the value of attribute inputs.
-
#keyboard ⇒ Object
Returns the value of attribute keyboard.
-
#mouse ⇒ Object
Returns the value of attribute mouse.
-
#outputs ⇒ Object
Returns the value of attribute outputs.
-
#state ⇒ Object
Returns the value of attribute state.
-
#top_layer ⇒ Object
Returns the value of attribute top_layer.
Instance Method Summary collapse
- #calc ⇒ Object
- #draw ⇒ Object
-
#initialize(scene_manager) ⇒ Scene
constructor
A new instance of Scene.
- #input ⇒ Object
- #render ⇒ Object
- #render_top_layer ⇒ Object
- #tick(args) ⇒ Object
Constructor Details
#initialize(scene_manager) ⇒ Scene
Returns a new instance of Scene.
7 8 9 10 |
# File 'mygame/lib/sprite_kit/scene.rb', line 7 def initialize(scene_manager) @scene_manager = scene_manager @draw_buffer = DrawBuffer.new end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
5 6 7 |
# File 'mygame/lib/sprite_kit/scene.rb', line 5 def args @args end |
#audio ⇒ Object
Returns the value of attribute audio.
5 6 7 |
# File 'mygame/lib/sprite_kit/scene.rb', line 5 def audio @audio end |
#draw_buffer ⇒ Object
Returns the value of attribute draw_buffer.
5 6 7 |
# File 'mygame/lib/sprite_kit/scene.rb', line 5 def draw_buffer @draw_buffer end |
#events ⇒ Object
Returns the value of attribute events.
5 6 7 |
# File 'mygame/lib/sprite_kit/scene.rb', line 5 def events @events end |
#inputs ⇒ Object
Returns the value of attribute inputs.
5 6 7 |
# File 'mygame/lib/sprite_kit/scene.rb', line 5 def inputs @inputs end |
#keyboard ⇒ Object
Returns the value of attribute keyboard.
5 6 7 |
# File 'mygame/lib/sprite_kit/scene.rb', line 5 def keyboard @keyboard end |
#mouse ⇒ Object
Returns the value of attribute mouse.
5 6 7 |
# File 'mygame/lib/sprite_kit/scene.rb', line 5 def mouse @mouse end |
#outputs ⇒ Object
Returns the value of attribute outputs.
5 6 7 |
# File 'mygame/lib/sprite_kit/scene.rb', line 5 def outputs @outputs end |
#state ⇒ Object
Returns the value of attribute state.
5 6 7 |
# File 'mygame/lib/sprite_kit/scene.rb', line 5 def state @state end |
#top_layer ⇒ Object
Returns the value of attribute top_layer.
5 6 7 |
# File 'mygame/lib/sprite_kit/scene.rb', line 5 def top_layer @top_layer end |
Instance Method Details
#calc ⇒ Object
40 41 |
# File 'mygame/lib/sprite_kit/scene.rb', line 40 def calc end |
#draw ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'mygame/lib/sprite_kit/scene.rb', line 57 def draw render_top_layer GTK.warn_array_primitives! GTK.framerate_diagnostics_primitives.map.with_index do |primitive, index| primitive.y = 1 + index * 16 end @draw_buffer.flush end |
#input ⇒ Object
37 38 |
# File 'mygame/lib/sprite_kit/scene.rb', line 37 def input end |
#render ⇒ Object
43 44 |
# File 'mygame/lib/sprite_kit/scene.rb', line 43 def render end |
#render_top_layer ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'mygame/lib/sprite_kit/scene.rb', line 46 def render_top_layer # Goes on top of everything. @top_layer.w = Grid.w @top_layer.h = Grid.h @outputs[:top_layer].w = @top_layer.w @outputs[:top_layer].h = @top_layer.h @outputs[:top_layer].transient! @draw_buffer.primitives << @top_layer end |
#tick(args) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'mygame/lib/sprite_kit/scene.rb', line 12 def tick(args) @args = args @outputs = args.outputs @inputs = args.inputs @state = args.state @audio = args.audio @events = args.events @gtk = args.gtk @mouse = args.inputs.mouse @keyboard = args.inputs.keyboard @top_layer = { w: Grid.w, h: Grid.h, x: 0, y: 0, path: :top_layer, } @draw_buffer.outputs = @outputs input calc render draw end |