win32 visible, focused, size fix
This commit is contained in:
		
							parent
							
								
									5254b8d230
								
							
						
					
					
						commit
						8a13517714
					
				| 
						 | 
				
			
			@ -40,7 +40,7 @@ struct Win32PlatformPrivate {
 | 
			
		|||
    int x, y;
 | 
			
		||||
    int width, height;
 | 
			
		||||
    int minWidth, minHeight;
 | 
			
		||||
    bool maximized;
 | 
			
		||||
    bool focused, visible, maximized;
 | 
			
		||||
} win32;
 | 
			
		||||
 | 
			
		||||
void Platform::init(const char *appName)
 | 
			
		||||
| 
						 | 
				
			
			@ -299,6 +299,16 @@ void Platform::swapBuffers()
 | 
			
		|||
    SwapBuffers(win32.hdc);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool Platform::isWindowFocused()
 | 
			
		||||
{
 | 
			
		||||
    return win32.focused;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool Platform::isWindowVisible()
 | 
			
		||||
{
 | 
			
		||||
    return win32.visible;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int Platform::getWindowX()
 | 
			
		||||
{
 | 
			
		||||
    return win32.x;
 | 
			
		||||
| 
						 | 
				
			
			@ -345,8 +355,15 @@ const char *Platform::getAppUserDir()
 | 
			
		|||
 | 
			
		||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 | 
			
		||||
{
 | 
			
		||||
    static int lastX, lastY;
 | 
			
		||||
 | 
			
		||||
    switch(uMsg)
 | 
			
		||||
    {
 | 
			
		||||
    case WM_ACTIVATE:
 | 
			
		||||
        {
 | 
			
		||||
            win32.focused = !(wParam == WA_INACTIVE);
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    case WM_CLOSE:
 | 
			
		||||
        {
 | 
			
		||||
            g_engine.onClose();
 | 
			
		||||
| 
						 | 
				
			
			@ -361,6 +378,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 | 
			
		|||
        }
 | 
			
		||||
    case WM_MOVE:
 | 
			
		||||
        {
 | 
			
		||||
            lastX = win32.x;
 | 
			
		||||
            lastY = win32.y;
 | 
			
		||||
            win32.x = LOWORD(lParam);
 | 
			
		||||
            win32.y = HIWORD(lParam);
 | 
			
		||||
            break;
 | 
			
		||||
| 
						 | 
				
			
			@ -370,6 +389,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 | 
			
		|||
            switch(wParam)
 | 
			
		||||
            {
 | 
			
		||||
            case SIZE_MAXIMIZED:
 | 
			
		||||
                win32.x = lastX;
 | 
			
		||||
                win32.y = lastY;
 | 
			
		||||
                win32.maximized = true;
 | 
			
		||||
                break;
 | 
			
		||||
            case SIZE_RESTORED:
 | 
			
		||||
| 
						 | 
				
			
			@ -377,8 +398,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 | 
			
		|||
                break;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            win32.visible = !(wParam == SIZE_MINIMIZED);
 | 
			
		||||
 | 
			
		||||
            if(!win32.maximized) {
 | 
			
		||||
                win32.width = LOWORD(lParam);
 | 
			
		||||
                win32.height = HIWORD(lParam);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            g_engine.onResize(LOWORD(lParam), HIWORD(lParam));
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue