winl

package
v0.0.0-...-692212b Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HintResizable is hint for window has resize box
	HintResizable hints = C.WINL_HINT_RESIZABLE

	// HintVideo is hint for drawing animated (FPS video) content
	HintVideo hints = C.WINL_HINT_ANIMATE

	// HintPainter is hint for 2D drawing using painter algorithm
	HintPainter hints = C.WINL_HINT_PAINTER

	// Hint3D is hint for 3D drawing
	Hint3D hints = C.WINL_HINT_3D
)

Variables

This section is empty.

Functions

func ConfirmBox

func ConfirmBox(w *Window, msg, title string) bool

ConfirmBox show a simple box ask user to confirm.

func Exit

func Exit(err error)

Exit the event loop

func FactoryRegister

func FactoryRegister()

FactoryRegister register creator in factory for package winl

func MessageBox

func MessageBox(w *Window, msg, title string)

MessageBox show a simple message box

func OSVersion

func OSVersion() (s string)

OSVersion return the version of operating system

func Run

func Run(onStart func() error, onExit func(err error))

Run the main event loop

func ScreenSize

func ScreenSize() (width, height int)

ScreenSize return size of main screen

Types

type IWindow

type IWindow interface {
	// Class name for factory
	Class() string
	// Create the window, width and height can be zero.
	Create(width, height int) error
	// Destroy the window
	Destroy()
	// Expose triggle expose event
	Expose(x, y, width, height float32)
	// Init the object
	Init()
	// IsFullScreen determine if window is full screen
	IsFullScreen() bool
	// IsVisible determine if window is visible
	IsVisible() bool
	// MakeCurrent set current OpenGL to this window
	MakeCurrent() bool
	// OnCreate event handler
	OnCreate()
	// OnDestroy event handler
	OnDestroy()
	// OnExpose event handler
	OnExpose(x, y, width, height float32)
	// OnMouseEnter event handler
	OnMouseEnter(x, y float32)
	// OnMouseLeave event handler
	OnMouseLeave(x, y float32)
	// OnMouseMove event handler
	OnMouseMove(x, y float32)
	// OnMousePress event handler
	OnMousePress(btn int, x, y float32)
	// OnMouseRelease event handler
	OnMouseRelease(btn int, x, y float32)
	// OnMouseWheel event handler
	OnMouseWheel(vert bool, dz float32)
	// OnResize event handler
	OnResize(width, height float32)
	// Present copy OpenGL content from back buffer to front buffer, make it visible
	Present()
	// SetHints set hints for window style
	SetHints(hints hints)
	// SetTitle set the window title
	SetTitle(title string)
	// Show the window
	Show()
	// Size reports size of window's client area
	Size() (width, height float32)
	// ToggleFullScreen switch between full screen mode and normal mode
	ToggleFullScreen()
}

IWindow is interface of class Window

type Window

type Window struct {
	Self IWindow
	// contains filtered or unexported fields
}

Window class wrap operating systems's window object.

func List

func List() (ret []*Window)

List of all windows

func NewWindow

func NewWindow() *Window

NewWindow create and init new Window object.

func (*Window) Class

func (p *Window) Class() string

Class name for factory

func (*Window) Create

func (w *Window) Create(width, height int) error

Create the window, width and height can be zero.

func (*Window) Destroy

func (w *Window) Destroy()

Destroy the window

func (*Window) Expose

func (w *Window) Expose(x, y, width, height float32)

Expose triggle expose event

func (*Window) Init

func (w *Window) Init()

Init the object

func (*Window) IsFullScreen

func (w *Window) IsFullScreen() bool

IsFullScreen determine if window is full screen

func (*Window) IsVisible

func (w *Window) IsVisible() bool

IsVisible determine if window is visible

func (*Window) MakeCurrent

func (w *Window) MakeCurrent() bool

MakeCurrent set current OpenGL to this window

func (*Window) OnCreate

func (w *Window) OnCreate()

OnCreate event handler

func (*Window) OnDestroy

func (w *Window) OnDestroy()

OnDestroy event handler

func (*Window) OnExpose

func (w *Window) OnExpose(x, y, width, height float32)

OnExpose event handler

func (*Window) OnMouseEnter

func (w *Window) OnMouseEnter(x, y float32)

OnMouseEnter event handler

func (*Window) OnMouseLeave

func (w *Window) OnMouseLeave(x, y float32)

OnMouseLeave event handler

func (*Window) OnMouseMove

func (w *Window) OnMouseMove(x, y float32)

OnMouseMove event handler

func (*Window) OnMousePress

func (w *Window) OnMousePress(btn int, x, y float32)

OnMousePress event handler

func (*Window) OnMouseRelease

func (w *Window) OnMouseRelease(btn int, x, y float32)

OnMouseRelease event handler

func (*Window) OnMouseWheel

func (w *Window) OnMouseWheel(vert bool, dz float32)

OnMouseWheel event handler

func (*Window) OnResize

func (w *Window) OnResize(width, height float32)

OnResize event handler

func (*Window) Present

func (w *Window) Present()

Present copy OpenGL content from back buffer to front buffer, make it visible

func (*Window) SetHints

func (w *Window) SetHints(hints hints)

SetHints set hints for window style

func (*Window) SetTitle

func (w *Window) SetTitle(title string)

SetTitle set the window title

func (*Window) Show

func (w *Window) Show()

Show the window

func (*Window) Size

func (w *Window) Size() (width, height float32)

Size reports size of window's client area

func (*Window) ToggleFullScreen

func (w *Window) ToggleFullScreen()

ToggleFullScreen switch between full screen mode and normal mode

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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