00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #include "OgreD3D9DriverList.h" 00026 #include "OgreLogManager.h" 00027 #include "OgreException.h" 00028 00029 namespace Ogre 00030 { 00031 D3D9DriverList::D3D9DriverList( LPDIRECT3D9 pD3D ) : mpD3D(pD3D) 00032 { 00033 if( !mpD3D ) 00034 Except( Exception::ERR_INVALIDPARAMS, "Direct3D9 interface pointer is NULL", "D3D9DriverList::D3D9DriverList" ); 00035 enumerate(); 00036 } 00037 00038 D3D9DriverList::~D3D9DriverList(void) 00039 { 00040 mDriverList.clear(); 00041 } 00042 00043 BOOL D3D9DriverList::enumerate() 00044 { 00045 LogManager::getSingleton().logMessage( "D3D9: Driver Detection Starts" ); 00046 for( UINT iAdapter=0; iAdapter < mpD3D->GetAdapterCount(); ++iAdapter ) 00047 { 00048 D3DADAPTER_IDENTIFIER9 adapterIdentifier; 00049 D3DDISPLAYMODE d3ddm; 00050 mpD3D->GetAdapterIdentifier( iAdapter, 0, &adapterIdentifier ); 00051 mpD3D->GetAdapterDisplayMode( iAdapter, &d3ddm ); 00052 00053 mDriverList.push_back( D3D9Driver( mpD3D, iAdapter, adapterIdentifier, d3ddm ) ); 00054 } 00055 00056 LogManager::getSingleton().logMessage( "D3D9: Driver Detection Ends" ); 00057 00058 return TRUE; 00059 } 00060 00061 size_t D3D9DriverList::count() const 00062 { 00063 return mDriverList.size(); 00064 } 00065 00066 D3D9Driver* D3D9DriverList::item( size_t index ) 00067 { 00068 return &mDriverList.at( index ); 00069 } 00070 00071 D3D9Driver* D3D9DriverList::item( const String &name ) 00072 { 00073 std::vector<D3D9Driver>::iterator it = mDriverList.begin(); 00074 if (it == mDriverList.end()) 00075 return NULL; 00076 00077 for (;it != mDriverList.end(); ++it) 00078 { 00079 if (it->DriverDescription() == name) 00080 return &(*it); 00081 } 00082 00083 return NULL; 00084 } 00085 }
Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:07 2004