Class: Raylib::Vector2

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/raylib_main.rb,
lib/raylib_helper.rb

Overview

Vector2, 2 components

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.copy_from(vec) ⇒ Object



72
73
74
# File 'lib/raylib_helper.rb', line 72

def self.copy_from(vec)
  Vector2.create(vec[:x], vec[:y])
end

.create(x = 0, y = 0) ⇒ Object



68
69
70
# File 'lib/raylib_helper.rb', line 68

def self.create(x = 0, y = 0)
  Vector2.new.set(x, y)
end

Instance Method Details

#add(x, y) ⇒ Object



82
83
84
85
86
# File 'lib/raylib_helper.rb', line 82

def add(x, y)
  self[:x] = self[:x] + x
  self[:y] = self[:y] + y
  self
end

#add_vector(v) ⇒ Object



88
89
90
91
92
# File 'lib/raylib_helper.rb', line 88

def add_vector(v)
  self[:x] = self[:x] + v[:x]
  self[:y] = self[:y] + v[:y]
  self
end

#set(x, y) ⇒ Object



76
77
78
79
80
# File 'lib/raylib_helper.rb', line 76

def set(x, y)
  self[:x] = x
  self[:y] = y
  self
end

#to_aObject



94
95
96
# File 'lib/raylib_helper.rb', line 94

def to_a
  [x, y]
end

#xObject



421
# File 'lib/raylib_main.rb', line 421

def x = self[:x]

#x=(v) ⇒ Object



422
# File 'lib/raylib_main.rb', line 422

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

#yObject



423
# File 'lib/raylib_main.rb', line 423

def y = self[:y]

#y=(v) ⇒ Object



424
# File 'lib/raylib_main.rb', line 424

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