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.

47 lines
1.0KB

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