native

package
v0.0.0-...-b05aa3b Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HintWindowResizable = 1 << iota
	HintWindowFullScreen
)
View Source
const (
	MouseBtnLeft = 1 << iota
	MouseBtnRight
	MouseBtnMiddle
)
View Source
const (
	Dispatched    = 0
	RequestToQuit = 1
	QueueEmpty    = 2
)

Variables

View Source
var (
	ErrGeneric = errors.New("generic error")

	KeepRunningWithoutWindow bool
)

Functions

func DispatchEvent

func DispatchEvent() int

func Exit

func Exit(code int)

func GetCursorPos

func GetCursorPos(wnd uintptr) (x, y float32, err error)

func GetScreenSize

func GetScreenSize(id int) (width, height float32, err error)

func IsMainThread

func IsMainThread() bool

IsMainThread reports whether current thread is the main thread

func Loop

func Loop(quit <-chan interface{}) (ret interface{})

func MainThreadAsync

func MainThreadAsync(result *chan error, fn func() error)

func MainThreadCall

func MainThreadCall(fn func() error) error

func NumWindows

func NumWindows() int

func Running

func Running() bool

func Yield

func Yield()

Types

type IHandler

type IHandler interface {
	OnCreate()
	OnRequestClose() bool
	OnDestroy()
	OnActivate(active bool)
	OnAppear(visible bool)
	OnResize(width, height float32)
	OnMouseMove(x, y float32)
	OnMousePress(btn int, x, y float32)
	OnMouseRelease(btn int, x, y float32)
	OnMouseWheel(axis int, delta, x, y float32) // up is positive
	OnMouseEnter(x, y float32)
	OnMouseLeave(x, y float32)
	OnExpose(x, y, width, height float32)
}

IHandler is a complete Handler interface, for document purpose.

type SysSpecial

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

type Window

type Window struct {
	WindowHandle

	Handler interface{}

	SysSpecial
	// contains filtered or unexported fields
}

Window represent a native window, it wraps a HWND on Windows, XCB visual or XLib Window on Linux, NSView on MacOS.

func (*Window) Close

func (win *Window) Close() (err error)

func (*Window) ExposeRect

func (win *Window) ExposeRect(x, y, width, height float32)

func (*Window) Init

func (win *Window) Init(o *WindowOptions) (err error)

func (*Window) SetTitle

func (win *Window) SetTitle(text string)

func (*Window) SetVisible

func (win *Window) SetVisible(visible bool)

func (*Window) Size

func (win *Window) Size() (float32, float32)

type WindowHandle

type WindowHandle struct {
	ID  uintptr
	Ctx uintptr
}

type WindowOptions

type WindowOptions struct {
	Hints         uint64
	Width, Height float32
}

Jump to

Keyboard shortcuts

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