window

package
v0.0.0-...-23eb0d9 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package engine provides an abstraction layer on top of OpenGL. It contains entities relevant for rendering.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Window

type Window struct {
	Window *glfw.Window
	Width  int
	Height int
	// contains filtered or unexported fields
}

Window takes care of window creation and interaction.

func New

func New(title string, width, height int) (*Window, error)

New returns a pointer to a Window with the specified window title and window width and height.

func (*Window) Close

func (window *Window) Close()

Close cleans up the Window.

func (*Window) GetFPS

func (window *Window) GetFPS() float64

GetFPS returns the fps of the previous frame.

func (*Window) GetFPSFormatted

func (window *Window) GetFPSFormatted() string

GetFPSFormatted returns the fps as formatted string.

func (*Window) LockFPS

func (window *Window) LockFPS(fps float64)

LockFPS provides an upper bound for the FPS. The fps has to be greater than zero.

func (*Window) OnCursorPosMove

func (window *Window) OnCursorPosMove(x, y, dx, dy float64) bool

OnCursorPosMove is a callback handler that is called every time the cursor moves.

func (*Window) OnKeyPress

func (window *Window) OnKeyPress(key, action, mods int) bool

OnKeyPress is a callback handler that is called every time a keyboard key is pressed.

func (*Window) OnMouseButtonPress

func (window *Window) OnMouseButtonPress(leftPressed, rightPressed bool) bool

OnMouseButtonPress is a callback handler that is called every time a mouse button is pressed or released.

func (*Window) OnMouseScroll

func (window *Window) OnMouseScroll(x, y float64) bool

OnMouseScroll is a callback handler that is called every time the mouse wheel moves.

func (*Window) OnResize

func (window *Window) OnResize(width, height int) bool

OnResize is a callback handler that is called every time the window is resized.

func (*Window) RunMainLoop

func (window *Window) RunMainLoop(render func())

RunMainLoop calls the specified render function each frame until the window is being closed.

func (*Window) SetClearColor

func (window *Window) SetClearColor(r, g, b float32)

SetClearColor updates the color used for a new frame and when clearing a FBO.

func (*Window) SetTitle

func (window *Window) SetTitle(title string)

SetTitle updates the window title.

Jump to

Keyboard shortcuts

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