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 | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/index.js b/src/index.js index fa99fec..40ee397 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,6 @@ -import * as panzoom from './modules/panzoom.js'; -import * as game from './modules/game.js'; -import * as recordSheet from './modules/recordSheet.js'; +import * as panzoom from './modules/pan-zoom.js'; +import * as gameboard from './modules/gameboard.js'; +import * as recordSheet from './modules/record_sheet.js'; globalThis.svgns = "http://www.w3.org/2000/svg"; @@ -16,7 +16,7 @@ document.querySelector('object').addEventListener('load', function () { document .querySelector('#content input[type="checkbox"].visible') .addEventListener('input', function () { - let divs = document.querySelectorAll('#content div'); + const divs = document.querySelectorAll('#content div'); divs.forEach(d => { if (this.checked) { @@ -30,32 +30,32 @@ document window.addEventListener('load', () => { const svg = document.querySelector('object').contentDocument.querySelector('svg'); - game.start(svg); + gameboard.start(svg); panzoom.start(svg); - game.setDistanceCallback((count = '-') => { + gameboard.setDistanceCallback((count = '-') => { distanceOutput.querySelector('#hex-count').textContent = count; distanceOutput.style.display = count === '-' ? 'none' : 'block'; }); - game.setProneFlagCallback(checked => proneToggle.checked = checked); - game.setSelectCallback(data => recordSheet.select(data)); + gameboard.setProneFlagCallback(checked => proneToggle.checked = checked); + gameboard.setSelectCallback(data => recordSheet.select(data)); document.querySelectorAll('.soldier-record').forEach(el => el.addEventListener('click', () => { if (el.classList.contains('selected')) { el.classList.remove('selected'); - game.unSelect(); + gameboard.unSelect(); recordSheet.unSelect(); } else { - game.select(el); + gameboard.select(el); } }) ); document.querySelectorAll('.end-move').forEach(el => el.addEventListener('click', () => { recordSheet.endMove(); - game.endMove(); + gameboard.endMove(); })); document.querySelectorAll('.end-turn').forEach(el => @@ -82,23 +82,23 @@ window.addEventListener('load', () => { .sort((el1, el2) => el1.dataset.number > el2.dataset.number) .forEach(el => el.classList.remove('movement-ended')); - game.endTurn(allegiance); - game.select(records.at(0)); + gameboard.endTurn(allegiance); + gameboard.select(records.at(0)); }) ); document.querySelectorAll('.set-firing-arc').forEach(el => - el.addEventListener('click', game.setFiringArc) + el.addEventListener('click', gameboard.setFiringArc) ); - document.querySelector('.set-grenade').addEventListener('click', game.setGrenade); + document.querySelector('.set-grenade').addEventListener('click', gameboard.setGrenade); document.querySelectorAll('#toggle-firing-arc-vis input').forEach(el => - el.addEventListener('input', game.toggleFiringArcVisibility) + el.addEventListener('input', gameboard.toggleFiringArcVisibility) ); document.getElementById('toggle-prone-counter').addEventListener('input', function () { const selected = recordSheet.getSelected(); - selected && game.toggleProne(); + selected && gameboard.toggleProne(); }); }); |