vrheights
diff src/game_var.h @ 7:0eca023ed909
- fixed the hmd-tracking / mouselook interaction
- added game variable system
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 01 Oct 2014 01:06:55 +0300 |
parents | |
children | 537db3079134 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/game_var.h Wed Oct 01 01:06:55 2014 +0300 1.3 @@ -0,0 +1,32 @@ 1.4 +#ifndef GAME_VAR_H_ 1.5 +#define GAME_VAR_H_ 1.6 + 1.7 +#include <string> 1.8 +#include <list> 1.9 + 1.10 +struct GameVariable { 1.11 + enum { NUMBER, BOOL, STR } type; 1.12 + std::string name, val; 1.13 + float num_val; 1.14 + bool bool_val; 1.15 + 1.16 + GameVariable(); 1.17 + std::string to_str() const; 1.18 +}; 1.19 + 1.20 +void set_gvar(const GameVariable &var); 1.21 +void set_gvar_str(const char *name, const char *val); 1.22 +void set_gvar_num(const char *name, float val); 1.23 +void set_gvar_bool(const char *name, bool val); 1.24 +void set_gvar_parse(const char *name, const char *val); 1.25 + 1.26 +GameVariable &get_gvar(const char *name); 1.27 +const char *get_gvar_str(const char *name); 1.28 +float get_gvar_num(const char *name); 1.29 +bool get_gvar_bool(const char *name); 1.30 + 1.31 +bool have_gvar(const char *name); 1.32 + 1.33 +std::list<std::string> get_gvar_list(); 1.34 + 1.35 +#endif // GAME_VAR_H_ 1.36 \ No newline at end of file