system

package
v0.0.0-...-e1cee33 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockSystem

type MockSystem struct {
	System
	// contains filtered or unexported fields
}

func MakeMocked

func MakeMocked(realOs Os) *MockSystem

func (*MockSystem) AdvanceTimeMillis

func (ms *MockSystem) AdvanceTimeMillis(delta uint64)

type NativeWindowHandle

type NativeWindowHandle interface{}

type Os

type Os interface {
	// Returns a timestamp like Think() or GetInputEvents().
	Startup() int64

	// Think() is called on a regular basis and always from main thread. Returns
	// the an event horizon; a timestamp that can be compared with
	// GetInputEvent's timestamps.
	Think() int64

	// Create a window with the appropriate dimensions and bind an OpenGl context
	// to it. Call after runtime.LockOSThread(), *NOT* in an init function.
	CreateWindow(x, y, width, height int) NativeWindowHandle

	// 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)
	SetWindowSize(width, height int)

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

	// 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)
}

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

type System

type System interface {
	Startup()

	// Call System.Think() every frame. Returns the 'horizon'.
	Think() int64

	// Call after runtime.LockOSThread(), *NOT* in an init function.
	CreateWindow(x, y, width, height int) NativeWindowHandle

	// 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)
	SetWindowSize(width, height int)

	SwapBuffers()
	GetInputEvents() []gin.EventGroup

	EnableVSync(bool)

	// Attach a gin.Listener to the underlying input delegate.
	AddInputListener(gin.Listener)
}

func Make

func Make(os Os, input *gin.Input) System

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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