Fix frame counters to int64 (#337)

This commit is contained in:
Hajime Hoshi 2017-04-06 00:45:28 +09:00
parent ebedb24e43
commit b0454b874e
2 changed files with 4 additions and 4 deletions

View File

@ -190,8 +190,8 @@ type Context struct {
players *players players *players
driver *driver.Player driver *driver.Player
sampleRate int sampleRate int
frames int frames int64
writtenBytes int writtenBytes int64
} }
var ( var (
@ -247,7 +247,7 @@ func (c *Context) Update() error {
} }
c.frames++ c.frames++
bytesPerFrame := c.sampleRate * bytesPerSample * channelNum / ebiten.FPS bytesPerFrame := c.sampleRate * bytesPerSample * channelNum / ebiten.FPS
l := (c.frames * bytesPerFrame) - c.writtenBytes l := (c.frames * int64(bytesPerFrame)) - c.writtenBytes
l &= mask l &= mask
c.writtenBytes += l c.writtenBytes += l
buf := make([]byte, l) buf := make([]byte, l)

View File

@ -32,7 +32,7 @@ type runContext struct {
fps int fps int
currentFPS float64 currentFPS float64
runningSlowly bool runningSlowly bool
frames int frames int64
lastUpdated int64 lastUpdated int64
lastFPSUpdated int64 lastFPSUpdated int64
m sync.RWMutex m sync.RWMutex