A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

52 lines
1.3KB

  1. import GlobalEvents from "/app/js/EventCaller.js";
  2. //import EventWindow from "/app/js/ui/EventWindow.js";
  3. import EmitterElements from "/app/js/ui/Emitters.js";
  4. import Modal from "/app/js/ui/Modal.js";
  5. import {NESPainter} from "/app/js/NESPainter.js";
  6. import {NESPalette} from "/app/js/NESPalette.js";
  7. function on_palette_changed(e){
  8. if (e.type == "ALL"){
  9. console.log("ALL");
  10. } else if (e.type == "TILE"){
  11. console.log("TILE Palette:", e.pindex, " | Color:", e.cindex);
  12. } else if (e.type == "SPRITE"){
  13. console.log("SPRITE Palette:", e.pindex, " | Color:", e.cindex);
  14. }
  15. }
  16. function handle_emitted(){
  17. console.log("EMITTED EVENT!");
  18. }
  19. function initialize(DOC){
  20. EmitterElements.initialize();
  21. //EventWindow.enable_emitter_attributes();
  22. GlobalEvents.listen("emitted-event", handle_emitted);
  23. var nespainter = new NESPainter(DOC.getElementById("painter"));
  24. console.log(nespainter.scale);
  25. nespainter.scale_up(5);
  26. console.log(nespainter.scale);
  27. var nespal = new NESPalette();
  28. nespal.listen("palettes_changed", on_palette_changed);
  29. nespal.set_palette([
  30. 44,
  31. 11,12,13,
  32. 54,23,43,
  33. 23,18,11,
  34. 4,8,60,
  35. 63,0,11,
  36. 0,15,14,
  37. 9,0,32,
  38. 5,10,20
  39. ]);
  40. console.log(nespal.to_asm());
  41. }
  42. //console.log(document.getElementByID("painter"));
  43. initialize(document);