Class: ExampleApp::ZifExample

Inherits:
Zif::Game show all
Defined in:
app/zif_example.rb

Overview

Example usage of a Zif::Game subclass

Instance Attribute Summary

Attributes inherited from Zif::Game

#scene, #scene_registry, #services

Attributes included from Zif::Traceable

#tracer_service_name

Instance Method Summary collapse

Methods inherited from Zif::Game

#decorate_exception, #inspect, #perform_tick, #register_scene, #serialize, #standard_tick, #switch_scene, #to_s

Methods included from Zif::Traceable

#mark, #mark_and_print, #mark_prefix, #tracer

Constructor Details

#initializeZifExample

Returns a new instance of ZifExample.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/zif_example.rb', line 4

def initialize
  super()
  @services[:tracer].measure_averages = true
  1.upto 4 do |i|
    @services[:sprite_registry].register_basic_sprite("dragon_#{i}", width: 82, height: 66)
  end
  @services[:sprite_registry].register_basic_sprite(:transparent_gray_32, width: 32, height: 32)
  @services[:sprite_registry].register_basic_sprite(:white_1, width: 64, height: 64)

  register_scene(:ui_sample, UISample)
  register_scene(:load_world, WorldLoader)
  register_scene(:load_double_buffer_render_test, DoubleBufferRenderTest)
  register_scene(:load_compound_sprite_test, CompoundSpriteTest)
  @scene = UISample.new
end