浏览代码

Added test for the EventCalled as part of NESPalette

dev-tmpl
Bryan Miller 6 年前
父节点
当前提交
ae381dca08
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. +11
    -0
      app/js/main.js

+ 11
- 0
app/js/main.js 查看文件

import {NESPainter} from "/app/js/NESPainter.js"; import {NESPainter} from "/app/js/NESPainter.js";
import {NESPalette} from "/app/js/NESPalette.js"; import {NESPalette} from "/app/js/NESPalette.js";


function on_palette_changed(e){
if (e.type == "ALL"){
console.log("ALL");
} else if (e.type == "TILE"){
console.log("TILE Palette:", e.pindex, " | Color:", e.cindex);
} else if (e.type == "SPRITE"){
console.log("SPRITE Palette:", e.pindex, " | Color:", e.cindex);
}
}

function initialize(DOC){ function initialize(DOC){
var nespainter = new NESPainter(DOC.getElementById("painter")); var nespainter = new NESPainter(DOC.getElementById("painter"));
//if (!canvas){ //if (!canvas){
console.log(nespainter.scale); console.log(nespainter.scale);


var nespal = new NESPalette(); var nespal = new NESPalette();
nespal.listen("palettes_changed", on_palette_changed);
nespal.set_palette([ nespal.set_palette([
44, 44,
11,12,13, 11,12,13,

正在加载...
取消
保存