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.

NESPainter.js 894B

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. }