mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-26 17:30:52 +01:00
Update FPS
This commit is contained in:
parent
2b1e75b06f
commit
7c1e81f1d1
@ -354,10 +354,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
const frame = Math.round(this._totalTimeRunning / (60 / this._animationFPS));
|
||||
|
||||
let updateVisuals = false;
|
||||
|
||||
if(frame !== this._lastFrame)
|
||||
{
|
||||
this._lastFrame = frame;
|
||||
|
||||
updateVisuals = true;
|
||||
}
|
||||
|
||||
let spriteCount = 0;
|
||||
|
||||
const objects = this._container.objects;
|
||||
@ -368,7 +373,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
if(!object) continue;
|
||||
|
||||
spriteCount = (spriteCount + this.renderObject(object, object.instanceId.toString(), time, update, spriteCount));
|
||||
spriteCount = (spriteCount + this.renderObject(object, object.instanceId.toString(), time, update, updateVisuals, spriteCount));
|
||||
}
|
||||
}
|
||||
|
||||
@ -394,9 +399,8 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
}
|
||||
|
||||
this.cleanSprites(spriteCount);
|
||||
}
|
||||
|
||||
if(update) this._canvasUpdated = true;
|
||||
if(update || updateVisuals) this._canvasUpdated = true;
|
||||
|
||||
this._renderTimestamp = this._totalTimeRunning;
|
||||
this._renderedWidth = this._width;
|
||||
@ -430,7 +434,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this._objectCache.removeObjectCache(identifier);
|
||||
}
|
||||
|
||||
private renderObject(object: IRoomObject, identifier: string, time: number, update: boolean, count: number): number
|
||||
private renderObject(object: IRoomObject, identifier: string, time: number, update: boolean, updateVisuals: boolean, count: number): number
|
||||
{
|
||||
if(!object) return 0;
|
||||
|
||||
@ -458,7 +462,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
return 0;
|
||||
}
|
||||
|
||||
visualization.update(this._geometry, time, (!sortableCache.isEmpty || update), (this._skipObjectUpdate && this._runningSlow));
|
||||
if(updateVisuals) visualization.update(this._geometry, time, (!sortableCache.isEmpty || update), (this._skipObjectUpdate && this._runningSlow));
|
||||
|
||||
if(locationCache.locationChanged) update = true;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user