video backend selection

This commit is contained in:
Perttu Ahola 2011-02-19 11:48:54 +02:00
parent 4c2b9ed516
commit f5ff378dd0
3 changed files with 45 additions and 20 deletions

@ -7,7 +7,9 @@
# By default, all the settings are commented and not functional. # By default, all the settings are commented and not functional.
# Uncomment settings by removing the preceding #. # Uncomment settings by removing the preceding #.
#
# Client side stuff # Client side stuff
#
#wanted_fps = 30 #wanted_fps = 30
#fps_max = 60 #fps_max = 60
@ -19,17 +21,28 @@
#address = kray.dy.fi #address = kray.dy.fi
#name = #name =
# Whether to try to fog out the border of the visible area
#enable_fog = true
# Enable a bit lower water surface; disable for speed
#new_style_water = true
# Enable nice leaves; disable for speed
#new_style_leaves = true
# Whether to draw a frametime graph
#frametime_graph = false
# Enable combining mainly used textures to a bigger one
#enable_texture_atlas = true
# Path to texture directory
#texture_path =
# Possible values: null, software, burningsvideo, direct3d8, direct3d9, opengl
#video_driver = opengl
#
#random_input = false #random_input = false
#client_delete_unused_sectors_timeout = 1200 #client_delete_unused_sectors_timeout = 1200
#enable_fog = true #
#new_style_water = true
#new_style_leaves = true
#frametime_graph = false
#enable_texture_atlas = true
#texture_path =
# Server side stuff # Server side stuff
#
#map-dir = /home/palle/custom_map #map-dir = /home/palle/custom_map

@ -44,6 +44,7 @@ void set_default_settings()
g_settings.setDefault("frametime_graph", "false"); g_settings.setDefault("frametime_graph", "false");
g_settings.setDefault("enable_texture_atlas", "true"); g_settings.setDefault("enable_texture_atlas", "true");
g_settings.setDefault("texture_path", ""); g_settings.setDefault("texture_path", "");
g_settings.setDefault("video_driver", "opengl");
g_settings.setDefault("free_move", "false"); g_settings.setDefault("free_move", "false");
g_settings.setDefault("continuous_forward", "false"); g_settings.setDefault("continuous_forward", "false");

@ -1723,30 +1723,41 @@ int main(int argc, char *argv[])
std::string playername = g_settings.get("name"); std::string playername = g_settings.get("name");
/* // Resolution selection
Resolution selection
*/
bool fullscreen = false; bool fullscreen = false;
u16 screenW = g_settings.getU16("screenW"); u16 screenW = g_settings.getU16("screenW");
u16 screenH = g_settings.getU16("screenH"); u16 screenH = g_settings.getU16("screenH");
// // Determine driver
MyEventReceiver receiver;
video::E_DRIVER_TYPE driverType; video::E_DRIVER_TYPE driverType;
std::string driverstring = g_settings.get("video_driver");
#ifdef _WIN32 if(driverstring == "null")
//driverType = video::EDT_DIRECT3D9; driverType = video::EDT_NULL;
driverType = video::EDT_OPENGL; else if(driverstring == "software")
#else driverType = video::EDT_SOFTWARE;
driverType = video::EDT_OPENGL; else if(driverstring == "burningsvideo")
//driverType = video::EDT_BURNINGSVIDEO; // Best software renderer driverType = video::EDT_BURNINGSVIDEO;
#endif else if(driverstring == "direct3d8")
driverType = video::EDT_DIRECT3D8;
else if(driverstring == "direct3d9")
driverType = video::EDT_DIRECT3D9;
else if(driverstring == "opengl")
driverType = video::EDT_OPENGL;
else
{
dstream<<"WARNING: Invalid video_driver specified; defaulting "
"to opengl"<<std::endl;
driverType = video::EDT_OPENGL;
}
// create device and exit if creation failed // create device and exit if creation failed
MyEventReceiver receiver;
IrrlichtDevice *device; IrrlichtDevice *device;
device = createDevice(driverType, device = createDevice(driverType,
core::dimension2d<u32>(screenW, screenH), core::dimension2d<u32>(screenW, screenH),