Skip to content

Commit

Permalink
view: replace the stop button with a continue/pause button
Browse files Browse the repository at this point in the history
Fixes #31
  • Loading branch information
Zeal8bit committed Sep 8, 2024
1 parent 66d4edb commit f817fed
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
Binary file added imgs/pause.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ <h4>Ready?</h4>

<section id="rightpanel">
<section class="menu" id="controls">
<img id="continue" title="Continue (F9)" src="imgs/continue.png" alt="Continue" />
<img id="continue" title="Continue (F9)" src="imgs/continue.png" class="cpuexec" alt="Continue" />
<img id="pause" title="Pause (F9)" src="imgs/pause.png" alt="Pause" class="cpuexec hidden" />
<img id="step" title="Step (F10)" src="imgs/step.png" alt="Step" />
<img id="stepover" title="Step Over (F11)" src="imgs/stepover.png" alt="Step over" />
<img id="stop" title="Stop" src="imgs/stop.png" alt="Stop" />
<img id="reset" title="Reset" src="imgs/restart.png" alt="Reset">
<img id="clean" title="Clean" src="imgs/clean.png" alt="Clean">
</section>
Expand Down
8 changes: 6 additions & 2 deletions view/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ terminal.open(document.getElementById('terminal'));

// Init shortcut key
document.addEventListener('keydown', function(event) {
const binding = {'F9': zealcom.cont, 'F10': zealcom.step, 'F11': zealcom.step_over};
const binding = {
'F9': $(".cpuexec:not(.hidden)"),
'F10': $("#step"),
'F11': $("#stepover")
};
if (binding[event.key]) {
binding[event.key]();
binding[event.key].click();
}
});

Expand Down
17 changes: 15 additions & 2 deletions view/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,28 @@
*/

$("#step").on("click", () => zealcom.step());
$("#stop").on("click", () => zealcom.stop());
$("#stepover").on("click", () => zealcom.step_over());
$("#continue").on("click", () => zealcom.cont());
$("#reset").on("click", () => zealcom.reset());
$("#clean").on("click", () => {
zealcom.restart();
resetRom();
});

function togglePauseContinue() {
$("#continue").toggleClass("hidden");
$("#pause").toggleClass("hidden");
}

$("#continue").on("click", () => {
zealcom.cont();
togglePauseContinue();
});

$("#pause").on("click", () => {
zealcom.stop();
togglePauseContinue();
});

/**
* Events for all menus and their content: breakpoints, CPU control, etc...
*/
Expand Down
4 changes: 2 additions & 2 deletions view/readrom.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ $("#read-button").on('click', function() {
loadMap($("#file-map")[0].files[0]);
loadEEPROM($("#file-eeprom")[0].files[0]);
loadCf($("#file-cf")[0].files[0]);
zealcom.cont();
$("#continue").click();
});

$("#romadvanced a").click(() => {
Expand Down Expand Up @@ -214,7 +214,7 @@ async function switchRom() {
if (hashcomp == true) {
loadRom(data);
}
zealcom.cont();
$("#continue").click();
$("#loading_img").invisible();
}
catch (error) {
Expand Down

0 comments on commit f817fed

Please sign in to comment.