From: Esteban I. Ruiz Moreno Date: Wed, 26 Dec 2012 21:35:48 +0000 (-0300) Subject: Add selectionbox_color, crosshair_color, and crosshair_alpha options X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=578ece8dd03de64e1a28595b6fd32804dd589f39;p=zefram%2Fminetest%2Fminetest_engine.git Add selectionbox_color, crosshair_color, and crosshair_alpha options --- diff --git a/minetest.conf.example b/minetest.conf.example index e8099193..34a2aceb 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -124,6 +124,12 @@ #console_color = (0,0,0) # In-game chat console background alpha (opaqueness, between 0 and 255) #console_alpha = 200 +# Selection box border color (R,G,B) +#selectionbox_color = (0,0,0) +# Crosshair color (R,G,B) +#crosshair_color = (255,255,255) +# Cross alpha (opaqueness, between 0 and 255) +#crosshair_alpha = 255 # Sound settings #enable_sound = true #sound_volume = 0.7 diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 7cb78127..f9c94259 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -108,6 +108,9 @@ void set_default_settings(Settings *settings) settings->setDefault("opaque_water", "false"); settings->setDefault("console_color", "(0,0,0)"); settings->setDefault("console_alpha", "200"); + settings->setDefault("selectionbox_color", "(0,0,0)"); + settings->setDefault("crosshair_color", "(255,255,255)"); + settings->setDefault("crosshair_alpha", "255"); settings->setDefault("enable_sound", "true"); settings->setDefault("sound_volume", "0.8"); settings->setDefault("desynchronize_mapblock_texture_animation", "true"); diff --git a/src/game.cpp b/src/game.cpp index dbb71369..541127f5 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -2920,6 +2920,11 @@ void the_game( if(show_hud) { + v3f selectionbox_color = g_settings->getV3F("selectionbox_color"); + u32 selectionbox_color_r = rangelim(myround(selectionbox_color.X), 0, 255); + u32 selectionbox_color_g = rangelim(myround(selectionbox_color.Y), 0, 255); + u32 selectionbox_color_b = rangelim(myround(selectionbox_color.Z), 0, 255); + for(std::vector::const_iterator i = hilightboxes.begin(); i != hilightboxes.end(); i++) @@ -2929,7 +2934,7 @@ void the_game( <<" max=" <<"("<MaxEdge.X<<","<MaxEdge.Y<<","<MaxEdge.Z<<")" <draw3DBox(*i, video::SColor(255,0,0,0)); + driver->draw3DBox(*i, video::SColor(255,selectionbox_color_r,selectionbox_color_g,selectionbox_color_b)); } } @@ -2962,12 +2967,18 @@ void the_game( */ if(show_hud) { + v3f crosshair_color = g_settings->getV3F("crosshair_color"); + u32 crosshair_color_r = rangelim(myround(crosshair_color.X), 0, 255); + u32 crosshair_color_g = rangelim(myround(crosshair_color.Y), 0, 255); + u32 crosshair_color_b = rangelim(myround(crosshair_color.Z), 0, 255); + u32 crosshair_alpha = rangelim(g_settings->getS32("crosshair_alpha"), 0, 255); + driver->draw2DLine(displaycenter - core::vector2d(10,0), displaycenter + core::vector2d(10,0), - video::SColor(255,255,255,255)); + video::SColor(crosshair_alpha,crosshair_color_r,crosshair_color_g,crosshair_color_b)); driver->draw2DLine(displaycenter - core::vector2d(0,10), displaycenter + core::vector2d(0,10), - video::SColor(255,255,255,255)); + video::SColor(crosshair_alpha,crosshair_color_r,crosshair_color_g,crosshair_color_b)); } } // timer