Rate limit to 60FPS

This commit is contained in:
giongto35 2019-04-10 02:21:20 +08:00
parent f772add831
commit e459b4c28c

View file

@ -23,6 +23,8 @@ type Director struct {
roomID string
}
const FPS = 60
func NewDirector(roomID string, imageChannel chan *image.RGBA, inputChannel chan int) *Director {
// func NewDirector(audio *Audio, imageChannel chan *image.RGBA, inputChannel chan int) *Director {
director := Director{}
@ -61,7 +63,8 @@ func (d *Director) Start(paths []string) {
}
func (d *Director) Run() {
for {
c := time.Tick(time.Second / FPS)
for range c {
// quit game
// TODO: Check if noone using