Files
funnygame/engine/engine.cpp
2026-02-19 00:39:20 +02:00

65 lines
1.8 KiB
C++

#include "tier2/ifilesystem.h"
#include "materialsystem/igamewindow.h"
#include "materialsystem/imaterialsystem.h"
#include "tier1/interface.h"
#include "tier0/commandline.h"
#include "tier0/mem.h"
#include "sv_dll.h"
#include "cl_dll.h"
IRenderContext *g_pRenderContext;
IFileSystem *filesystem;
IGameWindowManager *g_pWindowManager;
CServerGameDLL *g_pServerGame;
CClientGameDLL *g_pClientGame;
extern "C" void FunnyMain( int argc, char **argv )
{
CommandLine()->CreateCommandLine(argc, argv);
CreateInterfaceFn pFilesystemFactory = Sys_GetFactory("filesystem_std");
CreateInterfaceFn pMaterialSystemFactory = Sys_GetFactory("MaterialSystem");
CreateInterfaceFn pRenderSystemFactory = Sys_GetFactory("RenderSystemVulkan");
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();
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);
g_pServerGame = new CServerGameDLL;
g_pServerGame->m_pGameWindow = pWindow;
g_pServerGame->m_pRenderContext = g_pRenderContext;
g_pServerGame->Init();
g_pClientGame = new CClientGameDLL;
g_pClientGame->m_pGameWindow = pWindow;
g_pClientGame->m_pRenderContext = g_pRenderContext;
g_pClientGame->Init();
for (;;) {
g_pWindowManager->Frame(0);
g_pServerGame->m_pBridge->Frame(0);
g_pClientGame->m_pBridge->Frame(0);
g_pRenderContext->Frame(0);
};
};