diff options
author | Ian C <ianc@noddybox.co.uk> | 2010-08-18 14:38:34 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2010-08-18 14:38:34 +0000 |
commit | 19bbd5822593c7198dd54eb0f5d38fa1ed8d8fb7 (patch) | |
tree | 97f7f8849c3a8282ba571a64ff2a655cdf5d41aa /config.h | |
parent | 0d2f672482fee91a9642a7cb6eb01fcdded79159 (diff) |
Reformatted code and altered the attraction rule to something a bit more
correct. Also added two tests to prove it works.
Diffstat (limited to 'config.h')
-rw-r--r-- | config.h | 212 |
1 files changed, 109 insertions, 103 deletions
@@ -32,142 +32,148 @@ #include "mass.h" class Config - { - public: - enum Flag {solid, lighting, texture, fog, num_flags}; - enum Collide {none, merge, delta_merge, shatter}; +{ +public: + enum Flag {solid, lighting, texture, fog, num_flags}; + enum Collide {none, merge, delta_merge, shatter}; - Config(); - virtual ~Config(); + Config(); + virtual ~Config(); - // Note that the vector is added to. It must be cleared beforehand - // if required. - // - bool read(const string& file, vector<Mass>& mass); + // Note that the vector is added to. It must be cleared beforehand + // if required. + // + bool read(const string& file, vector<Mass>& mass); - void getCamera(GLfloat& x, GLfloat& y, GLfloat& z, GLfloat& yaw) const; + void getCamera(GLfloat& x, GLfloat& y, GLfloat& z, GLfloat& yaw) const; - bool enabled(Flag flag) const; - Collide collide() const; - string light(GLfloat v[4]) const; - double gravConst() const; - double scale() const; + bool enabled(Flag flag) const; + Collide collide() const; + string light(GLfloat v[4]) const; + double gravConst() const; + double scale() const; - void windowSize(int& w,int& h) const; + void windowSize(int& w,int& h) const; - void getShatter(int& num, double& delta, - double& min_mass, double& max_mass, - int& shield) const; + void getShatter(int& num, double& delta, + double& min_mass, double& max_mass, + int& shield) const; - bool sparksDefined() const; + bool sparksDefined() const; - void getSparks(int& num, GLfloat& alpha_dec, GLfloat& alpha_min, - int& length, GLfloat& delta) const; + void getSparks(int& num, GLfloat& alpha_dec, GLfloat& alpha_min, + int& length, GLfloat& delta) const; - size_t maxMass() const; + size_t maxMass() const; - // Args set to -1 if undefined - // - void getLookAndTravel(int& look, int &travel) const; + // Args set to -1 if undefined + // + void getLookAndTravel(int& look, int &travel) const; - bool particlesDefined() const; + bool particlesDefined() const; - void getParticles(GLfloat& alpha_dec, GLfloat& alpha_min, - GLfloat& size) const; + void getParticles(GLfloat& alpha_dec, GLfloat& alpha_min, + GLfloat& size) const; - void getFog(GLfloat& dist, GLfloat& r, GLfloat& g, GLfloat& b, - bool& fog_light); + void getFog(GLfloat& dist, GLfloat& r, GLfloat& g, GLfloat& b, + bool& fog_light); - void look(vector<string>& l) const; + void look(vector<string>& l) const; - string error() const; + string error() const; - private: - enum Plane {xy_plane, xz_plane, yz_plane}; +private: + enum Plane {xy_plane, xz_plane, yz_plane}; - Plane m_plane; + Plane m_plane; - string m_error; - bool m_flag[num_flags]; - Collide m_collide; - double m_const; - GLfloat m_x,m_y,m_z,m_pitch,m_yaw; + string m_error; + bool m_flag[num_flags]; + Collide m_collide; + double m_const; + GLfloat m_x; + GLfloat m_y; + GLfloat m_z; + GLfloat m_pitch; + GLfloat m_yaw; - double m_scale; + double m_scale; - string m_light; - GLfloat m_lr,m_lg,m_lb; + string m_light; + GLfloat m_lr; + GLfloat m_lg; + GLfloat m_lb; - vector<string> m_look; - int m_look_at; - int m_travel_as; + vector<string> m_look; + int m_look_at; + int m_travel_as; - bool m_particles; - GLfloat m_p_adec; - GLfloat m_p_amin; - GLfloat m_p_size; + bool m_particles; + GLfloat m_p_adec; + GLfloat m_p_amin; + GLfloat m_p_size; - GLuint *m_glid; - int m_glid_no; - int m_glid_idx; + GLuint *m_glid; + int m_glid_no; + int m_glid_idx; - int m_s_no; - double m_s_delta; - double m_s_min; - double m_s_max; - int m_s_shield; + int m_s_no; + double m_s_delta; + double m_s_min; + double m_s_max; + int m_s_shield; - bool m_sparks; - int m_sp_no; - GLfloat m_sp_adec; - GLfloat m_sp_amin; - int m_sp_length; - GLfloat m_sp_delta; + bool m_sparks; + int m_sp_no; + GLfloat m_sp_adec; + GLfloat m_sp_amin; + int m_sp_length; + GLfloat m_sp_delta; - int m_winw; - int m_winh; + int m_winw; + int m_winh; - size_t m_max_mass; + size_t m_max_mass; - GLfloat m_fog_dist; - GLfloat m_fog_r; - GLfloat m_fog_g; - GLfloat m_fog_b; - bool m_fog_light; + GLfloat m_fog_dist; + GLfloat m_fog_r; + GLfloat m_fog_g; + GLfloat m_fog_b; + bool m_fog_light; - enum Command {enable_cmd, disable_cmd, collide_cmd, const_cmd, - body_cmd, radial_cmd, light_cmd, camera_cmd, look_cmd, - texture_cmd, num_texture_cmd, reuse_cmd, particles_cmd, - shatter_cmd, multiple_cmd, mreuse_cmd, plane_cmd, - scale_cmd, look_at_cmd, travel_as_cmd, window_size_cmd, - sparks_cmd, max_mass_cmd, mlook_cmd, - ring_cmd, mring_cmd, ring_texture_cmd, ring_reuse_cmd, - ring_mreuse_cmd, fog_cmd, - cmd_eof, cmd_error}; + enum Command {enable_cmd, disable_cmd, collide_cmd, const_cmd, + body_cmd, radial_cmd, light_cmd, camera_cmd, look_cmd, + texture_cmd, num_texture_cmd, reuse_cmd, particles_cmd, + shatter_cmd, multiple_cmd, mreuse_cmd, plane_cmd, + scale_cmd, look_at_cmd, travel_as_cmd, window_size_cmd, + sparks_cmd, max_mass_cmd, mlook_cmd, + ring_cmd, mring_cmd, ring_texture_cmd, ring_reuse_cmd, + ring_mreuse_cmd, fog_cmd, + cmd_eof, cmd_error}; - enum GetWordStatus {GWOK, GWEof, GWSyntax, - GWTooFewArgs, GWTooManyArgs}; + enum GetWordStatus {GWOK, GWEof, GWSyntax, + GWTooFewArgs, GWTooManyArgs}; - bool CompareNoCase(const string& s1, const string& s2); - GetWordStatus getWord(ifstream& fp, string& word, - const string& ignore, const string& term); - bool getCommand(ifstream& fp, Command& cmd, vector<string>& val); + bool CompareNoCase(const string& s1, const string& s2); + GetWordStatus getWord(ifstream& fp, string& word, + const string& ignore, const string& term); + bool getCommand(ifstream& fp, Command& cmd, vector<string>& val); - void genRadial(Mass **newMass, const Mass& parent, - const string& name, double mass, - double dist, double ang, double spd, - GLfloat r, GLfloat g, GLfloat b, double rot); + void genRadial(Mass **newMass, const Mass& parent, + const string& name, double mass, + double dist, double ang, double spd, + GLfloat r, GLfloat g, GLfloat b, double rot); - double toDouble(const string& s); - GLfloat toGLfloat(const string& s); - int toInt(const string& s); - size_t toSize(const string& s); - bool toYesNo(const string& s); - - bool bindTexture(const string& name, int w, int h, GLuint id); - - string makeName(string& name, int no); - }; + double toDouble(const string& s); + GLfloat toGLfloat(const string& s); + int toInt(const string& s); + size_t toSize(const string& s); + bool toYesNo(const string& s); + + bool bindTexture(const string& name, int w, int h, GLuint id); + + string makeName(string& name, int no); +}; #endif |