Esempio n. 1
0
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
	CefEnableHighDPISupport();

	CefMainArgs mainArgs(hInst);

	CefRefPtr<CefCommandLine> cmdLine = CefCommandLine::CreateCommandLine();
	cmdLine->InitFromString(::GetCommandLineW());

	CefRefPtr<CefApp> app;
	auto appType = GetAppType(cmdLine);
	if (appType == AppType::BROWSER)
		app = new BrowserApp();
	else if (appType == AppType::RENDERER)
		app = new RendererApp();

	int exitCode = CefExecuteProcess(mainArgs, app, nullptr);
	if (exitCode >= 0)
		return exitCode;

	CefSettings settings;
	settings.no_sandbox = true;
	settings.remote_debugging_port = 1337;
	CefString(&settings.cache_path).FromASCII("./cache/");

	CefInitialize(mainArgs, settings, app, nullptr);

	CefRunMessageLoop();

	CefShutdown();

	return 0;
}
Esempio n. 2
0
void App::OnMsg(const NetMessage* nmsg, int msgType /* = 0 */)
{
	switch (GetAppType())
	{
	case ESAT_GameCenter:
		OnGCMsg(nmsg, msgType);
		break;
	case ESAT_Base:
		OnBaseMsg(nmsg, msgType);
		break;
	case ESAT_Login:
		OnLoginMsg(nmsg, msgType);
		break;
	default:
		LOG(ERROR) << "Unknown App msg!" << LogValue("apptype", GetAppType()) << LogValue("appid", GetAppID()) << LogValue("msgtype", msgType);
		break;
	}
}
Esempio n. 3
0
void App::Disconnected()
{
	LOG(INFO) << "App disconnected!" << LogValue("apptype", GetAppType()) << LogValue("appid", GetAppID());
}
Esempio n. 4
0
int EasyProtocol::GetAppType()
{
	std::string sAppType = root[EASY_TAG_ROOT][EASY_TAG_HEADER][EASY_TAG_APP_TYPE].asString();	

	return GetAppType(sAppType);
}