From c48c13417c198194b0d2f508a33431b27f5605b8 Mon Sep 17 00:00:00 2001 From: boris Date: Tue, 25 Dec 2018 18:06:51 +1300 Subject: e --- csgo-loader/csgo-client/Client.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'csgo-loader/csgo-client/Client.cpp') diff --git a/csgo-loader/csgo-client/Client.cpp b/csgo-loader/csgo-client/Client.cpp index 69920bb..3fc15fd 100644 --- a/csgo-loader/csgo-client/Client.cpp +++ b/csgo-loader/csgo-client/Client.cpp @@ -43,24 +43,44 @@ void hhahahaha() } #endif -int __stdcall WinMain(HINSTANCE inst, HINSTANCE prev, char* str, int cmdshow) +void OpenConsole() { -#ifdef DEBUG AllocConsole(); FILE *file; freopen_s(&file, "CONOUT$", "w", stdout); -#endif +} + +int __stdcall WinMain(HINSTANCE inst, HINSTANCE prev, char* str, int cmdshow) +{ + OpenConsole(); + Networking::TCPClient Client; // Initialize the syscall manager. if(!Syscalls->Start()) ERROR_ASSERT("[000F:00001A00] Failed to initialize. Please contact an administrator."); - + + // Wait for connection. UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_WAITING; + // Create a thread to handle UI. + std::thread WindowThread([] + { + // Create a window, initialise DirectX context. + if(!UserInterface->Start()) + ERROR_ASSERT("[000F:00001B00] Failed to initialize. Please contact an administrator."); + + // Create a loop to draw our UI. + UserInterface->RunUiFrame(); + }); WindowThread.detach(); + + // Attempt to connect to the remote server. if(!Client.Start(LOCAL_IP, SERVER_PORT)) ERROR_ASSERT("[000F:0002A000] Server did not accept the connection."); + // Allow the user to input their log-in data. + UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_LOG_IN; + // TODO: Add game selection. while(1) { if(GetAsyncKeyState(VK_END) & 0x8000) break; Sleep(1); } -- cgit v1.2.3