Exemplo n.º 1
0
void ALW_GetWndPosition(int& nX, int& nY, int nWidth, int nHeight,
						bool bUseInputParamPos/* = false*/,
						bool bIgnoreCursorPos/* = false*/)
{
	int nSWidth, nSHeight;
	if (bUseInputParamPos == false)
		Wnd_GetCursorPos(&nX, &nY);
	Wnd_GetScreenSize(nSWidth, nSHeight);

	nX -= nWidth / 2;
	if (nX + nWidth > nSWidth)
		nX = nSWidth - nWidth;
	if (nX < 0)
		nX = 0;

	int nCentrePos;
	if (bIgnoreCursorPos == false)
		nCentrePos = (nSHeight - CURSOR_HEIGHT) / 2;
	else
		nCentrePos = nSHeight / 2;
	if (nY > nCentrePos)
		nY -= nHeight;
	else if (bIgnoreCursorPos == false)
		nY += CURSOR_HEIGHT;

	if (nY + nHeight > nSHeight)
		nY = nSHeight - nHeight;
	if (nY < 0)
		nY = 0;
}
Exemplo n.º 2
0
void KWndWindow::PaintDebugInfo()
{
	char	szInfo[128];
	szInfo[0] = 0;
	int nInfoLen = 0;

	int nOld = WND_SHOW_DEBUG_FRAME_TEXT;
	WND_SHOW_DEBUG_FRAME_TEXT = true;
	KWndWindow::PaintWindow();
	WND_SHOW_DEBUG_FRAME_TEXT = nOld;

#ifdef _DEBUG
	sprintf(szInfo, "Name:%s, Pos:%d,%d,Size:%d,%d", m_Caption,
		m_nAbsoluteLeft, m_nAbsoluteTop, m_Width, m_Height);
	nInfoLen = strlen(szInfo);
#else
	sprintf(szInfo, "Pos:%d,%d,Size:%d,%d", m_nAbsoluteLeft, m_nAbsoluteTop, m_Width, m_Height);
	nInfoLen = strlen(szInfo);
#endif
	if (m_Style & WND_S_SIZE_WITH_ALL_CHILD)
	{
		RECT	rc;
		GetAllChildLayoutRect(&rc);
		sprintf(&szInfo[nInfoLen], ",Rect:%d,%d-%d,%d", rc.left, rc.top,
			rc.right, rc.bottom);
		nInfoLen = strlen(szInfo);
	}
	int x, y, w, h;
	Wnd_GetCursorPos(&x, &y);
	Wnd_GetScreenSize(w, h);
	if (x + nInfoLen * 6  + 24 > w)
		x = w - nInfoLen * 6 - 24;
	if (y + 25 > h)
		y = h - 13;
	else
		y += 12;
	g_pRepresentShell->OutputText(12, szInfo, nInfoLen, x, y, 0xFFFF0000,
		0, TEXT_IN_SINGLE_PLANE_COORD, 0xffffffff);
}
Exemplo n.º 3
0
void KUiInit::PlayStartMovie()
{
	KIniFile	Ini;

	char	szMovieIndex[32], szFile[128];
	char	szPathFile[MAX_PATH];

	if (Ini.Load(LAUNCH_GAME_INI))
	{
		int		nSkipable;
		sprintf(szMovieIndex, "Movie_%d", m_nCurrentMovieIndex);
		Ini.GetString("JustLaunched", szMovieIndex, "", szFile, sizeof(szFile));
		strcat(szMovieIndex, "_Skipable");
		Ini.GetInteger("JustLaunched", szMovieIndex, 0, &nSkipable);

		if (szFile[0])
		{			
			KUiPlayVideo* pPlayer = KUiPlayVideo::OpenWindow();
			if (pPlayer)
			{
				pPlayer->SetPosition(0, 0);
				int nWidth, nHeight;
				Wnd_GetScreenSize(nWidth, nHeight);
				pPlayer->SetSize(nWidth, nHeight);
				pPlayer->Setting(nSkipable != 0, false, this, 0);
		
				g_GetFullPath(szPathFile, szFile);
				if (pPlayer->OpenVideo(szPathFile))
				{	//成功播放影片
					m_nCurrentMovieIndex++;
					return;
				}
			}
		}
	}
	KUiPlayVideo::CloseWindow(true);
	Wnd_ShowCursor(true);
	OpenWindow(true, false);
}