Class: Metro::EditTransitionScene
- Inherits:
-
TransitionScene
- Object
- Scene
- TransitionScene
- Metro::EditTransitionScene
- Defined in:
- lib/metro/transitions/edit_transition_scene.rb
Overview
The Edit Transition Scene is place where scenes go to be edited. Any scene can transition into edit mode. This scene will copy all the actors and gain access to the view.
This scene grants new keyboard commands that will enable, disable, and toggle feature of edit mode:
-
‘e` will end edit mode
-
‘g` will toggle the display of the grid
-
‘l` will toggle the display of the model labels
-
‘b` will toggle the bounding boxes around the models.
Constant Summary
Constants included from Units
Instance Attribute Summary
Attributes inherited from TransitionScene
#next_scene, #options, #previous_scene
Attributes inherited from Scene
Instance Method Summary collapse
-
#hitlist ⇒ Object
Generate a hitlist which manages the click start, hold, and release of the mouse button.
-
#initialize ⇒ EditTransitionScene
constructor
A new instance of EditTransitionScene.
- #prepare_transition_from(old_scene) ⇒ Object
- #show ⇒ Object
Methods inherited from TransitionScene
Methods inherited from Scene
#_prepare_transition, #actor, #add_actors_to_scene, #after, after, #after_initialize, after_intervals, #base_draw, #base_update, #draw, #drawers, #enqueue, hierarchy, inherited, metro_name, #notification, #prepare_transition_to, #register_actor, #register_actors!, #register_after_intervals!, #register_animations!, #register_events!, #register_events_for_target, #scene_name, scene_name, scenes, #state, #to_hash, #to_s, #transition_to, #update, #updaters
Methods included from SceneView
included, #save_view, #view, #view_content, #view_name
Methods included from HasAnimations
Methods included from HasEvents
Methods included from Draws
Constructor Details
#initialize ⇒ EditTransitionScene
Returns a new instance of EditTransitionScene.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/metro/transitions/edit_transition_scene.rb', line 20 def initialize # # The EditTransitionScene needs to have all the drawers # cleared from the class because it may still have # drawers from other things that this was executed. # # This is a product of using the classes to store the definitions # of scene. This means we need to change this so that it is much # easier to dup scenes. # self.class.drawings.clear self.class.draw :overlay, model: "metro::ui::grid_drawer" self.class.draw :labeler, model: "metro::ui::model_labeler" add_actors_to_scene after_initialize end |
Instance Method Details
#hitlist ⇒ Object
Generate a hitlist which manages the click start, hold, and release of the mouse button.
77 78 79 |
# File 'lib/metro/transitions/edit_transition_scene.rb', line 77 def hitlist @hitlist ||= HitList.new(drawers) end |
#prepare_transition_from(old_scene) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/metro/transitions/edit_transition_scene.rb', line 37 def prepare_transition_from(old_scene) next_scene.prepare_transition_from(old_scene) @previous_scene = old_scene # Set the view name to the previous scene's view name self.class.view_name old_scene.view_name self.class.view.format = old_scene.class.view.format # import all the actors from the previous scene into the current scene. old_scene.class.actors.each do |scene_actor| self.class.draw scene_actor.name, scene_actor. end add_actors_to_scene end |
#show ⇒ Object
53 54 55 |
# File 'lib/metro/transitions/edit_transition_scene.rb', line 53 def show window.show_cursor end |