pix

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package pix is implementation of grue based on faiface/pixel

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRect

func GRect(r pixel.Rect) grue.Rect

GRect converts pixel.Rect to grue.Rect.

func GVec

func GVec(v pixel.Vec) grue.Vec

GVec converts pixel.Vec to grue.Vec.

func PRect

func PRect(r grue.Rect) pixel.Rect

PRect converts grue.Rect to pixel.Rect.

func PVec

func PVec(v grue.Vec) pixel.Vec

PVec converts grue.Vec to pixel.Vec.

func RunUI

func RunUI(f func())

RunUI is used to run code on main thread. Put any code that creates grue surfaces in the closure and pass it to this function.

Types

type Surface

type Surface struct {
	Config grue.SurfaceConfig
	Canvas *pixelgl.Canvas
	Window *Window
	Popups []grue.Widget

	Rect grue.Rect
	// contains filtered or unexported fields
}

Surface implements grue.Surface.

func NewPrimarySurface

func NewPrimarySurface(scfg grue.SurfaceConfig) (*Surface, error)

NewPrimarySurface creates new primary surface.

func NewPrimarySurfaceWin

func NewPrimarySurfaceWin(win *pixelgl.Window, scfg grue.SurfaceConfig, fps int) (*Surface, error)

NewPrimarySurfaceWin creates new primary surface with pixel window.

func NewSurface

func NewSurface(surf *Surface, scfg grue.SurfaceConfig) (*Surface, error)

NewSurface creates new surface on top of given surface.

func (*Surface) ClickMousePos

func (s *Surface) ClickMousePos() grue.Vec

ClickMousePos getter.

func (*Surface) DrawFillRect

func (s *Surface) DrawFillRect(r grue.Rect, col color.Color)

DrawFillRect draws filled rectangle.

func (*Surface) DrawImage added in v0.0.2

func (s *Surface) DrawImage(name string, pos grue.Vec, col color.Color)

DrawImage ...

func (*Surface) DrawImageAligned added in v0.0.2

func (s *Surface) DrawImageAligned(name string, rect grue.Rect, al grue.Align, col color.Color)

DrawImageAligned ...

func (*Surface) DrawImageStretched added in v0.0.2

func (s *Surface) DrawImageStretched(name string, rect grue.Rect, col color.Color)

DrawImageStretched ...

func (*Surface) DrawRect

func (s *Surface) DrawRect(r grue.Rect, col color.Color, thick float64)

DrawRect draws rectlangle with given line thickness.

func (*Surface) DrawText

func (s *Surface) DrawText(msg, font string, r grue.Rect, col color.Color, al grue.Align)

DrawText draws text with given color, font and alignment.

func (*Surface) DrawTooltip added in v0.0.2

func (s *Surface) DrawTooltip()

DrawTooltip ...

func (*Surface) GetImage added in v0.0.2

func (s *Surface) GetImage(name string) (*pixel.Sprite, error)

GetImage ...

func (*Surface) GetImageSize added in v0.0.2

func (s *Surface) GetImageSize(name string) (grue.Vec, error)

GetImageSize ...

func (*Surface) GetTextRect added in v0.0.2

func (s *Surface) GetTextRect(msg, font string) grue.Rect

GetTextRect ...

func (*Surface) GetTheme added in v0.0.2

func (s *Surface) GetTheme() *grue.Theme

GetTheme ...

func (*Surface) InitImageSheets added in v0.0.2

func (s *Surface) InitImageSheets(config grue.ImageSheetConfig) error

InitImageSheets ...

func (*Surface) InitImages added in v0.0.2

func (s *Surface) InitImages(configFileName string) error

InitImages ...

func (*Surface) InitTTF added in v0.0.2

func (s *Surface) InitTTF(fontName, fileName string, size float64, charset grue.Charset) error

InitTTF ...

func (*Surface) IsPopUp added in v0.0.2

func (s *Surface) IsPopUp(w grue.Widget) bool

IsPopUp ...

func (*Surface) IsPopUpMode added in v0.0.2

func (s *Surface) IsPopUpMode() bool

IsPopUpMode ...

func (*Surface) JustPressed

func (s *Surface) JustPressed(button grue.Button) bool

JustPressed getter.

func (*Surface) JustReleased

func (s *Surface) JustReleased(button grue.Button) bool

JustReleased getter.

func (*Surface) MousePos

func (s *Surface) MousePos() grue.Vec

MousePos getter.

func (*Surface) MouseScroll

func (s *Surface) MouseScroll() grue.Vec

MouseScroll getter.

func (*Surface) PopDownTo added in v0.0.2

func (s *Surface) PopDownTo(w grue.Widget)

PopDownTo ...

func (*Surface) PopUp added in v0.0.2

func (s *Surface) PopUp(w grue.Widget)

PopUp ...

func (*Surface) PopUpUnder added in v0.0.2

func (s *Surface) PopUpUnder(pos grue.Vec) grue.Widget

PopUpUnder ...

func (*Surface) PrevMousePos

func (s *Surface) PrevMousePos() grue.Vec

PrevMousePos getter.

func (*Surface) Root

func (s *Surface) Root() grue.Widget

Root returns root widget for the surface.

func (*Surface) Run

func (s *Surface) Run()

Run the main loop for the window of surface.

func (*Surface) SetEvents

func (s *Surface) SetEvents(handler func())

SetEvents handler to execute for each window update.

func (*Surface) SetTheme added in v0.0.2

func (s *Surface) SetTheme(theme grue.Theme)

SetTheme ...

func (*Surface) SetToolTip

func (s *Surface) SetToolTip(tooltip string)

SetToolTip ...

type Window

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

Window represents underlying graphical window.

func (*Window) Run

func (w *Window) Run()

Run the main loop.

Jump to

Keyboard shortcuts

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