mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Reorganize supported video driver query mechanisms
This commit is contained in:
parent
44e4f5ab6e
commit
976d0b2caa
6 changed files with 160 additions and 98 deletions
37
src/main.cpp
37
src/main.cpp
|
@ -1998,22 +1998,6 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
|
|||
|
||||
bool ClientLauncher::create_engine_device(int log_level)
|
||||
{
|
||||
static const char *driverids[] = {
|
||||
"null",
|
||||
"software",
|
||||
"burningsvideo",
|
||||
"direct3d8",
|
||||
"direct3d9",
|
||||
"opengl"
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
||||
,"ogles1"
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
,"ogles2"
|
||||
#endif
|
||||
,"invalid"
|
||||
};
|
||||
|
||||
static const irr::ELOG_LEVEL irr_log_level[5] = {
|
||||
ELL_NONE,
|
||||
ELL_ERROR,
|
||||
|
@ -2038,20 +2022,21 @@ bool ClientLauncher::create_engine_device(int log_level)
|
|||
|
||||
// Determine driver
|
||||
video::E_DRIVER_TYPE driverType = video::EDT_OPENGL;
|
||||
|
||||
std::string driverstring = g_settings->get("video_driver");
|
||||
for (size_t i = 0; i < sizeof driverids / sizeof driverids[0]; i++) {
|
||||
if (strcasecmp(driverstring.c_str(), driverids[i]) == 0) {
|
||||
driverType = (video::E_DRIVER_TYPE) i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (strcasecmp("invalid", driverids[i]) == 0) {
|
||||
errorstream << "WARNING: Invalid video_driver specified;"
|
||||
<< " defaulting to opengl" << std::endl;
|
||||
std::vector<video::E_DRIVER_TYPE> drivers
|
||||
= porting::getSupportedVideoDrivers();
|
||||
u32 i;
|
||||
for (i = 0; i != drivers.size(); i++) {
|
||||
if (!strcasecmp(driverstring.c_str(),
|
||||
porting::getVideoDriverName(drivers[i]))) {
|
||||
driverType = drivers[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == drivers.size()) {
|
||||
errorstream << "Invalid video_driver specified; "
|
||||
"defaulting to opengl" << std::endl;
|
||||
}
|
||||
|
||||
SIrrlichtCreationParameters params = SIrrlichtCreationParameters();
|
||||
params.DriverType = driverType;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue