module RbSDL2::Window::Position
Public Instance Methods
position()
click to toggle source
# File lib/rb_sdl2/window/position.rb, line 4 def position x_y = Array.new(2) { ::FFI::MemoryPointer.new(:int) } ::SDL2.SDL_GetWindowPosition(self, *x_y) x_y.map(&:read_int) end
position=(x_y)
click to toggle source
# File lib/rb_sdl2/window/position.rb, line 10 def position=(x_y) wx, wy = x_y wx ||= ::SDL2::SDL_WINDOWPOS_CENTERED_MASK wy ||= ::SDL2::SDL_WINDOWPOS_CENTERED_MASK ::SDL2.SDL_SetWindowPosition(self, wx, wy) end
x()
click to toggle source
# File lib/rb_sdl2/window/position.rb, line 17 def x ptr = ::FFI::MemoryPointer.new(:int) ::SDL2.SDL_GetWindowPosition(self, ptr, nil) ptr.read_int end
x=(num)
click to toggle source
# File lib/rb_sdl2/window/position.rb, line 23 def x=(num) self.position = [num, y] end
y()
click to toggle source
# File lib/rb_sdl2/window/position.rb, line 27 def y ptr = ::FFI::MemoryPointer.new(:int) ::SDL2.SDL_GetWindowPosition(self, nil, ptr) ptr.read_int end
y=(num)
click to toggle source
# File lib/rb_sdl2/window/position.rb, line 33 def y=(num) self.position = [x, num] end