All pastes #635810 Raw Edit

Unnamed

public text v1 · immutable
#635810 ·published 2007-07-27 12:03 UTC
rendered paste body
void CWindow::ToggleFullscreen()
{
    if (m_graphics == NULL || !m_active)
        return;

    m_graphics->m_windowed = !m_graphics->m_windowed;

    if(m_graphics->m_windowed)
        SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW);
    else
    {
        ZeroMemory(&m_wp, sizeof(WINDOWPLACEMENT));
        m_wp.length = sizeof(WINDOWPLACEMENT);
        GetWindowPlacement(m_hWnd, &m_wp);
        SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_EX_TOPMOST);
        ShowWindow(m_hWnd, SW_HIDE);
    }

    OnLostDevice();
    m_graphics->Reset();
    OnResetDevice();

    if(m_graphics->m_windowed)
        SetWindowPlacement(m_hWnd, &m_wp);

    if(!IsWindowVisible(m_hWnd))
        ShowWindow(m_hWnd, SW_SHOW);
}