A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

main.js 1.0KB

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