working shortcuts again
This commit is contained in:
parent
90897bd8d6
commit
44eb537564
|
@ -4,7 +4,7 @@ Size=400,400
|
|||
Collapsed=0
|
||||
|
||||
[Window][Emulator Status]
|
||||
Pos=156,47
|
||||
Size=370,370
|
||||
Pos=425,47
|
||||
Size=444,533
|
||||
Collapsed=0
|
||||
|
||||
|
|
28
source/app.d
28
source/app.d
|
@ -166,6 +166,31 @@ struct Chip8Status {
|
|||
|
||||
} // draw
|
||||
|
||||
void handleEvent(ref SDL_Event ev) {
|
||||
switch (ev.type) with (SDL_EventType) {
|
||||
case SDL_KEYDOWN:
|
||||
if ((ev.key.keysym.mod & KMOD_CTRL) != 0) {
|
||||
switch (ev.key.keysym.scancode) with (SDL_EventType) {
|
||||
case SDL_SCANCODE_L: loadShortcut(); break;
|
||||
case SDL_SCANCODE_S: saveShortcut(); break;
|
||||
case SDL_SCANCODE_D: debugShortcut(); break;
|
||||
case SDL_SCANCODE_G: redrawShortcut(); break;
|
||||
case SDL_SCANCODE_R: toggleRunShortcut(); break;
|
||||
case SDL_SCANCODE_T: stepShortcut(); break;
|
||||
case SDL_SCANCODE_Q: quitShortcut();
|
||||
default: break;
|
||||
}
|
||||
} else {
|
||||
if (ev.key.keysym.scancode == SDL_SCANCODE_ESCAPE) {
|
||||
quitShortcut();
|
||||
break;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} // handleEvent
|
||||
|
||||
} // Chip8Status
|
||||
|
||||
string doCapture(string sym, uint start, uint end)(){
|
||||
|
@ -661,7 +686,7 @@ struct Emulator {
|
|||
void create() {
|
||||
|
||||
// create window
|
||||
window.createWindow(640, 480);
|
||||
window.createWindow(960, 768);
|
||||
|
||||
// setup imgui
|
||||
imgui.initialize();
|
||||
|
@ -678,6 +703,7 @@ struct Emulator {
|
|||
while (SDL_PollEvent(&event)) {
|
||||
|
||||
imgui.handleEvent(event);
|
||||
status.handleEvent(event);
|
||||
emu.handleEvent(event);
|
||||
|
||||
switch (event.type) with (SDL_EventType) {
|
||||
|
|
Loading…
Reference in New Issue