A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

47 行
1.0KB

  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);