gkdl

package module
v0.0.0-...-1a843a0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2015 License: Zlib Imports: 6 Imported by: 0

README

           Easily create a window and OpenGL context (in Go)
===============================================================================
This project is not stable and may change drastically in the future (including
its name). Nor is this project thoroughly tested, use at your own risk.

That being said, it seems to be functional on Windows and Linux(X11).

To use:
* Create a Context (A window + OpenGL context) using CreateContext(...)
* Close a Context through the Context's method KillWindow()

Make sure to check that Context didn't return an error. Once a Context is
created, you can use whatever OpenGL binding you want to make OpenGL calls.

Events are sent through your Context's Event channel. Check out events.go for
the different kinds of events. Make sure to deal with them regularly. An example
on how to go through all queued events is as follows:

// c is your context
for len(c.Events) > 0 {
	e := <-c.Events
	switch t := e.(type) {
	case gkdl.KeyDown:
		
		...
		
	}
}

You can swap buffers using c.SwapBuffers()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetVersion

func GetVersion() (major int, minor int)

func SupportExtension

func SupportExtension(ext string) bool

Types

type Context

type Context struct {
	Events <-chan Event
	// contains filtered or unexported fields
}

func CreateContext

func CreateContext(name string, width, height uint32, majorVersion, minorVersion int32) (*Context, error)

func (Context) KillWindow

func (c Context) KillWindow() error

func (Context) SwapBuffers

func (c Context) SwapBuffers()

type Event

type Event interface {
}

type KeyDown

type KeyDown struct {
	Scancode byte
	Keycode  byte
}

type KeyUp

type KeyUp struct {
	Scancode byte
	Keycode  byte
}

type MouseButtonDown

type MouseButtonDown struct {
	Button MouseButtons // Which button was pressed
	// contains filtered or unexported fields
}

type MouseButtonUp

type MouseButtonUp struct {
	Button MouseButtons // Which button was released
	// contains filtered or unexported fields
}

type MouseButtons

type MouseButtons struct {
	L  bool // left
	R  bool // right
	M  bool // middle
	X1 bool // X1
	X2 bool // X2
}

type MouseMotion

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

type MouseWheel

type MouseWheel struct {
	WheelDelta int
	// contains filtered or unexported fields
}

type Quit

type Quit struct {
}

Jump to

Keyboard shortcuts

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