networking i guess
This commit is contained in:
@@ -7,6 +7,12 @@
|
||||
#include "tier0/mem.h"
|
||||
#include "sv_dll.h"
|
||||
#include "cl_dll.h"
|
||||
#include "inetworkserver.h"
|
||||
#include "inetworkclient.h"
|
||||
|
||||
#ifdef STEAM
|
||||
#include "steam/steam_api.h"
|
||||
#endif
|
||||
|
||||
IRenderContext *g_pRenderContext;
|
||||
IFileSystem *filesystem;
|
||||
@@ -19,38 +25,52 @@ extern "C" void FunnyMain( int argc, char **argv )
|
||||
{
|
||||
CommandLine()->CreateCommandLine(argc, argv);
|
||||
|
||||
EngineConsts_t stConstants = {};
|
||||
#ifdef STEAM
|
||||
stConstants.m_bIsSteam = true;
|
||||
if (!SteamAPI_Init())
|
||||
Plat_FatalErrorFunc("SteamAPI_Init failed lol\n");
|
||||
stConstants.LaunchServer = LaunchLocalBridge;
|
||||
stConstants.ConnectSteamServer = ConnectBySteamID;
|
||||
#endif
|
||||
stConstants.m_bIsDedicated = CommandLine()->CheckParam("-dedicated");
|
||||
stConstants.LaunchLocalBridge = LaunchLocalBridge;
|
||||
stConstants.ConnectLocalBridge = ConnectByLocalBridge;
|
||||
CreateInterfaceFn pFilesystemFactory = Sys_GetFactory("filesystem_std");
|
||||
CreateInterfaceFn pMaterialSystemFactory = Sys_GetFactory("MaterialSystem");
|
||||
CreateInterfaceFn pRenderSystemFactory = Sys_GetFactory("RenderSystemVulkan");
|
||||
IGameWindow *pWindow;
|
||||
|
||||
filesystem = (IFileSystem*)pFilesystemFactory(FILESYSTEM_INTERFACE_VERSION, NULL);
|
||||
filesystem->Init();
|
||||
|
||||
g_pWindowManager = (IGameWindowManager*)pRenderSystemFactory(GAME_WINDOW_MANAGER_INTERFACE_VERSION, NULL);
|
||||
V_printf("%s\n", GAME_WINDOW_MANAGER_INTERFACE_VERSION);
|
||||
g_pWindowManager->Init();
|
||||
if (!stConstants.m_bIsDedicated)
|
||||
{
|
||||
g_pWindowManager = (IGameWindowManager*)pRenderSystemFactory(GAME_WINDOW_MANAGER_INTERFACE_VERSION, NULL);
|
||||
g_pWindowManager->Init();
|
||||
|
||||
IGameWindow *pWindow = g_pWindowManager->CreateWindow();
|
||||
pWindow->Init();
|
||||
|
||||
|
||||
g_pRenderContext = (IRenderContext*)pRenderSystemFactory(RENDER_CONTEXT_INTERFACE_VERSION, NULL);
|
||||
g_pRenderContext->SetMainWindowManager(g_pWindowManager);
|
||||
g_pRenderContext->Init();
|
||||
|
||||
g_pRenderContext->RegisterGameWindow(pWindow);
|
||||
pWindow = g_pWindowManager->CreateWindow();
|
||||
pWindow->Init();
|
||||
|
||||
g_pRenderContext = (IRenderContext*)pRenderSystemFactory(RENDER_CONTEXT_INTERFACE_VERSION, NULL);
|
||||
g_pRenderContext->SetMainWindowManager(g_pWindowManager);
|
||||
g_pRenderContext->Init();
|
||||
|
||||
g_pRenderContext->RegisterGameWindow(pWindow);
|
||||
}
|
||||
|
||||
g_pServerGame = new CServerGameDLL;
|
||||
g_pServerGame->m_pGameWindow = pWindow;
|
||||
g_pServerGame->m_pRenderContext = g_pRenderContext;
|
||||
g_pServerGame->m_pEngineConsts = &stConstants;
|
||||
g_pServerGame->Init();
|
||||
|
||||
g_pClientGame = new CClientGameDLL;
|
||||
g_pClientGame->m_pGameWindow = pWindow;
|
||||
g_pClientGame->m_pRenderContext = g_pRenderContext;
|
||||
g_pClientGame->Init();
|
||||
|
||||
if (!stConstants.m_bIsDedicated)
|
||||
{
|
||||
g_pClientGame = new CClientGameDLL;
|
||||
g_pClientGame->m_pGameWindow = pWindow;
|
||||
g_pClientGame->m_pRenderContext = g_pRenderContext;
|
||||
g_pClientGame->m_pEngineConsts = &stConstants;
|
||||
g_pClientGame->Init();
|
||||
}
|
||||
|
||||
|
||||
double fPrevious = Plat_GetTime();
|
||||
@@ -58,11 +78,15 @@ extern "C" void FunnyMain( int argc, char **argv )
|
||||
double fCurrent = Plat_GetTime();
|
||||
double fDelta = fCurrent-fPrevious;
|
||||
fPrevious = fCurrent;
|
||||
g_pWindowManager->Frame(fDelta);
|
||||
g_pServerGame->m_pBridge->Frame(fDelta);
|
||||
g_pClientGame->m_pBridge->Frame(fDelta);
|
||||
|
||||
g_pRenderContext->Frame(fDelta);
|
||||
if (!stConstants.m_bIsDedicated)
|
||||
{
|
||||
g_pWindowManager->Frame(fDelta);
|
||||
g_pClientGame->m_pBridge->Frame(fDelta);
|
||||
g_pRenderContext->Frame(fDelta);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user