Class: Raylib::Vector2

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

Overview

Math helper

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.copy_from(vec) ⇒ Object



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

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

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



65
66
67
# File 'lib/raylib_helper.rb', line 65

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

Instance Method Details

#add(x, y) ⇒ Object



79
80
81
82
83
# File 'lib/raylib_helper.rb', line 79

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

#add_vector(v) ⇒ Object



85
86
87
88
89
# File 'lib/raylib_helper.rb', line 85

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

#set(x, y) ⇒ Object



73
74
75
76
77
# File 'lib/raylib_helper.rb', line 73

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

#to_aObject



91
92
93
# File 'lib/raylib_helper.rb', line 91

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