1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-21 21:55:38 +01:00
GiantsTools/ServerConsoleExample/ServerConsoleApp.cpp

57 lines
1.3 KiB
C++
Raw Normal View History

#include "pch.h"
#include "ServerConsoleApp.h"
#include "ServerDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
BEGIN_MESSAGE_MAP(ServerConsoleApp, CWinApp)
END_MESSAGE_MAP()
ServerConsoleApp ConsoleApp;
BOOL ServerConsoleApp::InitInstance()
{
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
return TRUE;
}
ServerConsoleApp::~ServerConsoleApp()
{
}
BOOL ServerConsoleApp::ExitInstance()
{
return CWinApp::ExitInstance();
}
2021-01-24 00:40:09 +01:00
void ServerConsoleApp::InitializeDialog(IGameServiceProvider* serviceProvider)
{
// Create the server console window.
// As this is also a Component, Giants will clean up this object automatically once
// it is no longer needed (i.e, there is no need to call delete).
2021-01-24 00:40:09 +01:00
auto dialog = std::make_shared<ServerDialog>(serviceProvider);
m_pMainWnd = dialog.get();
serviceProvider->Add<IGameServerConsole>(dialog);
}
__declspec(dllexport) void CreateServerConsole(
int apiVersion,
2021-01-24 00:40:09 +01:00
HWND hWnd,
IGameServiceProvider* serviceProvider)
{
if (apiVersion > 1)
{
throw std::invalid_argument(fmt::format("Unsupported API version {0}", apiVersion).c_str());
}
AFX_MANAGE_STATE(AfxGetStaticModuleState());
2021-01-24 00:40:09 +01:00
ConsoleApp.InitializeDialog(serviceProvider);
}