#include "config.h" #include "joint.h" class World { private: static float gravity; static float elasticity; static float friction; static float width; static float height; static float spring_k; static float mass; static int copy_joints; static Joint **copy; static Joint **structure; static int joints; static int maxjoints; static int joint_offset; public: static float Gravity() { return gravity; } static float Gravity(float g) { return joint_offset ? gravity : gravity=Joint::Gravity(g); } static float Elasticity() { return elasticity; } static float Elasticity(float e){ return joint_offset ? elasticity : elasticity=e; } static float Friction() { return friction; } static float Friction(float f) { return friction=f; } static float Width() { return width; } static float Width(float w) { return width=Joint::WorldWidth(w);} static float Height() { return height; } static float Height(float h) { return height=h; } static float SpringK() { return spring_k; } static float SpringK(float k) { return joint_offset ? spring_k : spring_k=Spring::K(k); } static float Mass() { return mass; } static float Mass(float m) { return joint_offset ? mass : mass=Joint::Mass(m); } static int Joints() { return joints; } static Joint *Joints(int i) { return structure[i]; } static int MaxJoints() { return maxjoints; } static void InitJoints(int count); static void AddJoint(float nx, float ny, int fixed); static void RemoveJoint(int joint); static void AddSpring(int from, int to); static void AddMuscle(int from, int to, float freq, float amp, float ofs); static void Load(const char *filename); static void Include(const char *filename); static void Save(const char *filename); };