Class: Raylib::Camera2D

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/raylib/core/structs/camera2_d.rb

Overview

Camera2D, defines position/orientation in 2d space

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(offset, target, rotation, zoom) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/raylib/core/structs/camera2_d.rb', line 11

def self.create(offset, target, rotation, zoom)
  new.tap do |instance|
    instance[:offset] = offset
    instance[:target] = target
    instance[:rotation] = rotation
    instance[:zoom] = zoom
  end
end

Instance Method Details

#offsetVector2

Camera offset (displacement from target)

Returns:



26
# File 'lib/raylib/core/structs/camera2_d.rb', line 26

def offset = self[:offset]

#offset=(new_offset) ⇒ Object

Sets Camera offset (displacement from target)



29
30
31
# File 'lib/raylib/core/structs/camera2_d.rb', line 29

def offset=(new_offset)
  self[:offset] = new_offset
end

#rotationFloat

Camera rotation in degrees

Returns:

  • (Float)

    rotation



44
# File 'lib/raylib/core/structs/camera2_d.rb', line 44

def rotation = self[:rotation]

#rotation=(new_rotation) ⇒ Object

Sets Camera rotation in degrees



47
48
49
# File 'lib/raylib/core/structs/camera2_d.rb', line 47

def rotation=(new_rotation)
  self[:rotation] = new_rotation
end

#targetVector2

Camera target (rotation and zoom origin)

Returns:



35
# File 'lib/raylib/core/structs/camera2_d.rb', line 35

def target = self[:target]

#target=(new_target) ⇒ Object

Sets Camera target (rotation and zoom origin)



38
39
40
# File 'lib/raylib/core/structs/camera2_d.rb', line 38

def target=(new_target)
  self[:target] = new_target
end

#to_sObject



20
21
22
# File 'lib/raylib/core/structs/camera2_d.rb', line 20

def to_s
  "Raylib::Camera2D##{object_id} offset=#{offset} target=#{target} rotation=#{rotation} zoom=#{zoom}"
end

#zoomFloat

Camera zoom (scaling), should be 1.0f by default

Returns:

  • (Float)

    zoom



53
# File 'lib/raylib/core/structs/camera2_d.rb', line 53

def zoom = self[:zoom]

#zoom=(new_zoom) ⇒ Object

Sets Camera zoom (scaling), should be 1.0f by default



56
57
58
# File 'lib/raylib/core/structs/camera2_d.rb', line 56

def zoom=(new_zoom)
  self[:zoom] = new_zoom
end