Browse Source

NESNameTable now stores the NESBank.rp property into a class level object, reducing the amount of time NESBank needs to create a proxy object.

dev
Bryan Miller 5 years ago
parent
commit
86c4b4353d
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      app/js/models/NESNameTable.js

+ 3
- 1
app/js/models/NESNameTable.js View File

@@ -28,6 +28,7 @@ export default class NESNameTable extends ISurface{
constructor(){
super();
this.__bank = null;
this.__bankrp = null;
this.__palette = null;
this.__tiles = [];
this.__attribs = [];
@@ -74,6 +75,7 @@ export default class NESNameTable extends ISurface{
if (b !== null && !(b instanceof NESBank))
throw new TypeError("Expected a NESBank object.");
this.__bank = b;
this.__bankrp = (b !== null) ? this.__bank.rp : null;
this.emit("data_changed");
}

@@ -189,7 +191,7 @@ export default class NESNameTable extends ISurface{
var tileX = Math.floor(x / 8);
var tileY = Math.floor(y / 8);

ci = this.__bank.rp[this.__tiles[(tileY * 32) + tileX]].getPixelIndex(_x, _y);
ci = this.__bankrp[this.__tiles[(tileY * 32) + tileX]].getPixelIndex(_x, _y);
pi = this._PaletteFromCoords(x, y);
}
return {pi:pi, ci:ci};

Loading…
Cancel
Save