Early work on Mapp, will move to Github or Gitlab if something becomes of it.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
507 B

  1. import { fabric } from "fabric";
  2. export default class TileSet {
  3. constructor(opts) {
  4. this.opts = {
  5. tileSize: [32, 32],
  6. tileSep: [0, 0],
  7. hTiles: 2,
  8. vTiles: 2,
  9. src: "/res/tilesets/default.png",
  10. metaTiles: [],
  11. ...opts,
  12. }
  13. }
  14. getTile(index) {
  15. const max = this.opts.hTiles * this.opts.vTiles;
  16. if (index > max) {
  17. return Promise.reject(new Error("index out of bounds."));
  18. }
  19. return new Promise((resolve, reject) => {
  20. });
  21. }
  22. }