Browse Source

Preparing to handle some IO. Nothing really done yet.

dev-bank
Bryan Miller 6 years ago
parent
commit
01d511f101
3 changed files with 9 additions and 41 deletions
  1. +7
    -0
      app/js/ctrls/CTRLIO.js
  2. +1
    -40
      app/js/main.js
  3. +1
    -1
      views/canvas.html

+ 7
- 0
app/js/ctrls/CTRLIO.js View File

import GlobalEvents from "/app/js/common/EventCaller.js";
import Utils from "/app/js/common/Utils.js";
import NESBank from "/app/js/models/NESBank.js";
import NESPalette from "/app/js/models/NESPalette.js";




+ 1
- 40
app/js/main.js View File

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){
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 handle_emitted(){
console.log("EMITTED EVENT!");
}

function handle_keyevent(e){
console.log(e);
}

function handle_mouseevent(e){
console.log(e);
}

function handle_mouseclickevent(e){
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");
CTRLPainter.initialize(); CTRLPainter.initialize();


var palette = new NESPalette(); var palette = new NESPalette();
// TODO: This is just test code. I should remove this.
//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();
input.preventDefaults = true;
input.mouseTargetElement = document.getElementById("painter");
input.listen("keydown", handle_keyevent);
input.listen("keyup", handle_keyevent);
input.listen("keypress", handle_keyevent);

input.listen("mousemove", handle_mouseevent);
input.listen("mousedown", handle_mouseevent);
input.listen("mouseup", handle_mouseevent);
input.listen("mouseclick", handle_mouseclickevent);*/

// TODO: Drop all of this below test code... or put it in a dedicated test app. // 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();

+ 1
- 1
views/canvas.html View File

<div class="pure-g"> <div class="pure-g">
<div class="pure-u-1 simple-padding">
<div class="pure-u-1 simple-padding drop-zone">
<canvas id="painter" width:"128" height:"256"></canvas> <canvas id="painter" width:"128" height:"256"></canvas>
</div> </div>
</div> </div>

Loading…
Cancel
Save