#pragma comment(lib, "libcef.lib")
#pragma comment(lib, "libcef_dll_wrapper.lib")
#include "../application.h"
#include "../cef/app_handler.hpp"
#include "../cef/client_handler.hpp"
#include <include/cef_app.h>
#include <include/cef_base.h>
#ifdef BW_WIN32
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#pragma comment(lib, "shell32.lib")
#pragma comment(lib, "user32.lib")
#endif
void _bw_Application_exitProcess( int exit_code );
void _bw_Application_exitProcess( int exit_code ) {
#ifdef BW_WIN32
ExitProcess( exit_code );
#endif
}
void bw_Application_init( bw_Application* app ) {
app->engine_data = new bw_ApplicationEngineData;
#ifdef BW_WIN32
CefMainArgs main_args( GetModuleHandle( NULL ) );
#else
#error Platform not yet supported
#endif
CefSettings app_settings;
app_settings.multi_threaded_message_loop = 1;
CefBrowserSettings browser_settings;
CefRefPtr<CefApp> cef_app_handle( new AppHandler( app ) );
int exit_code = CefExecuteProcess( main_args, cef_app_handle.get(), 0 );
if ( exit_code >= 0 ) {
_bw_Application_exitProcess( exit_code );
return;
}
CefRefPtr<CefClient>* client = new CefRefPtr<CefClient>(new ClientHandler( app ));
CefInitialize( main_args, app_settings, cef_app_handle.get(), 0 );
app->engine_data->exit_code = 0;
app->engine_data->cef_client = (void*)client;
}
void bw_Application_step() {
CefDoMessageLoopWork();
}
void bw_Application_uninit( bw_Application* app ) {
delete app->engine_data;
}