|
|
@ -1,6 +1,6 @@ |
|
|
|
const { mk } = require('../utils') |
|
|
|
const { mk } = require('../utils') |
|
|
|
|
|
|
|
|
|
|
|
module.exports = function attachDebugScreen (screen) { |
|
|
|
module.exports = function attachDebugger (screen, connection) { |
|
|
|
const debugCanvas = mk('canvas') |
|
|
|
const debugCanvas = mk('canvas') |
|
|
|
const ctx = debugCanvas.getContext('2d') |
|
|
|
const ctx = debugCanvas.getContext('2d') |
|
|
|
|
|
|
|
|
|
|
@ -215,17 +215,34 @@ module.exports = function attachDebugScreen (screen) { |
|
|
|
const toolbar = mk('div') |
|
|
|
const toolbar = mk('div') |
|
|
|
toolbar.classList.add('debug-toolbar') |
|
|
|
toolbar.classList.add('debug-toolbar') |
|
|
|
let toolbarAttached = false |
|
|
|
let toolbarAttached = false |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const heartbeat = mk('div') |
|
|
|
|
|
|
|
heartbeat.classList.add('heartbeat') |
|
|
|
|
|
|
|
heartbeat.textContent = '❤' |
|
|
|
|
|
|
|
toolbar.appendChild(heartbeat) |
|
|
|
|
|
|
|
|
|
|
|
const dataDisplay = mk('div') |
|
|
|
const dataDisplay = mk('div') |
|
|
|
dataDisplay.classList.add('data-display') |
|
|
|
dataDisplay.classList.add('data-display') |
|
|
|
toolbar.appendChild(dataDisplay) |
|
|
|
toolbar.appendChild(dataDisplay) |
|
|
|
|
|
|
|
|
|
|
|
const internalDisplay = mk('div') |
|
|
|
const internalDisplay = mk('div') |
|
|
|
internalDisplay.classList.add('internal-display') |
|
|
|
internalDisplay.classList.add('internal-display') |
|
|
|
toolbar.appendChild(internalDisplay) |
|
|
|
toolbar.appendChild(internalDisplay) |
|
|
|
|
|
|
|
|
|
|
|
toolbar.appendChild(drawInfo) |
|
|
|
toolbar.appendChild(drawInfo) |
|
|
|
|
|
|
|
|
|
|
|
const buttons = mk('div') |
|
|
|
const buttons = mk('div') |
|
|
|
buttons.classList.add('toolbar-buttons') |
|
|
|
buttons.classList.add('toolbar-buttons') |
|
|
|
toolbar.appendChild(buttons) |
|
|
|
toolbar.appendChild(buttons) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// heartbeat
|
|
|
|
|
|
|
|
connection.on('heartbeat', () => { |
|
|
|
|
|
|
|
heartbeat.classList.remove('beat') |
|
|
|
|
|
|
|
window.requestAnimationFrame(() => { |
|
|
|
|
|
|
|
heartbeat.classList.add('beat') |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
const redraw = mk('button') |
|
|
|
const redraw = mk('button') |
|
|
|
redraw.textContent = 'Redraw' |
|
|
|
redraw.textContent = 'Redraw' |
|
|
@ -331,8 +348,6 @@ module.exports = function attachDebugScreen (screen) { |
|
|
|
value = true |
|
|
|
value = true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (key === 'color') console.log(value) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (key === 'bold') attrs.style += 'font-weight:bold;' |
|
|
|
if (key === 'bold') attrs.style += 'font-weight:bold;' |
|
|
|
if (key === 'italic') attrs.style += 'font-style:italic;' |
|
|
|
if (key === 'italic') attrs.style += 'font-style:italic;' |
|
|
|
if (key === 'underline') attrs.style += 'text-decoration:underline;' |
|
|
|
if (key === 'underline') attrs.style += 'text-decoration:underline;' |