Browse Source

Fixed broken code in CTRLPalette. Reworked a but of main

dev-tmpl
Bryan Miller 6 years ago
parent
commit
5590cd01ea
2 changed files with 11 additions and 13 deletions
  1. +9
    -11
      app/js/main.js
  2. +2
    -2
      app/js/ui/CTRLPalettes.js

+ 9
- 11
app/js/main.js View File

import GlobalEvents from "/app/js/EventCaller.js"; import GlobalEvents from "/app/js/EventCaller.js";
//import EventWindow from "/app/js/ui/EventWindow.js";
import EmitterElements from "/app/js/ui/Emitters.js"; import EmitterElements from "/app/js/ui/Emitters.js";
import Modal from "/app/js/ui/Modal.js"; import Modal from "/app/js/ui/Modal.js";
import CTRLPalettes from "/app/js/ui/CTRLPalettes.js"; import CTRLPalettes from "/app/js/ui/CTRLPalettes.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){ function on_palette_changed(e){
//EventWindow.enable_emitter_attributes(); //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"));


console.log(nespainter.scale);
nespainter.scale_up(5);
console.log(nespainter.scale);

CTRLPalettes.palette = new NESPalette();
CTRLPalettes.palette.listen("palettes_changed", on_palette_changed);
CTRLPalettes.palette.set_palette([
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.
palette.set_palette([
44, 44,
11,12,13, 11,12,13,
54,23,43, 54,23,43,
9,0,32, 9,0,32,
5,10,20 5,10,20
]); ]);
console.log(CTRLPalettes.palette.to_asm());
console.log(palette.to_asm());
GlobalEvents.emit("set_app_palette", palette);
} }





+ 2
- 2
app/js/ui/CTRLPalettes.js View File

// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
// Setting some hooks to watch for some global events. // Setting some hooks to watch for some global events.
// ------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------
var handle_set_app_palette(p){
var handle_set_app_palette = function(p){
if (p instanceof NESPalette){ if (p instanceof NESPalette){
self.palette = p; self.palette = p;
} }
} }
GlobalEvents.listen("set_app_palette", handle_syspalette_changed);
GlobalEvents.listen("set_app_palette", handle_set_app_palette);
} }


get palette(){ get palette(){

Loading…
Cancel
Save