Class: Camera2D
- Inherits:
-
Object
- Object
- Camera2D
- Defined in:
- mrb_doc/models/camera2d.rb
Overview
Camera2D is used for simply moving a viewport around.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#as_in_viewport(vector) ⇒ Vector2
Pass in a vector with world coordinates to see what that translates to in the camera’s viewport.
-
#as_in_world(vector) ⇒ Vector2
Pass in a vector with camera viewport coordinates to see what that translates to in the world.
-
#drawing { ... } ⇒ nil
Draws the world through the lens of the camera.
-
#initialize(offset, target, rotation, zoom) ⇒ Camera2D
constructor
Creates a new instance of Camera2D.
-
#to_h ⇒ Hash
Return the object represented by a Hash.
Constructor Details
Instance Attribute Details
#rotation ⇒ Float
7 8 9 |
# File 'mrb_doc/models/camera2d.rb', line 7 def rotation @rotation end |
#zoom ⇒ Float
7 8 9 |
# File 'mrb_doc/models/camera2d.rb', line 7 def zoom @zoom end |
Instance Method Details
#as_in_viewport(vector) ⇒ Vector2
Pass in a vector with world coordinates to see what that translates to in the camera’s viewport.
69 70 71 72 |
# File 'mrb_doc/models/camera2d.rb', line 69 def (vector) # src/mruby_integration/models/camera2d.cpp Vector2.new end |
#as_in_world(vector) ⇒ Vector2
Pass in a vector with camera viewport coordinates to see what that translates to in the world.
78 79 80 81 |
# File 'mrb_doc/models/camera2d.rb', line 78 def as_in_world(vector) # src/mruby_integration/models/camera2d.cpp Vector2.new end |
#drawing { ... } ⇒ nil
Draws the world through the lens of the camera
60 61 62 63 |
# File 'mrb_doc/models/camera2d.rb', line 60 def drawing(&block) # src/mruby_integration/models/camera2d.cpp nil end |
#to_h ⇒ Hash
Return the object represented by a Hash
47 48 49 50 51 52 53 54 55 |
# File 'mrb_doc/models/camera2d.rb', line 47 def to_h # src/mruby_integration/models/camera2d.cpp { offset: offset.to_h, target: target.to_h, rotation: rotation, zoom: zoom, } end |