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

56 行
1.3KB

  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. }
  7. get width(){return 0;}
  8. get height(){return 0;}
  9. get length(){return 0;}
  10. get coloridx(){
  11. return new Proxy(this, {
  12. get: function(obj, prop){
  13. if (prop === "length")
  14. return 0;
  15. if (!Utils.isInt(prop))
  16. throw new TypeError("Expected integer index.");
  17. if (prop < 0)
  18. throw new RangeError("Index is out of bounds.");
  19. return this.getColor(-1,-1);
  20. },
  21. set: function(obj, prop, value){
  22. if (!Utils.isInt(prop))
  23. throw new TypeError("Expected integer index.");
  24. if (prop < 0)
  25. throw new RangeError("Index out of bounds.");
  26. if (!Utils.isInt(value))
  27. throw new TypeError("Color index expected to be an integer.");
  28. if (value < 0 || value >= 4)
  29. throw new RangeError("Color index is out of bounds.");
  30. return true;
  31. }
  32. });
  33. }
  34. copy(b){return this;}
  35. clone(){return new ISurface();}
  36. getColor(x, y){
  37. return this.__default_pi[4];
  38. }
  39. getColorIndex(x, y){
  40. return {pi:-1, ci:-1};
  41. }
  42. setColorIndex(x, y, ci, pi){
  43. return this;
  44. }
  45. }