simpleui

package module
v0.0.0-...-525291a Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 19 Imported by: 0

README

import "github.com/mebusy/simpleui"

type View interface {
	Enter()
	Exit()
	Update(t, dt float64)
}

type CustomViewIF interface {
	View
	OnKey(glfw.Key)
	TextureBuff() []uint8
    Title() string
}

simpleui.Run( your_custom_view )

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FONT_SIZE int = 16 / font_scale

Functions

func DrawCenteredText

func DrawCenteredText(dst draw.Image, dx, dy int, text string, c color.Color)

func DrawCharacter

func DrawCharacter(dst draw.Image, x, y int, ch byte, c color.Color)

func DrawText

func DrawText(dst draw.Image, x, y int, text string, c color.Color)

func GetCursorPosInWindow

func GetCursorPosInWindow(window *glfw.Window) (float64, float64)

func GetWindow

func GetWindow() *glfw.Window

func HashFile

func HashFile(path string) (string, error)

func HomeDir

func HomeDir() string

func IsMouseKeyHold

func IsMouseKeyHold(window *glfw.Window, button glfw.MouseButton) bool

glfw.MouseButtonLeft glfw.MouseButtonRight glfw.MouseButtonMiddle

func ReadKey

func ReadKey(window *glfw.Window, key glfw.Key) bool

func Run

func Run(customView CustomViewIF)

func Screenshot

func Screenshot(directory string, im image.Image)

func SetWindow

func SetWindow(_width, _height, _scale int)

func WordWrap

func WordWrap(text string, maxLength int) []string

Types

type Audio

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

func GetAudio

func GetAudio() *Audio

func NewAudio

func NewAudio() *Audio

func (*Audio) Callback

func (a *Audio) Callback(out []float32)

`Callback` invoked in a separate fixed goroutine

func (*Audio) GetAudioChannel

func (a *Audio) GetAudioChannel() chan float32

func (*Audio) GetSampleRate

func (a *Audio) GetSampleRate() float64

func (*Audio) Start

func (a *Audio) Start() error

func (*Audio) Stop

func (a *Audio) Stop() error

type CustomViewIF

type CustomViewIF interface {
	View
	OnKey(glfw.Key)
	TextureBuff() []uint8
	Title() string
}

type Director

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

func NewDirector

func NewDirector(window *glfw.Window, audio *Audio) *Director

func (*Director) PlayGame

func (d *Director) PlayGame(customView CustomViewIF)

func (*Director) Run

func (d *Director) Run()

func (*Director) SetTitle

func (d *Director) SetTitle(title string)

func (*Director) SetView

func (d *Director) SetView(view View)

func (*Director) Start

func (d *Director) Start(customView CustomViewIF)

func (*Director) Step

func (d *Director) Step()

type GameView

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

func (*GameView) Enter

func (view *GameView) Enter()

func (*GameView) Exit

func (view *GameView) Exit()

func (*GameView) Update

func (view *GameView) Update(t, dt float64)

type View

type View interface {
	Enter()
	Exit()
	Update(t, dt float64)
}

func NewGameView

func NewGameView(director *Director, customView CustomViewIF) View

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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