I get intense flickering.
This should probably done only a few times per second.
I am not sure flickering occurs though.
On 02/01/2013 04:24 PM, Pier-Luc Plante wrote:
> Signed-off-by: Pier-Luc Plante <pie...@ul...>
> ---
> client/Screen.js | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/client/Screen.js b/client/Screen.js
> index 97bd068..119cdf7 100644
> --- a/client/Screen.js
> +++ b/client/Screen.js
> @@ -583,6 +583,9 @@ Screen.prototype.iterate=function(){
> }
>
> this.performZoomOperations();
> + if(!this.checkScreenSize()){
> + this.performScreenSizeChange();
> + }
>
> var end=this.getMilliseconds();
> this.gameMilliseconds+=(end-start);
> @@ -591,6 +594,23 @@ Screen.prototype.iterate=function(){
> this.globalGameFrameNumber++;
> }
>
> +Screen.prototype.checkScreenSize=function(){
> + return(this.width==window.innerWidth && this.height==window.innerHeight &&
> + this.canvas.width==this.width && this.canvas.heidth==this.height &&
> + this.renderingCanvas.width==this.width && this.renderingCanvas.height==this.height);
> +}
This method name is not really informative.
> +
> +Screen.prototype.performScreenSizeChange=function(){
> + var availableWidth=window.innerWidth;
> + var availableHeight=window.innerHeight;
> + this.width=availableWidth;
> + this.height=availableHeight;
> + this.canvas.width=this.width;
> + this.canvas.height=this.height;
> + this.renderingCanvas.width=this.width;
> + this.renderingCanvas.height=this.height;
> +}
> +
> Screen.prototype.getMilliseconds=function(){
> return new Date()*1;
> }
>
|