Example #1
0
bool wxDisplayImplDirectDraw::ChangeMode(const wxVideoMode& mode)
{
    wxWindow *winTop = wxTheApp->GetTopWindow();
    wxCHECK_MSG( winTop, false, wxT("top level window required for DirectX") );

    HRESULT hr = m_pDD2->SetCooperativeLevel
                         (
                            GetHwndOf(winTop),
                            DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN
                         );
    if ( FAILED(hr) )
    {
        wxLogApiError(wxT("IDirectDraw2::SetCooperativeLevel"), hr);

        return false;
    }

    hr = m_pDD2->SetDisplayMode(mode.w, mode.h, mode.bpp, mode.refresh, 0);
    if ( FAILED(hr) )
    {
        wxLogApiError(wxT("IDirectDraw2::SetDisplayMode"), hr);

        return false;
    }

    return true;
}
Example #2
0
BOOL CLoadDirectDraw::IsDirectDrawVersion1()
{

    if (m_pDirectDraw == NULL)
        return FALSE;

    IDirectDraw2 *p = NULL;
    HRESULT hr = m_pDirectDraw->QueryInterface(IID_IDirectDraw2, (void **)&p);
    if (p)
        p->Release();
    if (hr == NOERROR) {
        DbgLog((LOG_TRACE,3,TEXT("Direct Draw Version 2 or greater")));
        return FALSE;
    } else {
        DbgLog((LOG_TRACE,3,TEXT("Direct Draw Version 1")));
        return TRUE;
    }
}
Example #3
0
wxArrayVideoModes
wxDisplayImplDirectDraw::GetModes(const wxVideoMode& modeMatch) const
{
    wxArrayVideoModes modes;
    wxDDVideoModesAdder modesAdder(modes, modeMatch);

    HRESULT hr = m_pDD2->EnumDisplayModes
                         (
                            DDEDM_REFRESHRATES,
                            NULL,                   // all modes
                            &modesAdder,            // callback parameter
                            wxDDEnumModesCallback
                         );

    if ( FAILED(hr) )
    {
        wxLogApiError(wxT("IDirectDraw::EnumDisplayModes"), hr);
    }

    return modes;
}
Example #4
0
 ~wxDisplayInfo() { if ( m_pDD2 ) m_pDD2->Release(); }