Change the debug trigger to something more accessible

This commit is contained in:
Eevee (Evelyn Woods) 2020-12-08 17:46:48 -07:00
parent a44ed295a2
commit 35bbac9c99
3 changed files with 17 additions and 11 deletions

BIN
icon-debug.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

View File

@ -14,7 +14,7 @@
</head>
<body data-mode="splash">
<header id="header-main">
<img src="icon.png" alt="">
<img id="header-icon" src="icon.png" alt="">
<h1>Lexy's Labyrinth</h1>
<p>— a game by <a href="https://eev.ee/">eevee</a></p>
<nav>

View File

@ -468,20 +468,11 @@ class Player extends PrimaryView {
if (! this.active)
return;
if (ev.key === 'p') {
if (ev.key === 'p' || ev.key === 'Pause') {
this.toggle_pause();
return;
}
if (ev.key === 'Pause' && ! this.debug.enabled) {
new ConfirmOverlay(this.conductor,
"Enable debug mode? This will disable all saving of scores until you reload!",
() => {
this.setup_debug();
},
).open();
}
if (ev.key === ' ') {
if (this.state === 'waiting') {
// Start without moving
@ -664,6 +655,7 @@ class Player extends PrimaryView {
}
// Link up the debug panel and enable debug features
// (note that this might be called /before/ setup!)
setup_debug() {
this.root.classList.add('--debug');
let debug_el = this.root.querySelector('#player-debug');
@ -2071,6 +2063,20 @@ class Conductor {
this.switch_to_player();
});
// Bind the secret debug button: the icon in the lower left
document.querySelector('#header-icon').addEventListener('auxclick', ev => {
if (ev.button === 1 && ! this.player.debug.enabled) {
new ConfirmOverlay(this,
"Enable debug mode in the player? This will give you lots of toys to play with, " +
"but disable all saving of scores until you reload the page!",
() => {
this.player.setup_debug();
ev.target.src = '/icon-debug.png';
},
).open();
}
});
this.update_nav_buttons();
this.switch_to_splash();
}