[client] egl: add options for maximum NV level and initial level

Adds options:

 * egl:nvGain
 * egl:nvGainMax

Fixes #153
This commit is contained in:
Geoffrey McRae 2019-05-23 16:32:18 +10:00
parent 5af88ae61e
commit 3585e02993
3 changed files with 21 additions and 3 deletions

View File

@ -1 +1 @@
a12-216-g666a6a218f+1 a12-217-gf946117dac+1

View File

@ -19,6 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "desktop.h" #include "desktop.h"
#include "common/debug.h" #include "common/debug.h"
#include "common/option.h"
#include "utils.h" #include "utils.h"
#include "texture.h" #include "texture.h"
@ -63,7 +64,7 @@ struct EGL_Desktop
// night vision // night vision
KeybindHandle kbNV; KeybindHandle kbNV;
bool nv; int nvMax;
int nvGain; int nvGain;
}; };
@ -141,6 +142,9 @@ bool egl_desktop_init(EGL_Desktop ** desktop)
(*desktop)->kbNV = app_register_keybind(SDL_SCANCODE_N, egl_desktop_toggle_nv, *desktop); (*desktop)->kbNV = app_register_keybind(SDL_SCANCODE_N, egl_desktop_toggle_nv, *desktop);
(*desktop)->nvMax = option_get_int("egl", "nvGainMax");
(*desktop)->nvGain = option_get_int("egl", "nvGain" );
return true; return true;
} }
@ -148,7 +152,7 @@ bool egl_desktop_init(EGL_Desktop ** desktop)
void egl_desktop_toggle_nv(SDL_Scancode key, void * opaque) void egl_desktop_toggle_nv(SDL_Scancode key, void * opaque)
{ {
EGL_Desktop * desktop = (EGL_Desktop *)opaque; EGL_Desktop * desktop = (EGL_Desktop *)opaque;
if (++desktop->nvGain == 4) if (desktop->nvGain++ == desktop->nvMax)
desktop->nvGain = 0; desktop->nvGain = 0;
if (desktop->nvGain == 0) app_alert(LG_ALERT_INFO, "NV Disabled"); if (desktop->nvGain == 0) app_alert(LG_ALERT_INFO, "NV Disabled");

View File

@ -101,6 +101,20 @@ static struct Option egl_options[] =
.type = OPTION_TYPE_BOOL, .type = OPTION_TYPE_BOOL,
.value.x_bool = false .value.x_bool = false
}, },
{
.module = "egl",
.name = "nvGainMax",
.description = "The maximum night vision gain",
.type = OPTION_TYPE_INT,
.value.x_int = 1
},
{
.module = "egl",
.name = "nvGain",
.description = "The initial night vision gain at startup",
.type = OPTION_TYPE_INT,
.value.x_int = 0
},
{0} {0}
}; };