Class: Raylib::Vector2

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

Overview

Vector2, 2 components

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(x, y) ⇒ Object



9
10
11
12
13
14
# File 'lib/raylib/core/structs/vector2.rb', line 9

def self.create(x, y)
  new.tap do |instance|
    instance[:x] = x
    instance[:y] = y
  end
end

Instance Method Details

#to_sObject



16
17
18
# File 'lib/raylib/core/structs/vector2.rb', line 16

def to_s
  "Raylib::Vector2##{object_id} x=#{x} y=#{y}"
end

#xFloat

Vector x component

Returns:

  • (Float)

    x



22
# File 'lib/raylib/core/structs/vector2.rb', line 22

def x = self[:x]

#x=(new_x) ⇒ Object

Sets Vector x component



25
26
27
# File 'lib/raylib/core/structs/vector2.rb', line 25

def x=(new_x)
  self[:x] = new_x
end

#yFloat

Vector y component

Returns:

  • (Float)

    y



31
# File 'lib/raylib/core/structs/vector2.rb', line 31

def y = self[:y]

#y=(new_y) ⇒ Object

Sets Vector y component



34
35
36
# File 'lib/raylib/core/structs/vector2.rb', line 34

def y=(new_y)
  self[:y] = new_y
end