A pixel art painter geared specifically at NES pixel art. Includes export for .chr binary file as well as palette and namespace data.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

12345678910111213141516171819202122232425262728293031323334
  1. export class NESPainter {
  2. constructor(canvas){
  3. this.__canvas = null;
  4. this.__context = null;
  5. this.__scale = 1.0; // This is the scale the painter will display source information.
  6. this.__offset = [0.0, 0.0]; // This is the X,Y offset from origin to display source information.
  7. if (!canvas)
  8. throw new Error("Expected a canvas element.");
  9. this.__canvas = canvas;
  10. this.__context = this.__canvas.getContext("2d");
  11. if (!this.__context)
  12. throw new Error("Failed to obtain canvas context.");
  13. }
  14. get scale(){
  15. return this.__scale;
  16. }
  17. set scale(s){
  18. if (typeof(s) !== 'number')
  19. throw new TypeError("Expected number value.");
  20. this.__scale = Math.max(0.1, Math.min(100.0, s));
  21. }
  22. scale_up(amount=1){
  23. this.scale = this.scale + (amount*0.1);
  24. }
  25. scale_down(amount=1){
  26. this.scale = this.scale - (amount*0.1);
  27. }
  28. }