cave-story-solaris/src/Escape.cpp
Clownacy 5ea356a3bd Weed out a lot of the Windows dependency
Storytime: Cucky's original SDL2 port work involved using SDL2's
threading API to emulate the original WinAPI threading.

I can't be assed with that stuff, so I used the same trick Cucky did
for the Wii port, and hooked Organya up to the SDL2 audio callback.
This actually opens up the possibility for perfectly-synchronised
Organya playback. By that I mean, instead of needing a super
low-latency audio callback, I can have the callback synchronise its
audio mixing with Organya itself. I haven't done it yet, I plan to
soon.
2019-09-04 00:28:23 +01:00

49 lines
800 B
C++

#include "Escape.h"
#include "WindowsWrapper.h"
#include "CommonDefines.h"
#include "Draw.h"
#include "KeyControl.h"
#include "Main.h"
int Call_Escape(void)
{
RECT rc = {0, 128, 208, 144};
while (1)
{
// Get pressed keys
GetTrg();
if (gKeyTrg & KEY_ESCAPE) // Escape is pressed, quit game
{
gKeyTrg = 0;
return 0;
}
if (gKeyTrg & KEY_F1) // F1 is pressed, continue
{
gKeyTrg = 0;
return 1;
}
if (gKeyTrg & KEY_F2) // F2 is pressed, reset
{
gKeyTrg = 0;
return 2;
}
// Draw screen
CortBox(&grcFull, 0x000000);
PutBitmap3(&grcFull, (WINDOW_WIDTH - 208) / 2, (WINDOW_HEIGHT - 16) / 2, &rc, SURFACE_ID_TEXT_BOX);
PutFramePerSecound();
if (!Flip_SystemTask())
{
// Quit if window is closed
gKeyTrg = 0;
return 0;
}
}
return 0;
}