exit app when song ends
This commit is contained in:
27
src/main.cpp
27
src/main.cpp
@ -6,7 +6,7 @@
|
||||
#define BREAK_COMPATIBILITY 0
|
||||
#else
|
||||
#define OPENGL_DEBUG 0
|
||||
#define FULLSCREEN 1
|
||||
#define FULLSCREEN 0
|
||||
#define DESPERATE 0
|
||||
#define BREAK_COMPATIBILITY 0
|
||||
#endif
|
||||
@ -44,6 +44,7 @@ void entrypoint(void)
|
||||
|
||||
int __cdecl main(int argc, char* argv[])
|
||||
#endif
|
||||
|
||||
{
|
||||
// initialize window
|
||||
#if FULLSCREEN
|
||||
@ -59,7 +60,8 @@ int __cdecl main(int argc, char* argv[])
|
||||
// you can create a pseudo fullscreen window by similarly enabling the WS_MAXIMIZE flag as above
|
||||
// in which case you can replace the resolution parameters with 0s and save a couple bytes
|
||||
// this only works if the resolution is set to the display device's native resolution
|
||||
HDC hDC = GetDC(CreateWindow((LPCSTR)0xC018, 0, WS_POPUP | WS_VISIBLE, 0, 0, XRES, YRES, 0, 0, 0, 0));
|
||||
HWND window = CreateWindow((LPCSTR)0xC018, 0, WS_POPUP | WS_VISIBLE, 0, 0, XRES, YRES, 0, 0, 0, 0);
|
||||
HDC hDC = GetDC(window);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -105,19 +107,15 @@ int __cdecl main(int argc, char* argv[])
|
||||
#endif
|
||||
|
||||
long playCursor = 0;
|
||||
long lastPlayCursor = -1;
|
||||
// main loop
|
||||
direct_sound_buffer->Play(0, 0, 0);
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
direct_sound_buffer->GetCurrentPosition((DWORD*)&playCursor, NULL);
|
||||
direct_sound_buffer->GetCurrentPosition((DWORD*)&playCursor, NULL);
|
||||
float syncs[1 + SU_NUMSYNCS];
|
||||
|
||||
|
||||
#ifdef EDITOR_CONTROLS
|
||||
editor.beginFrame(timeGetTime());
|
||||
#endif
|
||||
|
||||
#if !(DESPERATE)
|
||||
// do minimal message handling so windows doesn't kill your application
|
||||
// not always strictly necessary but increases compatibility and reliability a lot
|
||||
@ -187,12 +185,11 @@ int __cdecl main(int argc, char* argv[])
|
||||
editor.printFrameStatistics();
|
||||
editor.updateShaders(&pidMain, &pidPost);
|
||||
#endif
|
||||
|
||||
} while(!GetAsyncKeyState(VK_ESCAPE)
|
||||
#if USE_AUDIO
|
||||
&& playCursor < SU_LENGTH_IN_SAMPLES * 2 * sizeof(SUsample)
|
||||
#endif
|
||||
);
|
||||
if (playCursor < lastPlayCursor) {
|
||||
break;
|
||||
}
|
||||
lastPlayCursor = playCursor;
|
||||
} while(!GetAsyncKeyState(VK_ESCAPE));
|
||||
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user