libgoatvr

diff src/vr.c @ 12:b536bd21b37f

added vr_get_def functions
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 24 Sep 2014 23:50:40 +0300
parents 34d4643d61f9
children 27fcd4c2969d
line diff
     1.1 --- a/src/vr.c	Wed Sep 24 10:18:42 2014 +0300
     1.2 +++ b/src/vr.c	Wed Sep 24 23:50:40 2014 +0300
     1.3 @@ -153,6 +153,29 @@
     1.4  	return res;
     1.5  }
     1.6  
     1.7 +int vr_geti_def(const char *optname, int def_val)
     1.8 +{
     1.9 +	int res = 0;
    1.10 +
    1.11 +	if(!vrm || !vrm->get_option || vrm->get_option(optname, OTYPE_INT, &res) == -1) {
    1.12 +		if(get_option_int(defopt, optname, &res) == -1) {	/* fallback */
    1.13 +			return def_val;
    1.14 +		}
    1.15 +	}
    1.16 +	return res;
    1.17 +}
    1.18 +
    1.19 +float vr_getf_def(const char *optname, float def_val)
    1.20 +{
    1.21 +	float res = 0.0f;
    1.22 +
    1.23 +	if(!vrm || !vrm->get_option || vrm->get_option(optname, OTYPE_FLOAT, &res) == -1) {
    1.24 +		if(get_option_float(defopt, optname, &res) == -1) {	/* fallback */
    1.25 +			return def_val;
    1.26 +		}
    1.27 +	}
    1.28 +	return res;
    1.29 +}
    1.30  
    1.31  int vr_view_translation(int eye, float *vec)
    1.32  {