int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int cmdShow) { gui.reset(new GUI::GuiWrapper()); simulation.reset(new Simulation()); runSimulation = InitialiseWindow(&hInstance) && InitialiseDirectX() && simulation->CreateSimulation(hInstance, hWnd, d3ddev) && InitialiseGUI(); while(runSimulation && gui->Update()) { simulation->Update(); simulation->Render(); } d3ddev->Release(); d3d->Release(); backBuffer->Release(); #ifdef _DEBUG OutputDebugString("Exiting Simulation\n"); #endif }
int main(int ROCKET_UNUSED(argc), char** ROCKET_UNUSED(argv)) #endif { // Generic OS initialisation, creates a window and does not attach OpenGL. if (!Shell::Initialise("../Samples/basic/directx/") || !Shell::OpenWindow("DirectX Sample", false)) { Shell::Shutdown(); return -1; } // DirectX initialisation. if (!InitialiseDirectX()) { Shell::CloseWindow(); Shell::Shutdown(); return -1; } // Install our DirectX render interface into Rocket. RenderInterfaceDirectX directx_renderer(g_pD3D, g_pd3dDevice); Rocket::Core::SetRenderInterface(&directx_renderer); ShellSystemInterface system_interface; Rocket::Core::SetSystemInterface(&system_interface); Rocket::Core::Initialise(); // Create the main Rocket context and set it on the shell's input layer. context = Rocket::Core::CreateContext("main", Rocket::Core::Vector2i(1024, 768)); if (context == NULL) { Rocket::Core::Shutdown(); Shell::Shutdown(); return -1; } Rocket::Debugger::Initialise(context); Input::SetContext(context); Shell::LoadFonts("../../assets/"); // Load and show the tutorial document. Rocket::Core::ElementDocument* document = context->LoadDocument("../../assets/demo.rml"); if (document != NULL) { document->Show(); document->RemoveReference(); } Shell::EventLoop(GameLoop); // Shutdown Rocket. context->RemoveReference(); Rocket::Core::Shutdown(); ShutdownDirectX(); Shell::CloseWindow(); Shell::Shutdown(); return 0; }