gowindow

package module
v0.0.0-...-9d0f1fe Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2016 License: Apache-2.0 Imports: 13 Imported by: 0

README

go-window

A multi-platform library for easy access to window and input in Go/Golang

Installation

  • On OS X, you need Xcode or Command Line Tools for Xcode (xcode-select --install) for required headers and libraries.

  • On Ubuntu/Debian-like Linux distributions, you need libgl1-mesa-dev and xorg-dev packages.

  • See here for full details.

  • Go 1.4+ is required on Windows (otherwise you must use MinGW v4.8.1 exactly, see Go issue 8811).

go get -u github.com/freiny/go-window

Usage

See go-window-app

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlankImage

func BlankImage() *image.RGBA

BlankImage returns a blank RGBA image

func GetFPS

func GetFPS() func()

GetFPS fps counter in closure usage: fps := GetFPS()

RenderLoop() {
  fps()
}

func GetTime

func GetTime() int64

GetTime returns current time in nano seconds

func SetFrameToggle

func SetFrameToggle() bool

SetFrameToggle alternates between returning true and false each frame

Types

type Action

type Action int

Action replaces glfw.Action

type Callbacks

type Callbacks struct {
	Render     func() *image.RGBA
	CursorMove func(c Cursor)
	Key        func(w *Window, k Key, scancode int, a Action, mk ModifierKey)
	FPS        func(fps int)
}

Callbacks holds the callbacks defined in the User Application ran in the library

type Cursor

type Cursor struct {
	X float64
	Y float64
}

Cursor for storing the current cursor position

type Debugger

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

Debugger general purpose logging and profiling

func (Debugger) Init

func (d Debugger) Init() Debugger

Init set debugger runnng on start up

func (*Debugger) Log

func (d *Debugger) Log(i ...interface{})

Log prints to terminal

func (*Debugger) Logging

func (d *Debugger) Logging() bool

Logging checks if logging is on

func (*Debugger) Profiling

func (d *Debugger) Profiling() bool

Profiling checks if profiling is on

func (*Debugger) Running

func (d *Debugger) Running() bool

Running checks if debugger is on

type Framework

type Framework struct {
	*glfw.Window
	// contains filtered or unexported fields
}

Framework object

func Config

func Config(x int, y int, w int, h int) Framework

Config stores window x,y position and width,height for when framework is started

func (*Framework) BuildMode

func (f *Framework) BuildMode(mode ...string) string

BuildMode sets Production or Development build

func (Framework) ClearImage

func (f Framework) ClearImage(rgba *image.RGBA, c color.RGBA) *image.RGBA

ClearImage clears input image.RGBA to specified color

func (Framework) GetImagePart

func (f Framework) GetImagePart(filename string, point image.Point) *image.RGBA

GetImagePart returns an RGBA pointer from a partial .png file

func (Framework) LoadImage

func (f Framework) LoadImage(filename string) *image.RGBA

LoadImage returns an RGBA pointer from a .png file

func (Framework) RandomImage

func (f Framework) RandomImage(p image.Point) *image.RGBA

RandomImage clears input image.RGBA to specified color

func (*Framework) RegisterCallback

func (f *Framework) RegisterCallback(cbHandler interface{})

RegisterCallback allows setting user defined callbacks

func (*Framework) ResourcePath

func (f *Framework) ResourcePath() string

ResourcePath gets path where resources are stored

func (*Framework) Start

func (f *Framework) Start()

Start initializes OpenGL/GLFW then runs a render callback on each iteration func Init(wc WinConfig, cbUserDefined Callbacks) {

type GLConfig

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

GLConfig variables needed to persist to renderGL()

type Key

type Key int

Key replaces glfw.Key

type ModifierKey

type ModifierKey int

ModifierKey replaces glfw.ModifierKey

type WinConfig

type WinConfig struct {
	W int
	H int
	X int
	Y int
}

WinConfig holds global data (e.g. window dimensions, cursor location)

type Window

type Window struct {
	glfw.Window
}

Window wraps glfw.Window

Jump to

Keyboard shortcuts

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