TileViewer Quick Reference

Canvas-based tile map viewer and renderer

Key Features Server-Side Usage: // Get the TileViewer API var TileViewer = js.getObject("/OpenForum/AddOn/TileViewer","TileViewer.sjs"); // Save tile map data TileViewer.saveTileMap("/MyPage", "map.json", mapData); // Load tile map var map = TileViewer.loadTileMap("/MyPage", "map.json"); // Save tile set TileViewer.saveTileSet("/MyPage", "tileset.json", tileSetData); Client-Side Usage: // Load tile map JSON.get('/OpenForum/AddOn/TileViewer/LoadMap', null, 'pageName=/MyPage&fileName=map.json') .onSuccess(function(mapData) { console.log('Map loaded:', mapData); renderMap(mapData); }).go(); // Save tile map JSON.post('/OpenForum/AddOn/TileViewer/SaveMap', null, 'pageName=/MyPage&fileName=map.json&data=' JSON.stringify(mapData)) .onSuccess(function(result) { console.log('Map saved'); }).go(); Map Data Format { width: 20, height: 15, tileSize: 32, layers: [ { name: "ground", tiles: [[1,1,2,3...], [1,2,3,4...], ...] } ], tileset: "tileset.png" } Configuration