예제 #1
0
void CToolboxApplication::PostInit()
{
	SAFE_DELETE(m_pStartupSplash);

	IFFont *pRobotoFont = gEnv->pCryFont->NewFont("roboto");
	if(!pRobotoFont->Load("Fonts/roboto.xml"))
	{
		CryMessageBox("Failed to load Roboto font!", "Roboto font load failed!!", 0);
	}

	SetupDefaultStyle();
	//SetupDarkStyle();

	RECT workAreaRect;
	SystemParametersInfo(SPI_GETWORKAREA, 0, &workAreaRect, 0);

	int width = workAreaRect.right - workAreaRect.left;
	int height = workAreaRect.bottom - workAreaRect.top;

	m_pMainWindow = static_cast<CMainWindow *>(m_pWindowManager->SpawnWindow("MainWindow", "CryENGINE Community Toolbox", width, height, 0, 0));

	StartGameContext(true);

	m_bInitialized = true;

	Redraw();

	Run();
}
예제 #2
0
void CToolboxApplication::OnInit(ISystem *pSystem)
{
	ModuleInitISystem(pSystem, "Toolbox");

	if(!pSystem->GetISystemEventDispatcher()->RegisterListener(&g_systemEventListener_Toolbox))
	{
		CryMessageBox("Failed to register Toolbox system event dispatcher!", "Toolbox startup failed!", 0);
		return;
	}
}
LRESULT CALLBACK CStartupSplash::WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg)
	{
	case WM_CREATE:
		{
			char buffer[MAX_PATH];
			GetCurrentDirectory(MAX_PATH, buffer); 

			auto fileName = string(buffer).append("\\Game\\Toolbox\\Splash.bmp");;

			HBITMAP hBitmap = (HBITMAP)LoadImage(GetModuleHandle(0), fileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
			if(hBitmap == nullptr)
				CryMessageBox("Failed to load startup splash!", "Toolbox splash load!", 0);

			m_pSplash->SetBitmap(hBitmap);
		}
		break;
	case WM_PAINT:
		{
			HBITMAP hBitmap = m_pSplash->GetBitmap();

			PAINTSTRUCT 	ps;
    		HDC 			hdc;
    		BITMAP 			bitmap;
    		HDC 			hdcMem;
			HGDIOBJ 		oldBitmap;

    		hdc = BeginPaint(hWnd, &ps);

    		hdcMem = CreateCompatibleDC(hdc);
			oldBitmap = SelectObject(hdcMem, hBitmap);

			GetObject(hBitmap, sizeof(bitmap), &bitmap);
			BitBlt(hdc, 0, 0, bitmap.bmWidth, bitmap.bmHeight, hdcMem, 0, 0, SRCCOPY);

			SelectObject(hdcMem, oldBitmap);
			DeleteDC(hdcMem);

			SetBkMode(hdc, TRANSPARENT);
			SetTextColor(hdc, 0xAFAFBE);

			RECT area;
			GetClientRect(hWnd, &area);
			area.bottom -= 5;

			DrawText(hdc, m_pSplash->GetStatus(), -1, &area, DT_SINGLELINE | DT_CENTER | DT_BOTTOM);

    		EndPaint(hWnd, &ps);
		}
		break;
	}

	return DefWindowProc(hWnd, msg, wParam, lParam);
}
예제 #4
0
void CGameAISystem::InformContentCreatorOfError(string logMessage) const
{
#if defined(GAME_AI_ASSERTS_ENABLED)

	if (g_gameAISystemAssertsAllowed)
	{
		CursorShowerWithStack cursorShowerWithStack;
		cursorShowerWithStack.StoreCurrentAndShow();

		string dialogMessage = logMessage +
			"\n"
			"Do you want to help?\n"
			"Yes\t- Help out and generate callstack (takes around 30 seconds)\n"
			"No\t- Not this time\n"
			"Cancel\t- Ignore similar errors for the rest of this session";

		const char* dialogCaption = "Error in GameAISystem";
		int messageBoxResult = CryMessageBox(dialogMessage.c_str(), dialogCaption, MB_ICONERROR | MB_YESNOCANCEL);

		switch (messageBoxResult)
		{
		case IDYES:
			{
				string callstack;
				GetCallStack(callstack);

				gEnv->pLog->LogError("Callstack:\n%s", callstack.c_str());

				messageBoxResult = CryMessageBox(
					"The callstack has been generated.\n"
					"\n"
					"Do you want me to prepare an email for you, describing the issue?",
					dialogCaption, MB_ICONINFORMATION | MB_YESNO);

				if (messageBoxResult == IDYES)
				{
					string_replace(callstack, "\n", "%%0A");

					string command = string().Format(
						"mailto:[email protected];[email protected];[email protected]"
						"?subject=Error in GameAISystem"
						"&body="
						"[Auto-generated e-mail]%%0A"
						"%%0A"
						"Hi,%%0A"
						"%%0A"
						"This is an auto-generated email.%%0A"
						"An error occurred in the GameAISystem: An entity entered or left a module while the modules were being updated.%%0A"
						"%%0A"
						"Here is the callstack:%%0A"
						+ callstack);

					ShellExecute(0, "open", command.c_str(), "", "", SW_NORMAL);
					CryMessageBox("Thanks! The email is being created for you.\nHave a nice day! :)", dialogCaption, MB_ICONINFORMATION | MB_OK);
				}
				else
				{
					CryMessageBox("Ok! The callstack has been written to the log file anyway.\nHave a nice day! :)", dialogCaption, MB_ICONINFORMATION | MB_OK);
				}

				break;
			}

		case IDNO:
			break;

		case IDCANCEL:
			g_gameAISystemAssertsAllowed = false;
			break;
		}

		cursorShowerWithStack.RevertToPrevious();
	}

#endif
}