| 2220 | |
| 2221 | |
| 2222 | int CScriptObjectSystem::EnumDisplayFormats(IFunctionHandler *pH) |
| 2223 | { |
| 2224 | CHECK_PARAMETERS(0); |
| 2225 | m_pLog->Log("Enumerating display settings..."); |
| 2226 | _SmartScriptObject pDispArray(m_pScriptSystem); |
| 2227 | TArray<SDispFormat> Formats; |
| 2228 | int i; |
| 2229 | m_pRenderer->EnumDisplayFormats(Formats, false); |
| 2230 | for (i=0; i<Formats.Num(); i++) |
| 2231 | { |
| 2232 | SDispFormat *pForm = &Formats[i]; |
| 2233 | _SmartScriptObject pDisp(m_pScriptSystem); |
| 2234 | pDisp->SetValue("width", pForm->m_Width); |
| 2235 | pDisp->SetValue("height", pForm->m_Height); |
| 2236 | pDisp->SetValue("bpp", pForm->m_BPP); |
| 2237 | |
| 2238 | // double check for multiple entries of the same resolution/color depth -- CW |
| 2239 | bool bInsert( true ); |
| 2240 | for( int j( 0 ); j < pDispArray->Count(); ++j ) |
| 2241 | { |
| 2242 | _SmartScriptObject pDispCmp( m_pScriptSystem ); |
| 2243 | if( false != pDispArray->GetAt( j + 1, pDispCmp ) ) |
| 2244 | { |
| 2245 | int iWidthCmp( 0 ); |
| 2246 | pDispCmp->GetValue( "width", iWidthCmp ); |
| 2247 | |
| 2248 | int iHeightCmp( 0 ); |
| 2249 | pDispCmp->GetValue( "height", iHeightCmp ); |
| 2250 | |
| 2251 | int iBppCmp( 0 ); |
| 2252 | pDispCmp->GetValue( "bpp", iBppCmp ); |
| 2253 | |
| 2254 | if( pForm->m_Width == iWidthCmp && |
| 2255 | pForm->m_Height == iHeightCmp && |
| 2256 | pForm->m_BPP == iBppCmp ) |
| 2257 | { |
| 2258 | bInsert = false; |
| 2259 | break; |
| 2260 | } |
| 2261 | } |
| 2262 | } |
| 2263 | if( false != bInsert ) |
| 2264 | { |
| 2265 | pDispArray->PushBack( pDisp ); |
| 2266 | } |
| 2267 | } |
| 2268 | |
| 2269 | if(Formats.Num()==0) // renderer is not doing his job |
| 2270 | { |
| 2271 | { |
| 2272 | _SmartScriptObject pDisp(m_pScriptSystem); |
| 2273 | pDisp->SetValue("width", 640); |
| 2274 | pDisp->SetValue("height", 480); |
| 2275 | pDisp->SetValue("bpp", 32); |
| 2276 | pDispArray->SetAt(1, pDisp); |
| 2277 | } |
| 2278 | { |
| 2279 | _SmartScriptObject pDisp(m_pScriptSystem); |