00001 // Copyright (C) 2009-2012 Christian Stehno 00002 // This file is part of the "Irrlicht Engine". 00003 // For conditions of distribution and use, see copyright notice in irrlicht.h 00004 00005 #ifndef __E_DRIVER_CHOICE_H_INCLUDED__ 00006 #define __E_DRIVER_CHOICE_H_INCLUDED__ 00007 00008 #include <iostream> 00009 #include <cstdio> 00010 #include "EDriverTypes.h" 00011 #include "irrTypes.h" 00012 #include "IrrlichtDevice.h" 00013 00014 namespace irr 00015 { 00016 00018 static irr::video::E_DRIVER_TYPE driverChoiceConsole(bool allDrivers=true) 00019 { 00020 const char* const names[] = {"NullDriver","Software Renderer","Burning's Video","Direct3D 8.1","Direct3D 9.0c","OpenGL 1.x/2.x/3.x"}; 00021 printf("Please select the driver you want:\n"); 00022 irr::u32 i=0; 00023 for (i=irr::video::EDT_COUNT; i>0; --i) 00024 { 00025 if (allDrivers || (irr::IrrlichtDevice::isDriverSupported(irr::video::E_DRIVER_TYPE(i-1)))) 00026 printf(" (%c) %s\n", 'a'+irr::video::EDT_COUNT-i, names[i-1]); 00027 } 00028 00029 char c; 00030 std::cin >> c; 00031 c = irr::video::EDT_COUNT+'a'-c; 00032 00033 for (i=irr::video::EDT_COUNT; i>0; --i) 00034 { 00035 if (!(allDrivers || (irr::IrrlichtDevice::isDriverSupported(irr::video::E_DRIVER_TYPE(i-1))))) 00036 --c; 00037 if ((char)i==c) 00038 return irr::video::E_DRIVER_TYPE(i-1); 00039 } 00040 return irr::video::EDT_COUNT; 00041 } 00042 00043 } // end namespace irr 00044 00045 #endif