system

package
v0.0.0-...-abed7bd Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2015 License: BSD-3-Clause Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Os

type Os interface {
	// This is properly called after runtime.LockOSThread(), not in an init function
	Startup()

	// Think() is called on a regular basis and always from main thread.
	Think()

	// Create a window with the appropriate dimensions and bind an OpenGl contxt to it.
	// Currently glop only supports a single window, but this function could be called
	// more than once since a window could be destroyed so it can be recreated at different
	// dimensions or in full sreen mode.
	CreateWindow(x, y, width, height int)

	// Gets the cursor position in window coordinates with the cursor at the bottom left
	// corner of the window
	GetCursorPos() (x, y int)

	// Hides/Unhides the cursor.  A hidden cursor is invisible and its position is
	// locked.  It should still generate mouse move events.
	HideCursor(bool)

	GetWindowDims() (x, y, dx, dy int)

	// Swap the OpenGl buffers on this window
	SwapBuffers()

	// Returns a mapping from DeviceType to a slice of all of the DeviceIndexes
	// of active devices of that type.
	GetActiveDevices() map[gin.DeviceType][]gin.DeviceIndex

	// Returns all of the events in the order that they happened since the last call to
	// this function.  The events do not have to be in order according to KeyEvent.Timestamp,
	// but they will be sorted according to this value.  The timestamp returned is the event
	// horizon, no future events will have a timestamp less than or equal to it.
	GetInputEvents() ([]gin.OsEvent, int64)

	EnableVSync(bool)

	// Returns true iff the application currently is in focus.
	HasFocus() bool
}

This is the interface implemented by any operating system that supports glop. The glop/gos package for that OS should export a function called GetSystemInterface() which takes no parameters and returns an object that implements the system.Os interface.

type System

type System interface {
	// Call after runtime.LockOSThread(), *NOT* in an init function
	Startup()

	// Call System.Think() every frame
	Think()

	CreateWindow(x, y, width, height int)

	// Gets the cursor position in window coordinates with the cursor at the bottom left
	// corner of the window
	GetCursorPos() (x, y int)

	// Hides/Unhides the cursor.  A hidden cursor is invisible and its position is
	// locked.  It should still generate mouse move events.
	HideCursor(bool)

	GetWindowDims() (x, y, dx, dy int)

	SwapBuffers()
	GetActiveDevices() map[gin.DeviceType][]gin.DeviceIndex
	GetInputEvents() []gin.EventGroup

	EnableVSync(bool)
}

func Make

func Make(os Os) System

Jump to

Keyboard shortcuts

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