index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/index.js b/src/index.js index bc4f138..b16e00b 100644 --- a/src/index.js +++ b/src/index.js @@ -1,5 +1,5 @@ -import PanZoom from './modules/panzoom.js'; -import Game from './modules/game.js'; +import * as panzoom from './modules/panzoom.js'; +import * as game from './modules/game.js'; const RecordSheet = { unSelect: function () { @@ -40,19 +40,18 @@ document.querySelector('object').addEventListener('load', function () { }); window.addEventListener('load', () => { - const svg = document.querySelector('object').contentDocument.querySelector('svg'), - game = Game(svg); + const svg = document.querySelector('object').contentDocument.querySelector('svg'); - window.game = game; + game.start(svg); + panzoom.start(svg); const svgns = "http://www.w3.org/2000/svg", recordSheetVisibility = document.querySelector('#content input[type="checkbox"].visible'); - PanZoom(svg); const distanceOutput = document.getElementById('status'); - game.distanceCallback = count => { + game.setDistanceCallback(count => { const output = { count: '-', display: 'none' @@ -65,12 +64,12 @@ window.addEventListener('load', () => { distanceOutput.querySelector('#hex-count').textContent = output.count; distanceOutput.style.display = output.display; - }; + }); const proneToggle = document.getElementById('toggle-prone-counter'); - game.proneFlagCallback = checked => proneToggle.checked = checked; - game.selectCallback = data => RecordSheet.select(data); + game.setProneFlagCallback(checked => proneToggle.checked = checked); + game.setSelectCallback(data => RecordSheet.select(data)); // Object.values(settingsPanel.querySelectorAll('fieldset')).forEach(fieldset => { // const identityMtx = [1, 0, 0, 1, 0, 0]; |