mirror of https://github.com/axmolengine/axmol.git
commit
3ebb61a09c
|
@ -693,9 +693,9 @@ void CCEGLView::centerWindow()
|
||||||
}
|
}
|
||||||
GetWindowRect(m_hWnd, &rcWindow);
|
GetWindowRect(m_hWnd, &rcWindow);
|
||||||
|
|
||||||
int offsetX = (rcDesktop.right - rcDesktop.left - (rcWindow.right - rcWindow.left)) / 2;
|
int offsetX = rcDesktop.left + (rcDesktop.right - rcDesktop.left - (rcWindow.right - rcWindow.left)) / 2;
|
||||||
offsetX = (offsetX > 0) ? offsetX : rcDesktop.left;
|
offsetX = (offsetX > 0) ? offsetX : rcDesktop.left;
|
||||||
int offsetY = (rcDesktop.bottom - rcDesktop.top - (rcWindow.bottom - rcWindow.top)) / 2;
|
int offsetY = rcDesktop.top + (rcDesktop.bottom - rcDesktop.top - (rcWindow.bottom - rcWindow.top)) / 2;
|
||||||
offsetY = (offsetY > 0) ? offsetY : rcDesktop.top;
|
offsetY = (offsetY > 0) ? offsetY : rcDesktop.top;
|
||||||
|
|
||||||
SetWindowPos(m_hWnd, 0, offsetX, offsetY, 0, 0, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOZORDER);
|
SetWindowPos(m_hWnd, 0, offsetX, offsetY, 0, 0, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOZORDER);
|
||||||
|
|
Loading…
Reference in New Issue