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



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

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

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



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

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

Instance Method Details

#add(x, y) ⇒ Object



98
99
100
101
102
# File 'lib/raylib_helper.rb', line 98

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

#add_vector(v) ⇒ Object



104
105
106
107
108
# File 'lib/raylib_helper.rb', line 104

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

#set(x, y) ⇒ Object



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

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

#to_aObject



110
111
112
# File 'lib/raylib_helper.rb', line 110

def to_a
  [x, y]
end

#xObject



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

def x = self[:x]

#x=(v) ⇒ Object



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

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

#yObject



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

def y = self[:y]

#y=(v) ⇒ Object



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

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