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个字符

53 行
1.2KB

  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 handle_emitted(){
  17. console.log("EMITTED EVENT!");
  18. }
  19. function initialize(DOC){
  20. EventWindow.listen("onclick", on_click);
  21. EventWindow.enable_emitter_attributes();
  22. EventWindow.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);