Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "platform/platform.h"
- #include "app/mainLoop.h"
- #include "T3D/gameFunctions.h"
- #include "include/cef_sandbox_win.h"
- #include "web/cef_handler.h"
- #include "include/cef_app.h"
- #include "include/cef_client.h"
- #include "platformWin32/platformWin32.h"
- extern Win32PlatState winState;
- // Entry point for your game.
- //
- // This is build by default using the "StandardMainLoop" toolkit. Feel free
- // to bring code over directly as you need to modify or extend things. You
- // will need to merge against future changes to the SML code if you do this.
- S32 TorqueMain(S32 argc, const char **argv)
- {
- // Some handy debugging code:
- // if (argc == 1) {
- // static const char* argvFake[] = { "dtest.exe", "-jload", "test.jrn" };
- // argc = 3;
- // argv = argvFake;
- // }
- // Memory::enableLogging("testMem.log");
- // Memory::setBreakAlloc(104717);
- // CEF
- // Enable High-DPI support on Windows 7 or newer.
- CefEnableHighDPISupport();
- // Provide CEF with command-line arguments.
- CefMainArgs main_args(winState.appInstance);
- // CEF applications have multiple sub-processes (render, plugin, GPU, etc)
- // that share the same executable. This function checks the command-line and,
- // if this is a sub-process, executes the appropriate logic.
- int exit_code = CefExecuteProcess(main_args, NULL, NULL);
- if (exit_code >= 0) {
- // The sub-process has completed so return here.
- return exit_code;
- }
- // Specify CEF global settings here.
- CefSettings settings;
- settings.no_sandbox = true;
- // Initialize CEF.
- // CefInitialize creates a sub-proccess and executes the same executeable, as calling CefInitialize, if not set different in settings.browser_subprocess_path
- // if you create an extra program just for the childproccess you only have to call CefExecuteProcess(...) in it.
- CefInitialize(main_args, settings, NULL, NULL);
- // Initialize the subsystems.
- StandardMainLoop::init();
- // Handle any command line args.
- if(!StandardMainLoop::handleCommandLine(argc, argv))
- {
- Platform::AlertOK("Error", "Failed to initialize game, shutting down.");
- return 1;
- }
- // create browser-window
- // Specify CEF browser settings here.
- CefBrowserSettings browser_settings;
- std::string url = "http://www.google.com";
- // Information used when creating the native window.
- CefWindowInfo window_info;
- // SimpleHandler implements browser-level callbacks.
- CefRefPtr<CefHandler> cefHandler(new CefHandler());
- #if defined(OS_WIN)
- // On Windows we need to specify certain flags that will be passed to
- // CreateWindowEx().
- window_info.SetAsWindowless(winState.appWindow);
- //window_info.SetAsPopup(winState.appWindow,"CEF TEST");
- #endif
- // Create the first browser window.
- // Con::printf(ConsoleLogEntry::General, "afxBillboardData(%s) incomplete blend factor specification.", getName());
- CefBrowserHost::CreateBrowserSync(window_info, cefHandler, url, browser_settings, NULL);
- // Run the CEF message loop. This will block until CefQuitMessageLoop() is
- // called.
- //CefRunMessageLoop();
- // Main loop
- while(StandardMainLoop::doMainLoop());
- // Clean everything up.
- StandardMainLoop::shutdown();
- // Do we need to restart?
- if( StandardMainLoop::requiresRestart() )
- Platform::restartInstance();
- // Shut down CEF.
- CefShutdown();
- delete CefHandler::GetInstance();
- // Return.
- return StandardMainLoop::getReturnStatus();
- }
- #endif //TORQUE_SHARED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement