Class: Metro::UI::Generic

Inherits:
Model
  • Object
show all
Defined in:
lib/metro/models/ui/generic.rb

Overview

Generic model is used when no model can be found.

The above ‘game_title` actor was likely suppose to be a `metro::ui::label`, but the model was not specified. So this warning would be generated.

Examples:

Defining an actor in a scene without the model


class IntroScene < GameScene

  draw :game_title, text: "Super Game Title", position: Game.center
    color: "rgba(255,255,255,1.0)"

end

Constant Summary

Constants included from Metro::Units

Metro::Units::Bounds

Instance Attribute Summary collapse

Attributes inherited from Model

#scene, #window

Instance Method Summary collapse

Methods inherited from Model

#_load, #_save, #after_initialize, #bounds, #create, #draw_completed?, hierarchy, inherited, #initialize, metro_name, #model, model_name, models, #name, #notification, #saveable_to_view, #to_hash, #update, #update_completed?

Methods included from HasEvents

included

Methods included from KeyValueCoding

#get, #set

Methods included from PropertyOwner

included, #properties

Constructor Details

This class inherits a constructor from Metro::Model

Instance Attribute Details

#warnedObject

Sets whether the generic model has warned the user in the logs about it being a generic model.



24
# File 'lib/metro/models/ui/generic.rb', line 24

property :warned, type: :boolean, default: false

Instance Method Details

#drawObject



30
31
32
33
# File 'lib/metro/models/ui/generic.rb', line 30

def draw
  log.warn cannot_draw_message unless warned
  self.warned = true
end

#showObject



26
27
28
# File 'lib/metro/models/ui/generic.rb', line 26

def show
  self.saveable_to_view = false
end