struct Godot::Vector2i

Overview

2-element structure that can be used to represent 2D grid coordinates or discrete positions with 32-bit integers.

Defined in:

libgodot/types/vector2.cr

Constant Summary

DOWN = Vector2i.new(0, 1)
LEFT = Vector2i.new(-1, 0)
ONE = Vector2i.new(1, 1)
RIGHT = Vector2i.new(1, 0)
UP = Vector2i.new(0, -1)
ZERO = Vector2i.new(0, 0)

Constructors

Instance Method Summary

Constructor Detail

def self.new(x : Int32 = 0, y : Int32 = 0) #

def self.new(x : Number, y : Number) #

def self.new(pointer : Pointer(Void)) #

Instance Method Detail

def !=(other : Vector2i) : Bool #

def *(scalar : Number) : Vector2i #

def *(other : Vector2i) : Vector2i #

def +(other : Vector2i) : Vector2i #

def -(other : Vector2i) : Vector2i #

def - : Vector2i #

def /(scalar : Number) : Vector2i #

def /(other : Vector2i) : Vector2i #

def ==(other : Vector2i) : Bool #

def abs : Vector2i #

def clamp(min : Vector2i, max : Vector2i) : Vector2i #

def distance_manhattan_to(other : Vector2i) : Int32 #

Manhattan (taxicab) distance to other integer position.


def max(other : Vector2i) : Vector2i #

def min(other : Vector2i) : Vector2i #

def sign : Vector2i #

def to_s(io : IO) : Void #
Description copied from struct Struct

Same as #inspect(io).


def to_v2 : Vector2 #

def x : Int32 #

def x=(x : Int32) #

def y : Int32 #

def y=(y : Int32) #