37 lines
527 B
Go
37 lines
527 B
Go
package gamelog
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
var Log = &GameLog{RedrawLogs: true}
|
|
|
|
type GameLog struct {
|
|
Messages []Message
|
|
MaxHeight int
|
|
RedrawLogs bool
|
|
}
|
|
|
|
type Message struct {
|
|
GameTS uint64
|
|
RealTS time.Time
|
|
Message string
|
|
}
|
|
|
|
func (gl *GameLog) GetMaxHeight() int {
|
|
return gl.MaxHeight
|
|
}
|
|
|
|
func (gl *GameLog) SetMaxHeight(i int) {
|
|
gl.MaxHeight = i
|
|
}
|
|
|
|
func (gl *GameLog) Msg(msg string) {
|
|
gl.Messages = append(gl.Messages, Message{
|
|
GameTS: 0, //fixme
|
|
RealTS: time.Now(),
|
|
Message: msg,
|
|
})
|
|
gl.RedrawLogs = true
|
|
}
|