A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 line
1.6KB

  1. import Utils from "/app/js/common/Utils.js";
  2. import GlobalEvents from "/app/js/common/EventCaller.js";
  3. import EmitterElements from "/app/js/ui/Emitters.js";
  4. import Input from "/app/js/ui/Input.js";
  5. import Modal from "/app/js/ui/Modal.js";
  6. import Tabs from "/app/js/ui/Tabs.js";
  7. import CTRLPalettes from "/app/js/ctrls/CTRLPalettes.js";
  8. import CTRLPainter from "/app/js/ctrls/CTRLPainter.js";
  9. import CTRLBankTools from "/app/js/ctrls/CTRLBankTools.js";
  10. import CTRLNametableTools from "/app/js/ctrls/CTRLNametableTools.js";
  11. import CTRLIO from "/app/js/ctrls/CTRLIO.js";
  12. import NESPalette from "/app/js/models/NESPalette.js";
  13. function TitlePainter(pal){
  14. var elist = document.querySelectorAll(".color-NES-random");
  15. if (elist){
  16. elist.forEach(function(el){
  17. var ca = Math.floor(Math.random() * 11) + 1;
  18. var cb = Math.floor(Math.random() * 3);
  19. var index = (cb*16)+ca;
  20. el.style.color = pal[index];
  21. //el.style["background-color"] = "#000";
  22. });
  23. }
  24. }
  25. function initialize(DOC){
  26. // UI and View only controllers
  27. TitlePainter(NESPalette.SystemColor);
  28. EmitterElements.initialize();
  29. Tabs.initialize();
  30. // Controllers explicitly interface model data to view.
  31. CTRLPainter.initialize();
  32. CTRLBankTools.initialize();
  33. CTRLNametableTools.initialize();
  34. CTRLIO.initialize();
  35. var cover = document.querySelector(".cover");
  36. Utils.addListenerToEvents(
  37. cover,
  38. [
  39. "webkitAnimationEnd",
  40. "oanimationend",
  41. "oAnimationEnd",
  42. "msAnimationEnd",
  43. "animationend"
  44. ],
  45. function(){
  46. this.parentNode.removeChild(this);
  47. });
  48. if (cover){
  49. cover.classList.add("coverFadeout");
  50. }
  51. }
  52. initialize(document);