Documentation ¶
Overview ¶
Package engine provides an abstraction layer on top of OpenGL. It contains entities relevant for rendering.
Index ¶
- type Window
- func (window *Window) Close()
- func (window *Window) GetFPS() float64
- func (window *Window) GetFPSFormatted() string
- func (window *Window) LockFPS(fps float64)
- func (window *Window) OnCursorPosMove(x, y, dx, dy float64) bool
- func (window *Window) OnKeyPress(key, action, mods int) bool
- func (window *Window) OnMouseButtonPress(leftPressed, rightPressed bool) bool
- func (window *Window) OnMouseScroll(x, y float64) bool
- func (window *Window) OnResize(width, height int) bool
- func (window *Window) RunMainLoop(render func())
- func (window *Window) SetClearColor(r, g, b float32)
- func (window *Window) SetTitle(title string)
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 ¶
New returns a pointer to a Window with the specified window title and window width and height.
func (*Window) GetFPSFormatted ¶
GetFPSFormatted returns the fps as formatted string.
func (*Window) LockFPS ¶
LockFPS provides an upper bound for the FPS. The fps has to be greater than zero.
func (*Window) OnCursorPosMove ¶
OnCursorPosMove is a callback handler that is called every time the cursor moves.
func (*Window) OnKeyPress ¶
OnKeyPress is a callback handler that is called every time a keyboard key is pressed.
func (*Window) OnMouseButtonPress ¶
OnMouseButtonPress is a callback handler that is called every time a mouse button is pressed or released.
func (*Window) OnMouseScroll ¶
OnMouseScroll is a callback handler that is called every time the mouse wheel moves.
func (*Window) OnResize ¶
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 ¶
SetClearColor updates the color used for a new frame and when clearing a FBO.