[Gcblue-commits] gcb_wx/src/graphics tcDisplayModes.cpp,1.1,1.2 tcDisplaySettingsView.cpp,1.1,1.2
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-07-10 01:51:24
|
Update of /cvsroot/gcblue/gcb_wx/src/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27263/src/graphics Modified Files: tcDisplayModes.cpp tcDisplaySettingsView.cpp Log Message: Index: tcDisplayModes.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDisplayModes.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcDisplayModes.cpp 14 Jun 2004 21:52:48 -0000 1.1 --- tcDisplayModes.cpp 10 Jul 2004 01:51:16 -0000 1.2 *************** *** 40,57 **** ! void tcDisplayModes::ChangeMode(unsigned width, unsigned height, unsigned bits) { DEVMODE winModeInfo; winModeInfo.dmSize = sizeof(DEVMODE); ! winModeInfo.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; winModeInfo.dmBitsPerPel = bits; winModeInfo.dmPelsHeight = height; winModeInfo.dmPelsWidth = width; ! if (!IsModeValid(width, height, bits)) { fprintf(stderr, "tcDisplayModes::ChangeMode - Invalid mode: " ! "W:%d, H:%d, Bits:%d\n", width, height, bits); return; } --- 40,60 ---- ! void tcDisplayModes::ChangeMode(unsigned width, unsigned height, unsigned bits, ! unsigned freq) { DEVMODE winModeInfo; winModeInfo.dmSize = sizeof(DEVMODE); ! winModeInfo.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | ! DM_DISPLAYFREQUENCY; winModeInfo.dmBitsPerPel = bits; winModeInfo.dmPelsHeight = height; winModeInfo.dmPelsWidth = width; + winModeInfo.dmDisplayFrequency = freq; ! if (!IsModeValid(width, height, bits, freq)) { fprintf(stderr, "tcDisplayModes::ChangeMode - Invalid mode: " ! "W:%d, H:%d, Bits:%d, Freq:%d\n", width, height, bits, freq); return; } *************** *** 64,72 **** currentMode.width = width; currentMode.height = height; } else if (result == DISP_CHANGE_BADMODE) { fprintf(stderr, "tcDisplayModes::ChangeMode - Mode not supported: " ! "W:%d, H:%d, Bits:%d\n", width, height, bits); } else --- 67,76 ---- currentMode.width = width; currentMode.height = height; + currentMode.frequency = freq; } else if (result == DISP_CHANGE_BADMODE) { fprintf(stderr, "tcDisplayModes::ChangeMode - Mode not supported: " ! "W:%d, H:%d, Bits:%d Freq:%d\n", width, height, bits, freq); } else *************** *** 81,94 **** * after restart of game (if mode is valid). */ ! void tcDisplayModes::ChangeOptionsMode(unsigned width, unsigned height, unsigned bits) { ! if (!IsModeValid(width, height, bits)) { fprintf(stderr, "tcDisplayModes::ChangeOptionsMode - Invalid mode: " ! "W:%d, H:%d, Bits:%d\n", width, height, bits); return; } ! wxString modeString = wxString::Format("%d %d %d", width, height, bits); tcOptions::Get()->SetOptionString("DisplaySettings", modeString.GetData()); --- 85,99 ---- * after restart of game (if mode is valid). */ ! void tcDisplayModes::ChangeOptionsMode(unsigned width, unsigned height, unsigned bits, ! unsigned freq) { ! if (!IsModeValid(width, height, bits, freq)) { fprintf(stderr, "tcDisplayModes::ChangeOptionsMode - Invalid mode: " ! "W:%d, H:%d, Bits:%d Freq:%d\n", width, height, bits, freq); return; } ! wxString modeString = wxString::Format("%d %d %d %d", width, height, bits, freq); tcOptions::Get()->SetOptionString("DisplaySettings", modeString.GetData()); *************** *** 126,130 **** return ((mode_n.bits == currentMode.bits)&& (mode_n.height == currentMode.height)&& ! (mode_n.width == currentMode.width)); } --- 131,136 ---- return ((mode_n.bits == currentMode.bits)&& (mode_n.height == currentMode.height)&& ! (mode_n.width == currentMode.width)&& ! (mode_n.frequency == currentMode.frequency)); } *************** *** 132,136 **** * @return true if mode params match at least one of the modes in modeInfo */ ! bool tcDisplayModes::IsModeValid(unsigned width, unsigned height, unsigned bits) { unsigned int modeCount = GetModeCount(); --- 138,143 ---- * @return true if mode params match at least one of the modes in modeInfo */ ! bool tcDisplayModes::IsModeValid(unsigned width, unsigned height, unsigned bits, ! unsigned freq) { unsigned int modeCount = GetModeCount(); *************** *** 140,144 **** if ((info.bits == bits)&& (info.width == width)&& ! (info.height == height)) { return true; --- 147,152 ---- if ((info.bits == bits)&& (info.width == width)&& ! (info.height == height)&& ! (info.frequency == freq)) { return true; *************** *** 154,164 **** int height; int bits; ! if (sscanf(modeString, "%d %d %d", &width, &height, &bits) < 3) { return; } ! ChangeMode(width, height, bits); } --- 162,173 ---- int height; int bits; + int freq; ! if (sscanf(modeString, "%d %d %d %d", &width, &height, &bits, &freq) < 4) { return; } ! ChangeMode(width, height, bits, freq); } *************** *** 172,177 **** { tcDisplayModes::Info& info = modeInfo[n]; ! fprintf(stdout, "Display mode %d: W: %d, H: %d, Bits: %d\n", ! n, info.width, info.height, info.bits); } } --- 181,186 ---- { tcDisplayModes::Info& info = modeInfo[n]; ! fprintf(stdout, "Display mode %d: W: %d, H: %d, Bits: %d Freq: %d\n", ! n, info.width, info.height, info.bits, info.frequency); } } *************** *** 193,196 **** --- 202,207 ---- unsigned lastWidth = 0; unsigned lastHeight = 0; + unsigned lastFreq = 0; + int i = 0; while ( EnumDisplaySettings(0, i++, &winModeInfo) ) *************** *** 200,207 **** info.height = winModeInfo.dmPelsHeight; info.width = winModeInfo.dmPelsWidth; bool matchesLast = ((info.bits == lastBits)&& (info.width == lastWidth)&& ! (info.height == lastHeight)); if ((info.bits >= 16)&&(info.width >= 800)&&(!matchesLast)) --- 211,220 ---- info.height = winModeInfo.dmPelsHeight; info.width = winModeInfo.dmPelsWidth; + info.frequency = winModeInfo.dmDisplayFrequency; bool matchesLast = ((info.bits == lastBits)&& (info.width == lastWidth)&& ! (info.height == lastHeight)&& ! (info.frequency == lastFreq)); if ((info.bits >= 16)&&(info.width >= 800)&&(!matchesLast)) *************** *** 213,216 **** --- 226,230 ---- lastWidth = info.width; lastHeight = info.height; + lastFreq = info.frequency; } *************** *** 220,223 **** --- 234,238 ---- currentMode.height = winModeInfo.dmPelsHeight; currentMode.width = winModeInfo.dmPelsWidth; + currentMode.frequency = winModeInfo.dmDisplayFrequency; } *************** *** 232,236 **** tcDisplayModes::~tcDisplayModes() { ! ChangeMode(startMode.width, startMode.height, startMode.bits); } --- 247,252 ---- tcDisplayModes::~tcDisplayModes() { ! ChangeMode(startMode.width, startMode.height, startMode.bits, ! startMode.frequency); } Index: tcDisplaySettingsView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/graphics/tcDisplaySettingsView.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcDisplaySettingsView.cpp 14 Jun 2004 21:52:48 -0000 1.1 --- tcDisplaySettingsView.cpp 10 Jul 2004 01:51:16 -0000 1.2 *************** *** 166,170 **** const tcDisplayModes::Info& info = tcDisplayModes::Get()->GetModeInfo((unsigned)downIdx); ! tcDisplayModes::Get()->ChangeOptionsMode(info.width, info.height, info.bits); selectedModeIdx = downIdx; --- 166,171 ---- const tcDisplayModes::Info& info = tcDisplayModes::Get()->GetModeInfo((unsigned)downIdx); ! tcDisplayModes::Get()->ChangeOptionsMode(info.width, info.height, info.bits, ! info.frequency); selectedModeIdx = downIdx; *************** *** 203,208 **** const tcDisplayModes::Info& info = tcDisplayModes::Get()->GetModeInfo(n); ! drawingInfo.modeText = wxString::Format("%d x %d (%d)", ! info.width, info.height, info.bits); MultiByteToWideChar(CP_ACP, 0, drawingInfo.modeText, -1, szwchar, 255); --- 204,209 ---- const tcDisplayModes::Info& info = tcDisplayModes::Get()->GetModeInfo(n); ! drawingInfo.modeText = wxString::Format("%d x %d (%d) %d Hz", ! info.width, info.height, info.bits, info.frequency); MultiByteToWideChar(CP_ACP, 0, drawingInfo.modeText, -1, szwchar, 255); |