Help us shape the future of Go! Take the 2026 Go Developer Survey

haloob

package module
v0.0.0-...-709244c Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: MIT Imports: 3 Imported by: 31

README

Package haloob

haloob is an Out Of Box (oob) implementation of the hal interface for Bellina.

HAL stands for the Hardware Abstraction Layer

It uses the g5 package for its graphics implementation.

Through an object that implements the hal interface, Bellina can interact with the OS window and be aware of window resize, mouse, and keyboard events.

hal is how Bellina creates an initial window with a given dimension and title.

Installation

go get -u github.com/amortaza/go-hal-oob

usage

In your application, call bl.Start(...) to start Bellina. bl.Start(...) requires a hal interface implementation.

haloob.NewHal() provides an object that implements the hal interface.

See example/haloob-example.go for a complete application

NOTE: haloob's implementation uses GLFW, which requires runtime.LockOSThread() in init()

import "github.com/amortaza/go-bellina"
import "github.com/amortaza/go-hal-oob"

func init() {
	runtime.LockOSThread()
}

func main() {
    hal := hal_g5.NewHal()()
    bl.Start(hal, 800, 600, "Title", onInit, onTick, onUninit))
}

func onInit() {
    // Initialize my app
}

func onTick() {
    // Update app state
}

func onUninit() {
    // Free memory in my app
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graphics

type Graphics struct {
}

func (*Graphics) Clear

func (graphics *Graphics) Clear(r, g, b float32)

func (*Graphics) NewCanvas

func (graphics *Graphics) NewCanvas(width, height int) hal.Canvas

func (*Graphics) PopView

func (graphics *Graphics) PopView()

func (*Graphics) PushView

func (graphics *Graphics) PushView(width, height int)

type Hal

type Hal struct {
	// contains filtered or unexported fields
}

func NewHal

func NewHal() *Hal

func (*Hal) GetGraphics

func (hal *Hal) GetGraphics() hal.Graphics

func (*Hal) GetMousePos

func (hal *Hal) GetMousePos() (x, y int)

func (*Hal) GetWindowDim

func (hal *Hal) GetWindowDim() (width, height int)

func (*Hal) SetMouseCursor

func (hal *Hal) SetMouseCursor(cursor hal.MouseCursor)

func (*Hal) Start

func (hal *Hal) Start(
	title string,

	left, top, width, height int,

	onAfterGL,
	onLoop,
	onBeforeDeleteWindow func(),

	onWindowResize,

	onMouseMove func(int, int),
	onMouseButton func(hal.MouseButton, hal.ButtonAction),

	onKey func(key hal.KeyboardKey, action hal.ButtonAction, alt, ctrl, shift bool))

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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