Added Windows subsystem entry point for release builds.

This commit is contained in:
Muzychenko Andrey 2021-10-09 12:33:33 +03:00
parent 69027eca53
commit d80074b9b6
5 changed files with 46 additions and 37 deletions

View File

@ -28,11 +28,10 @@
"configurationType": "Release", "configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}", "buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "-DCMAKE_WIN32_EXECUTABLE:BOOL=1",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ], "inheritEnvironments": [ "msvc_x86" ]
"variables": []
}, },
{ {
"name": "x64-Release", "name": "x64-Release",
@ -40,11 +39,10 @@
"configurationType": "Release", "configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}", "buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "-DCMAKE_WIN32_EXECUTABLE:BOOL=1",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ], "inheritEnvironments": [ "msvc_x64_x64" ]
"variables": []
} }
] ]
} }

View File

@ -5,25 +5,37 @@
#include "winmain.h" #include "winmain.h"
int main(int argc, char* argv[]) int MainActual(LPCSTR lpCmdLine)
{ {
{
// Testing with UI
std::string cmdLine;
for (int i = 0; i < argc; i++)
cmdLine += argv[i];
// Todo: get rid of restart to change resolution. // Todo: get rid of restart to change resolution.
int returnCode; int returnCode;
do do
{ {
returnCode = winmain::WinMain(cmdLine.c_str()); returnCode = winmain::WinMain(lpCmdLine);
} }
while (winmain::RestartRequested()); while (winmain::RestartRequested());
return returnCode; return returnCode;
} }
int main(int argc, char* argv[])
{
std::string cmdLine;
for (int i = 1; i < argc; i++)
cmdLine += argv[i];
return MainActual(cmdLine.c_str());
} }
#if _WIN32
#include <windows.h>
// Windows subsystem main
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
return MainActual(lpCmdLine);
}
#endif
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu // Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu // Debug program: F5 or Debug > Start Debugging menu

View File

@ -17,36 +17,36 @@ constexpr uint16_t SwapByteOrderShort(uint16_t val)
#pragma pack(1) #pragma pack(1)
struct riff_block struct riff_block
{ {
DWORD TkStart; uint32_t TkStart;
DWORD CbBuffer; uint32_t CbBuffer;
char AData[4]; char AData[4];
}; };
struct riff_data struct riff_data
{ {
DWORD Data; uint32_t Data;
DWORD DataSize; uint32_t DataSize;
DWORD BlocksPerChunk; uint32_t BlocksPerChunk;
riff_block Blocks[1]; riff_block Blocks[1];
}; };
struct riff_header struct riff_header
{ {
DWORD Riff; uint32_t Riff;
DWORD FileSize; uint32_t FileSize;
DWORD Mids; uint32_t Mids;
DWORD Fmt; uint32_t Fmt;
DWORD FmtSize; uint32_t FmtSize;
DWORD dwTimeFormat; uint32_t dwTimeFormat;
DWORD cbMaxBuffer; uint32_t cbMaxBuffer;
DWORD dwFlags; uint32_t dwFlags;
riff_data Data; riff_data Data;
}; };
struct midi_event struct midi_event
{ {
DWORD iTicks; uint32_t iTicks;
DWORD iEvent; uint32_t iEvent;
}; };
struct midi_header struct midi_header

View File

@ -41,7 +41,6 @@
//https://github.com/Tyyppi77/imgui_sdl 01deb04b102b6a1c15c7fdec1977a2c96a885e6f //https://github.com/Tyyppi77/imgui_sdl 01deb04b102b6a1c15c7fdec1977a2c96a885e6f
#include "imgui_sdl.h" #include "imgui_sdl.h"
typedef uint32_t DWORD;
typedef char* LPSTR; typedef char* LPSTR;
typedef const char* LPCSTR; typedef const char* LPCSTR;

View File

@ -152,7 +152,7 @@ int winmain::WinMain(LPCSTR lpCmdLine)
else else
pb::replay_level(0); pb::replay_level(0);
DWORD dtHistoryCounter = 300u, updateCounter = 0, frameCounter = 0; unsigned dtHistoryCounter = 300u, updateCounter = 0, frameCounter = 0;
auto frameStart = Clock::now(); auto frameStart = Clock::now();
double UpdateToFrameCounter = 0; double UpdateToFrameCounter = 0;