window

package
v0.0.0-...-d322e89 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2018 License: BSD-2-Clause Imports: 3 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Events = struct {
	Resize  func()
	Hide    func()
	Show    func()
	Focus   func()
	Unfocus func()
	Quit    func()
}{
	Resize:  func() {},
	Hide:    func() {},
	Show:    func() {},
	Focus:   func() {},
	Unfocus: func() {},
	Quit:    func() { internal.QuitRequested = true },
}

Events holds the callbacks for each window events.

These callbacks can be modified at anytime, but should always contain valid functions (i.e., non nil). The change will take effect at the next frame.

Functions

func HasFocus

func HasFocus() bool

HasFocus returns true if the game windows has focus.

func HasMouseFocus

func HasMouseFocus() bool

HasMouseFocus returns true if the mouse is currently inside the game window.

Types

type XY

type XY struct {
	X, Y int16
}

XY represents the coordinates of a pixel on the window.

func RoundXYof

func RoundXYof(v coord.Coordinates) XY

RoundXYof returns an integer vector corresponding to the first two coordinates of v.

func Size

func Size() XY

Size returns the size of the window in (screen) pixels.

func XYof

func XYof(v coord.Coordinates) XY

XYof returns an integer vector corresponding to the first two coordinates of v.

func (XY) Cartesian

func (a XY) Cartesian() (x, y, z float32)

Cartesian returns the coordinates of the vector in 3D space. X and Y are casted to float32, and the third coordinate is always 0.

func (XY) Coord

func (a XY) Coord() coord.XY

Coord returns the floating point coordinates of the vector.

func (XY) FlipX

func (a XY) FlipX() XY

FlipX returns the vector with the sign of X flipped.

func (XY) FlipY

func (a XY) FlipY() XY

FlipY returns the vector with the sign of Y flipped.

func (XY) Minus

func (a XY) Minus(b XY) XY

Minus returns the difference with another vector.

func (XY) MinusS

func (a XY) MinusS(s int16) XY

MinusS returns the difference with the vector (s, s).

func (XY) Mod

func (a XY) Mod(s int16) XY

Mod returns the remainder (modulus) of the division by a scalar (which must be non-zero).

func (XY) ModXY

func (a XY) ModXY(b XY) XY

ModXY returns the remainder (modulus) of the component-wise division by another vector (of which both X and Y must be non-zero).

func (XY) Null

func (a XY) Null() bool

Null returns true if both coordinates are null.

func (XY) Opposite

func (a XY) Opposite() XY

Opposite returns the opposite of the vector.

func (XY) Perp

func (a XY) Perp() XY

Perp returns the vector rotated by 90 in counter-clockwise direction.

func (XY) Plus

func (a XY) Plus(b XY) XY

Plus returns the sum with another vector.

func (XY) PlusS

func (a XY) PlusS(s int16) XY

PlusS returns the sum with the vector (s, s).

func (XY) ProjX

func (a XY) ProjX() XY

ProjX returns the vector projected on the X axis (i.e. with Y nulled).

func (XY) ProjY

func (a XY) ProjY() XY

ProjY returns the vector projected on the Y axis (i.e. with X nulled).

func (XY) Slash

func (a XY) Slash(s int16) XY

Slash returns the integer quotient of the division by a scalar (which must be non-zero).

func (XY) SlashXY

func (a XY) SlashXY(b XY) XY

SlashXY returns the integer quotients of the component-wise division by another vector (of which both X and Y must be non-zero).

func (XY) Times

func (a XY) Times(s int16) XY

Times returns the product with a scalar.

func (XY) TimesXY

func (a XY) TimesXY(b XY) XY

TimesXY returns the component-wise product with another vector.

func (XY) YX

func (a XY) YX() XY

YX returns the vector with coordinates X and Y swapped.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL