Documentation ¶
Index ¶
- Constants
- Variables
- type Color
- type Font
- type Region
- type SpriteSheet
- type Surface
- func (s *Surface) Clear(c Color)
- func (s *Surface) Draw(x int, y int)
- func (s *Surface) DrawRegion(x int, y int, r Region)
- func (s *Surface) DrawRegionv(v Vec2, r Region)
- func (s *Surface) Drawv(v Vec2)
- func (s *Surface) GetPixel(x int, y int) Color
- func (s *Surface) GetPixelv(v Vec2) Color
- func (s *Surface) IsInside(x, y int) bool
- func (s *Surface) IsInsidev(v Vec2) bool
- func (s *Surface) Release()
- func (s *Surface) SetPixel(x int, y int, c Color)
- func (s *Surface) SetPixelv(v Vec2, c Color)
- type Texture
- type Vec2
- func (v *Vec2) Abs() Vec2
- func (v *Vec2) ClipInside2(a Vec2, b Vec2)
- func (v *Vec2) Clone() Vec2
- func (v *Vec2) Distance(v2 Vec2) float64
- func (v *Vec2) IsInside(a Vec2) bool
- func (v *Vec2) IsInside2(a Vec2, b Vec2) bool
- func (v *Vec2) Lerp(t float64, target Vec2) Vec2
- func (v *Vec2) Sub(v2 *Vec2) *Vec2
- func (v *Vec2) Subi(i int) *Vec2
- type Vec2f
- type Window
- func (w *Window) Clear(c Color)
- func (w *Window) Destroy()
- func (w *Window) FinalizeFrame()
- func (w *Window) GetCursorPos() Vec2
- func (w *Window) GetDeltaTimeMs() int64
- func (w *Window) GetFPS() float32
- func (w *Window) GetTotalElapsedMs() int64
- func (w *Window) IsInput(inputCode int) bool
- func (w *Window) IsRunning() bool
- func (w *Window) ResetKeyCallback()
- func (w *Window) SetKeyCallback(cbfun glfw.KeyCallback)
- func (w *Window) StartFrame()
- func (w *Window) Stop()
Constants ¶
const ( InputUnknown = -1 KeySpace = 32 KeyApostrophe = 39 /* ' */ KeyComma = 44 /* , */ KeyMinus = 45 /* - */ KeyPeriod = 46 /* . */ KeySlash = 47 /* / */ Key0 = 48 Key1 = 49 Key2 = 50 Key3 = 51 Key4 = 52 Key5 = 53 Key6 = 54 Key7 = 55 Key8 = 56 Key9 = 57 KeySemicolon = 59 /* ; */ KeyEqual = 61 /* = */ KeyA = 65 KeyB = 66 KeyC = 67 KeyD = 68 KeyE = 69 KeyF = 70 KeyG = 71 KeyH = 72 KeyI = 73 KeyJ = 74 KeyK = 75 KeyL = 76 KeyM = 77 KeyN = 78 KeyO = 79 KeyP = 80 KeyQ = 81 KeyR = 82 KeyS = 83 KeyT = 84 KeyU = 85 KeyV = 86 KeyW = 87 KeyX = 88 KeyY = 89 KeyZ = 90 KeyLeftBracket = 91 /* [ */ KeyBackslash = 92 /* \ */ KeyRightBracket = 93 /* ] */ KeyGraveAccent = 96 /* ` */ KeyWorld1 = 161 /* non-US #1 */ KeyWorld2 = 162 /* non-US #2 */ KeyEscape = 256 KeyEnter = 257 KeyTab = 258 KeyBackspace = 259 KeyInsert = 260 KeyDelete = 261 KeyRight = 262 KeyLeft = 263 KeyDown = 264 KeyUp = 265 KeyPageUp = 266 KeyPageDown = 267 KeyHome = 268 KeyEnd = 269 KeyCapsLock = 280 KeyScrollLock = 281 KeyNumLock = 282 KeyPrintScreen = 283 KeyPause = 284 KeyF1 = 290 KeyF2 = 291 KeyF3 = 292 KeyF4 = 293 KeyF5 = 294 KeyF6 = 295 KeyF7 = 296 KeyF8 = 297 KeyF9 = 298 KeyF10 = 299 KeyF11 = 300 KeyF12 = 301 KeyF13 = 302 KeyF14 = 303 KeyF15 = 304 KeyF16 = 305 KeyF17 = 306 KeyF18 = 307 KeyF19 = 308 KeyF20 = 309 KeyF21 = 310 KeyF22 = 311 KeyF23 = 312 KeyF24 = 313 KeyF25 = 314 KeyKp0 = 320 KeyKp1 = 321 KeyKp2 = 322 KeyKp3 = 323 KeyKp4 = 324 KeyKp5 = 325 KeyKp6 = 326 KeyKp7 = 327 KeyKp8 = 328 KeyKp9 = 329 KeyKpDecimal = 330 KeyKpDivide = 331 KeyKpMultiply = 332 KeyKpSubtract = 333 KeyKpAdd = 334 KeyKpEnter = 335 KeyKpEqual = 336 KeyLeftShift = 340 KeyLeftControl = 341 KeyLeftAlt = 342 KeyLeftSuper = 343 KeyRightShift = 344 KeyRightControl = 345 KeyRightAlt = 346 KeyRightSuper = 347 KeyMenu = 348 KeyLast = 348 KeyShift = 401 KeyControl = 402 KeyAlt = 403 KeySuper = 404 MouseButtonLeft = 500 MouseButtonMiddle = 501 MouseButtonRight = 502 )
Keyboard and mouse inputs
Variables ¶
var ColorBlack = Color{R: 0, G: 0, B: 0, A: 255}
ColorBlack is black Color
var ColorOpaque = Color{R: 0, G: 0, B: 0, A: 0}
ColorOpaque is fully transparent color
var ColorWhite = Color{R: 255, G: 255, B: 255, A: 255}
ColorWhite is white Color
Functions ¶
This section is empty.
Types ¶
type Color ¶
Color RGBA byte color
type SpriteSheet ¶
type SpriteSheet struct {
// contains filtered or unexported fields
}
SpriteSheet represents multiple sprites on one image
func NewSpriteSheetFromFile ¶
func NewSpriteSheetFromFile(file string, tileWidth, tileHeight int) (*SpriteSheet, error)
NewSpriteSheetFromFile create sprite sheet from file
func NewSpriteSheetFromSurface ¶ added in v1.1.2
func NewSpriteSheetFromSurface(s *Surface, tileWidth, tileHeight int) (*SpriteSheet, error)
NewSpriteSheetFromSurface create sprite sheet from surface
func (*SpriteSheet) DrawTile ¶
func (s *SpriteSheet) DrawTile(x int, y int, tileX int, tileY int)
DrawTile draw tile
func (*SpriteSheet) SetTileSize ¶
func (s *SpriteSheet) SetTileSize(width int, height int)
SetTileSize set size of one sprite
func (*SpriteSheet) Surface ¶
func (s *SpriteSheet) Surface() *Surface
Surface return surface instance
type Surface ¶
type Surface struct { Width int Height int Scale int Rotation float32 FlipHorizontal bool FlipVertical bool // contains filtered or unexported fields }
Surface represent pixel buffer
func NewSurface ¶
NewSurface create new empty surface
func NewSurfaceFromBytes ¶
NewSurfaceFromBytes create new surface from given input byte array (expecting RGBA format)
func NewSurfaceFromFile ¶
NewSurfaceFromFile create surface from image file
func (*Surface) DrawRegion ¶
DrawRegion draw region of surface on the screen
func (*Surface) DrawRegionv ¶ added in v1.1.2
DrawRegionv draw region of surface on the screen
type Texture ¶
Texture represent OpenGL texture
func NewTextureFromBytes ¶
NewTextureFromBytes creates new texture from given byte array (expected is RGBA format)
type Vec2 ¶ added in v1.1.2
Vec2 2D vector
func (*Vec2) ClipInside2 ¶ added in v1.1.2
ClipInside2 Clip vector into given region
type Window ¶
type Window struct { Width int Height int Fullscreen bool // contains filtered or unexported fields }
Window represents window object
func (*Window) FinalizeFrame ¶
func (w *Window) FinalizeFrame()
FinalizeFrame will swap buffers and poll for events This function needs to be called at the end of the render loop
func (*Window) GetCursorPos ¶
GetCursorPos get mouse cursor position
func (*Window) GetDeltaTimeMs ¶
GetDeltaTimeMs return number of milliseconds elapsed when rendering last frame
func (*Window) GetTotalElapsedMs ¶
GetTotalElapsedMs return number of milliseconds elapsed since application started
func (*Window) ResetKeyCallback ¶ added in v1.1.2
func (w *Window) ResetKeyCallback()
ResetKeyCallback reset back original keyboardcallback
func (*Window) SetKeyCallback ¶ added in v1.1.2
func (w *Window) SetKeyCallback(cbfun glfw.KeyCallback)
SetKeyCallback set custom keyboard callback function
func (*Window) StartFrame ¶
func (w *Window) StartFrame()
StartFrame needs to be at the start of the render loop