Dirty Rectangles

QICI Engine supports dirty rectangles management for canvas rendering, helping to avoid mobile device overheating and improve rendering performance.

Enable Dirty Rectangles

There are two ways to enable the dirty rectangles management function:

  • In Project Settings check "Dirty Rectangles"
  • Use code dynamically
    this.game.dirtyRectangle.enable = true;
    

Show Dirty Rectangles

There are three ways to show dirty rectangles at runtime:

  • In Project Settings check "Show Dirty Rectangles"
  • Use code dynamically
    game.dirtyRectangle.showDirtyRegion = true;
    
  • Enable paint flashing from Google Chrome browser's debugging feature

Force Redraw All

In some case you need to update the whole game screen, then you can use the code as below to force redraw all for the next frame.

this.game.dirtyRectangle.forceDirty = true;