A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

69 lines
1.6KB

  1. import Utils from "/app/js/common/Utils.js"
  2. import {EventCaller} from "/app/js/common/EventCaller.js"
  3. export default class ISurface extends EventCaller{
  4. constructor(){
  5. super();
  6. this.__historyLength = 10;
  7. }
  8. get width(){return 0;}
  9. get height(){return 0;}
  10. get length(){return 0;}
  11. get historyLength(){return this.__historyLength;}
  12. get undos(){return 0;}
  13. get redos(){return 0;}
  14. get coloridx(){
  15. return new Proxy(this, {
  16. get: function(obj, prop){
  17. if (prop === "length")
  18. return 0;
  19. if (!Utils.isInt(prop))
  20. throw new TypeError("Expected integer index.");
  21. if (prop < 0)
  22. throw new RangeError("Index is out of bounds.");
  23. return this.getColor(-1,-1);
  24. },
  25. set: function(obj, prop, value){
  26. if (!Utils.isInt(prop))
  27. throw new TypeError("Expected integer index.");
  28. if (prop < 0)
  29. throw new RangeError("Index out of bounds.");
  30. if (!Utils.isInt(value))
  31. throw new TypeError("Color index expected to be an integer.");
  32. if (value < 0 || value >= 4)
  33. throw new RangeError("Color index is out of bounds.");
  34. return true;
  35. }
  36. });
  37. }
  38. copy(b){return this;}
  39. clone(){return new ISurface();}
  40. snapshot(){return this;}
  41. undo(){return this;}
  42. redo(){return this;}
  43. clearUndos(){return this;}
  44. clearRedos(){return this;}
  45. clearHistory(){
  46. return this.clearUndos().clearRedos();
  47. }
  48. getColor(x, y){
  49. return this.__default_pi[4];
  50. }
  51. getColorIndex(x, y){
  52. return {pi:-1, ci:-1};
  53. }
  54. setColorIndex(x, y, ci, pi){
  55. return this;
  56. }
  57. }