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.

54 lines
1.2KB

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