瀏覽代碼

Bitwise access in NESTile should be fixed. *fingers crossed*

dev-tmpl
Bryan Miller 5 年之前
父節點
當前提交
344ec3bda1
共有 1 個文件被更改,包括 7 次插入3 次删除
  1. +7
    -3
      app/js/models/NESTile.js

+ 7
- 3
app/js/models/NESTile.js 查看文件

@@ -15,8 +15,11 @@ function BitMask(offset){
function SetDataArrayColor(arr, x, y, ci){
var index = (y*8)+x;
var dindex = Math.floor(index*0.25);
var bitoffset = 6 - ((index % 4) * 2);
arr[dindex] = (arr[dindex] & BitMask(bitoffset)) ^ (ci << bitoffset);
var bitoffset = (index % 4);
arr[dindex] = (arr[dindex] & BitMask(bitoffset)) ^ (ci << ((3 - bitoffset)*2));
//if (dindex === 1){
// console.log("index: ", dindex, " | value: ", arr[dindex], " | (x,y): (", x, ",", y, ") | Bit Offset: ", bitoffset, "Color: ", ci);
//}
}


@@ -125,11 +128,12 @@ export default class NESTile{
(flag == 2 || flag == 3) ? 7 - y: y,
ci
);
console.log(newData);
//console.log(newData);
//newData[r[0]] = 2;
//newData[r[0]] = r[1];
}
}
//console.log(newData);
this.__data = newData;
}
return this;

Loading…
取消
儲存