glib

package
v0.0.0-...-d0b0c69 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHAR    = 1
	FG      = 2
	BG      = 4
	ALL     = CHAR | FG | BG
	ATTRIBS = FG | BG
)

Variables

This section is empty.

Functions

func BlitBuffer

func BlitBuffer(src, dst Buffer, xpos, ypos int)

func Fill

func Fill(dst Buffer, ch rune, fg, bg termbox.Attribute, filltype int)

func FillArea

func FillArea(dst Buffer, area rect.Rectangle, ch rune, fg, bg termbox.Attribute, filltype int)

func GetBufferRow

func GetBufferRow(src Buffer, row int) []termbox.Cell

func MapValue

func MapValue(val, srcMin, srcMax, dstMin, dstMax int64) int64

func MapValuef

func MapValuef(val, srcMin, srcMax, dstMin, dstMax float64) float64

Types

type Buffer

type Buffer interface {
	SetCell(x, y int, ch rune, fg, bg termbox.Attribute)
	GetCell(x, y int) (rune, termbox.Attribute, termbox.Attribute)
	Size() (int, int)
	CellBuffer() []termbox.Cell
}

type CountdownTimer

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

func MakeCountdownTimer

func MakeCountdownTimer(duration time.Duration) CountdownTimer

func (*CountdownTimer) ForceExpire

func (t *CountdownTimer) ForceExpire()

ForceExpire makes the timer expire before its duration

func (*CountdownTimer) GetElapsedTime

func (t *CountdownTimer) GetElapsedTime() time.Duration

GetElapsedTime returns the elapsed time since the time started (taking into account pause status)

func (*CountdownTimer) GetProgress

func (t *CountdownTimer) GetProgress() float64

GetProgress returns how far along the duration the timer has gone (from 0.0 -> 1.0)

func (*CountdownTimer) GetReverseProgress

func (t *CountdownTimer) GetReverseProgress() float64

GetReverseProgress returns how far along the duration the timer has gone (from 1.0 -> 0.0) in reverse

func (*CountdownTimer) GetTimeRemaining

func (t *CountdownTimer) GetTimeRemaining() time.Duration

GetTimeRemaining returns how much time is remaining until the timer expires

func (*CountdownTimer) HasExpired

func (t *CountdownTimer) HasExpired() bool

HasExpired returns true if the timer has expired

func (*CountdownTimer) IsPaused

func (t *CountdownTimer) IsPaused() bool

IsPaused returns true if timer is paused

func (*CountdownTimer) Pause

func (t *CountdownTimer) Pause()

Pause pauses the Countdown timer. call UnPause to resume or Reset to start timer again.

func (*CountdownTimer) Reset

func (t *CountdownTimer) Reset(duration time.Duration)

Reset resets the timer with new duration. Can be called any time irrespective of the Expried Status of the timer

func (*CountdownTimer) Unpause

func (t *CountdownTimer) Unpause()

Unpause resumes the countdown

type GameCore

type GameCore struct {
	OnInit     OnInitFunc
	OnTick     OnTickFunc
	OnEvent    OnEventFunc
	DoQuit     bool
	TickTime   time.Duration
	Ticker     *time.Ticker
	BackBuffer TermboxBufferType
}

func (*GameCore) Run

func (gc *GameCore) Run() error

type MemBuffer

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

func MakeMemBuffer

func MakeMemBuffer(w, h int) *MemBuffer

func (*MemBuffer) CellBuffer

func (b *MemBuffer) CellBuffer() []termbox.Cell

func (*MemBuffer) GetCell

func (b *MemBuffer) GetCell(x, y int) (rune, termbox.Attribute, termbox.Attribute)

func (*MemBuffer) SetCell

func (b *MemBuffer) SetCell(x, y int, ch rune, fg, bg termbox.Attribute)

func (*MemBuffer) Size

func (b *MemBuffer) Size() (int, int)

type OnEventFunc

type OnEventFunc func(gc *GameCore, ev *termbox.Event) error

type OnInitFunc

type OnInitFunc func(gc *GameCore) error

type OnTickFunc

type OnTickFunc func(gc *GameCore) error

type PhaseMachine

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

func (*PhaseMachine) Begin

func (ph *PhaseMachine) Begin()

func (*PhaseMachine) Manual

func (ph *PhaseMachine) Manual() bool

func (*PhaseMachine) Once

func (ph *PhaseMachine) Once() bool

func (*PhaseMachine) Reset

func (ph *PhaseMachine) Reset()

func (*PhaseMachine) Step

func (ph *PhaseMachine) Step()

func (*PhaseMachine) Timed

func (ph *PhaseMachine) Timed(period time.Duration) bool

func (*PhaseMachine) TimedProgress

func (ph *PhaseMachine) TimedProgress() float64

func (*PhaseMachine) TimedReverseProgress

func (ph *PhaseMachine) TimedReverseProgress() float64

type State

type State struct {
	Enter  StateFunc
	Action StateFunc
	Exit   StateFunc
	// contains filtered or unexported fields
}

type StateFunc

type StateFunc func(sm *StateMachine)

type StateMachine

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

func (*StateMachine) AddState

func (sm *StateMachine) AddState(id int, si State)

func (*StateMachine) CurrentId

func (sm *StateMachine) CurrentId() (int, bool)

func (*StateMachine) DoAction

func (sm *StateMachine) DoAction()

func (*StateMachine) Gosub

func (sm *StateMachine) Gosub(id int)

func (*StateMachine) Goto

func (sm *StateMachine) Goto(id int)

func (*StateMachine) Return

func (sm *StateMachine) Return()

type TermboxBufferType

type TermboxBufferType struct {
}
var TermboxBuffer TermboxBufferType

func (TermboxBufferType) CellBuffer

func (b TermboxBufferType) CellBuffer() []termbox.Cell

func (TermboxBufferType) GetCell

func (b TermboxBufferType) GetCell(x, y int) (rune, termbox.Attribute, termbox.Attribute)

func (TermboxBufferType) SetCell

func (b TermboxBufferType) SetCell(x, y int, ch rune, fg, bg termbox.Attribute)

func (TermboxBufferType) Size

func (b TermboxBufferType) Size() (int, int)

Jump to

Keyboard shortcuts

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