Documentation ¶
Index ¶
- Constants
- func BlitBuffer(src, dst Buffer, xpos, ypos int)
- func Fill(dst Buffer, ch rune, fg, bg termbox.Attribute, filltype int)
- func FillArea(dst Buffer, area rect.Rectangle, ch rune, fg, bg termbox.Attribute, ...)
- func GetBufferRow(src Buffer, row int) []termbox.Cell
- func MapValue(val, srcMin, srcMax, dstMin, dstMax int64) int64
- func MapValuef(val, srcMin, srcMax, dstMin, dstMax float64) float64
- type Buffer
- type CountdownTimer
- func (t *CountdownTimer) ForceExpire()
- func (t *CountdownTimer) GetElapsedTime() time.Duration
- func (t *CountdownTimer) GetProgress() float64
- func (t *CountdownTimer) GetReverseProgress() float64
- func (t *CountdownTimer) GetTimeRemaining() time.Duration
- func (t *CountdownTimer) HasExpired() bool
- func (t *CountdownTimer) IsPaused() bool
- func (t *CountdownTimer) Pause()
- func (t *CountdownTimer) Reset(duration time.Duration)
- func (t *CountdownTimer) Unpause()
- type GameCore
- type MemBuffer
- type OnEventFunc
- type OnInitFunc
- type OnTickFunc
- type PhaseMachine
- func (ph *PhaseMachine) Begin()
- func (ph *PhaseMachine) Manual() bool
- func (ph *PhaseMachine) Once() bool
- func (ph *PhaseMachine) Reset()
- func (ph *PhaseMachine) Step()
- func (ph *PhaseMachine) Timed(period time.Duration) bool
- func (ph *PhaseMachine) TimedProgress() float64
- func (ph *PhaseMachine) TimedReverseProgress() float64
- type State
- type StateFunc
- type StateMachine
- type TermboxBufferType
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func BlitBuffer ¶
func GetBufferRow ¶
Types ¶
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
type GameCore ¶
type GameCore struct { OnInit OnInitFunc OnTick OnTickFunc OnEvent OnEventFunc DoQuit bool TickTime time.Duration Ticker *time.Ticker BackBuffer TermboxBufferType }
type MemBuffer ¶
type MemBuffer struct {
// contains filtered or unexported fields
}
func MakeMemBuffer ¶
func (*MemBuffer) CellBuffer ¶
func (b *MemBuffer) CellBuffer() []termbox.Cell
type OnEventFunc ¶
type OnInitFunc ¶
type OnTickFunc ¶
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) TimedProgress ¶
func (ph *PhaseMachine) TimedProgress() float64
func (*PhaseMachine) TimedReverseProgress ¶
func (ph *PhaseMachine) TimedReverseProgress() float64
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)