mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Add initialization for SDL
We continue to use the WinMain for the migration.
This commit is contained in:
parent
9812e18868
commit
742703e31e
12
blupi.cpp
12
blupi.cpp
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
|
#define SDL_MAIN_HANDLED
|
||||||
|
#include <SDL.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -586,6 +588,12 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
|
|||||||
wc.lpszClassName = NAME;
|
wc.lpszClassName = NAME;
|
||||||
RegisterClass(&wc);
|
RegisterClass(&wc);
|
||||||
|
|
||||||
|
SDL_SetMainReady ();
|
||||||
|
auto res = SDL_Init (SDL_INIT_VIDEO | SDL_INIT_AUDIO);
|
||||||
|
if (res < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
|
||||||
// Create a window.
|
// Create a window.
|
||||||
if ( g_bFullScreen )
|
if ( g_bFullScreen )
|
||||||
{
|
{
|
||||||
@ -838,7 +846,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||||||
{
|
{
|
||||||
if ( !GetMessage(&msg, NULL, 0, 0) )
|
if ( !GetMessage(&msg, NULL, 0, 0) )
|
||||||
{
|
{
|
||||||
return static_cast<int> (msg.wParam);
|
goto out;
|
||||||
}
|
}
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
@ -850,6 +858,8 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
SDL_Quit ();
|
||||||
return static_cast<int> (msg.wParam);
|
return static_cast<int> (msg.wParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user