A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

Emitters.js 1005B

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