A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

Emitters.js 981B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import GlobalEvents from "/app/js/EventCaller.js";
  2. function handle_emitter(event){
  3. var el = event.target;
  4. if (el){
  5. if (el.hasAttribute("emit")){
  6. var args = [el.getAttribute("emit")];
  7. if (el.hasAttribute("emit-args")){
  8. try {
  9. var j = JSON.parse(el.getAttribute("emit-args"));
  10. if (j instanceof Array){
  11. args.concat(j);
  12. } else {
  13. args.push(j);
  14. }
  15. } catch (e) {
  16. console.log("Failed to emit '" + args[0] + "'. Attribute 'emit-args' contains malformed JSON.");
  17. }
  18. }
  19. GlobalEvents.emit.apply(GlobalEvents, args);
  20. }
  21. }
  22. }
  23. export default {
  24. initialize: function(){
  25. var elist = document.querySelectorAll("[emit]");
  26. elist.forEach(function(el){
  27. el.addEventListener("click", handle_emitter);
  28. });
  29. },
  30. initialize_element: function(el){
  31. if (el.hasAttribute("emit")){
  32. el.addEventListener("click", handle_emitter);
  33. }
  34. }
  35. }