浏览代码

CTRLPainter initialization called. Slowly commenting out some test code.

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

+ 9
- 7
app/js/main.js 查看文件

import NESTile from "/app/js/models/NESTile.js"; import NESTile from "/app/js/models/NESTile.js";
import NESBank from "/app/js/models/NESBank.js"; import NESBank from "/app/js/models/NESBank.js";


function on_palette_changed(e){
/*function on_palette_changed(e){
if (e.type == "ALL"){ if (e.type == "ALL"){
console.log("ALL"); console.log("ALL");
} else if (e.type == "TILE"){ } else if (e.type == "TILE"){


function handle_mouseclickevent(e){ function handle_mouseclickevent(e){
console.log("MOUSE CLICK ON BUTTON: ", e.button); console.log("MOUSE CLICK ON BUTTON: ", e.button);
}
}*/


function TitlePainter(pal){ function TitlePainter(pal){
var elist = document.querySelectorAll(".color-NES-random"); var elist = document.querySelectorAll(".color-NES-random");
function initialize(DOC){ function initialize(DOC){
TitlePainter(NESPalette.SystemColor); TitlePainter(NESPalette.SystemColor);
EmitterElements.initialize(); EmitterElements.initialize();
//EventWindow.enable_emitter_attributes();
GlobalEvents.listen("emitted-event", handle_emitted);
//GlobalEvents.listen("emitted-event", handle_emitted);


//var nespainter = new NESPainter(DOC.getElementById("painter")); //var nespainter = new NESPainter(DOC.getElementById("painter"));
CTRLPainter.initialize();


var palette = new NESPalette(); var palette = new NESPalette();
// TODO: This is just test code. I should remove this. // TODO: This is just test code. I should remove this.
palette.listen("palettes_changed", on_palette_changed);
//palette.listen("palettes_changed", on_palette_changed);
// TODO: At least define a more useful set of palettes. As it is, these are just random. // TODO: At least define a more useful set of palettes. As it is, these are just random.
palette.set_palette([ palette.set_palette([
44, 44,
console.log(palette.to_asm()); console.log(palette.to_asm());
GlobalEvents.emit("set_app_palette", palette); GlobalEvents.emit("set_app_palette", palette);


var input = new Input();
/*var input = new Input();
input.preventDefaults = true; input.preventDefaults = true;
input.mouseTargetElement = document.getElementById("painter"); input.mouseTargetElement = document.getElementById("painter");
input.listen("keydown", handle_keyevent); input.listen("keydown", handle_keyevent);
input.listen("mousemove", handle_mouseevent); input.listen("mousemove", handle_mouseevent);
input.listen("mousedown", handle_mouseevent); input.listen("mousedown", handle_mouseevent);
input.listen("mouseup", handle_mouseevent); input.listen("mouseup", handle_mouseevent);
input.listen("mouseclick", handle_mouseclickevent);
input.listen("mouseclick", handle_mouseclickevent);*/


// TODO: Drop all of this below test code... or put it in a dedicated test app.
var TileA = new NESTile(); var TileA = new NESTile();
var TileB = new NESTile(); var TileB = new NESTile();
TileB.setPixelIndex(0,0,2); TileB.setPixelIndex(0,0,2);

正在加载...
取消
保存