Extract brush panel UI, app startup shell, and Win32 runtime shell
This commit is contained in:
79
src/main.cpp
79
src/main.cpp
@@ -10,6 +10,7 @@
|
||||
#include "platform_windows/windows_bootstrap_helpers.h"
|
||||
#include "platform_windows/windows_platform_services.h"
|
||||
#include "platform_windows/windows_lifecycle_shell.h"
|
||||
#include "platform_windows/windows_runtime_shell.h"
|
||||
#include "platform_windows/windows_splash.h"
|
||||
#include "platform_windows/windows_stylus_input.h"
|
||||
#include "platform_windows/windows_window_shell.h"
|
||||
@@ -172,83 +173,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
// link: https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-registertouchwindow
|
||||
if (RegisterTouchWindow(state.hWnd, 0) == 0)
|
||||
{
|
||||
LOG("RegisterTouchWindow error: %s", pp::platform::windows::GetLastErrorAsString().c_str());
|
||||
}
|
||||
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
|
||||
pp::platform::windows::mark_lifecycle_running();
|
||||
App::I->runtime().render_thread_start(*App::I);
|
||||
App::I->runtime().ui_thread_start(*App::I);
|
||||
|
||||
#ifdef _DEBUG
|
||||
glad_set_pre_callback(pp::platform::windows::_pre_call_callback);
|
||||
glad_set_post_callback(pp::platform::windows::_post_call_callback);
|
||||
#endif
|
||||
|
||||
if (!state.sandboxed)
|
||||
{
|
||||
LOG("init WinTab");
|
||||
WacomTablet::I.init(state.hWnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG("SKIP init WinTab");
|
||||
}
|
||||
|
||||
LOG("change icon");
|
||||
SendMessage(state.hWnd, WM_SETICON, ICON_SMALL,
|
||||
(LPARAM)LoadIcon(GetModuleHandle(0), MAKEINTRESOURCE(IDI_ICON1)));
|
||||
|
||||
App::I->ui_sync();
|
||||
|
||||
{
|
||||
WINDOWPLACEMENT wp;
|
||||
GetWindowPlacement(state.hWnd, &wp);
|
||||
wp.showCmd = startup.show_command;
|
||||
SetWindowPlacement(state.hWnd, &wp);
|
||||
//GetClientRect(hWnd, &clientRect);
|
||||
//App::I->width = clientRect.right - clientRect.left;
|
||||
//App::I->height = clientRect.bottom - clientRect.top;
|
||||
}
|
||||
|
||||
if (start_in_vr)
|
||||
App::I->vr_start();
|
||||
|
||||
LOG("show main window");
|
||||
SetForegroundWindow(state.hWnd);
|
||||
//ShowWindow(hWnd, show_cmd);
|
||||
|
||||
splash.dismiss();
|
||||
|
||||
MSG msg;
|
||||
LOG("start main loop");
|
||||
while (pp::platform::windows::lifecycle_is_running())
|
||||
{
|
||||
// If there any message in the queue process it
|
||||
auto present = App::I->animate || App::I->redraw ?
|
||||
PeekMessage(&msg, 0, 0, 0, PM_REMOVE) : GetMessage(&msg, 0, 0, 0);
|
||||
|
||||
if (msg.message == WM_QUIT)
|
||||
pp::platform::windows::mark_lifecycle_stopped();
|
||||
|
||||
if (present)
|
||||
{
|
||||
DispatchMessage(&msg);
|
||||
TranslateMessage(&msg);
|
||||
}
|
||||
|
||||
// list of tasks for the main thread
|
||||
pp::platform::windows::drain_main_thread_tasks();
|
||||
}
|
||||
// Clean up
|
||||
WacomTablet::I.terminate();
|
||||
|
||||
UnregisterClass(startup.window_class.lpszClassName, state.hInst);
|
||||
LogRemote::I.stop();
|
||||
pp::platform::windows::run_main_window_runtime(startup, start_in_vr, splash);
|
||||
}
|
||||
|
||||
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
|
||||
|
||||
Reference in New Issue
Block a user