www.pudn.com > airhockey.rar > puck.h
#ifndef __PUCK_H #define __PUCK_H #include#include #include #include #include #include #include #include "object.h" #include "vector.h" #include "table.h" // data points for puck static float puckData[32][3] = // bottom points { { 0.0, 0.01, 1.0 }, { 0.3827, 0.01, 0.9239 }, { 0.7071, 0.01, 0.7071 }, { 0.9239, 0.01, 0.3827 }, { 1.0, 0.01, 0.0 }, { 0.9239, 0.01, -0.3827 }, { 0.7071, 0.01, -0.7071 }, { 0.3827, 0.01, -0.9239 }, { 0.0, 0.01, -1.0 }, { -0.3827, 0.01, -0.9239 }, { -0.7071, 0.01, -0.7071 }, { -0.9239, 0.01, -0.3827 }, { -1.0, 0.01, 0.0 }, { -0.9237, 0.01, 0.3827 }, { -0.7071, 0.01, 0.7071 }, { -0.3827, 0.01, 0.9239 }, // top points { 0.0, 0.07, 1.0 }, { 0.3827, 0.07, 0.9239 }, { 0.7071, 0.07, 0.7071 }, { 0.9239, 0.07, 0.3827 }, { 1.0, 0.07, 0.0 }, { 0.9239, 0.07, -0.3827 }, { 0.7071, 0.07, -0.7071 }, { 0.3827, 0.07, -0.9239 }, { 0.0, 0.07, -1.0 }, { -0.3827, 0.07, -0.9239 }, { -0.7071, 0.07, -0.7071 }, { -0.9239, 0.07, -0.3827 }, { -1.0, 0.07, 0.0 }, { -0.9237, 0.07, 0.3827 }, { -0.7071, 0.07, 0.7071 }, { -0.3827, 0.07, 0.9239 } }; class CPuck : public CObject { private: float radius; // puck radius public: CPuck() { acceleration = CVector(0.0, 0.0, 0.0); velocity = CVector(50.0, 0.0, 100.0); position = CVector(150.0, 0.0, -200.0); radius = 10.0; size = radius; } CPuck(float r) { radius = r; size = r; acceleration = CVector(0.0, 0.0, 0.0); velocity = CVector(50.0, 0.0, 100.0); position = CVector(150.0, 0.5, -200.0); } ~CPuck() {} void Load(); void Unload(); void Draw(); void Animate(scalar_t deltaTime); void Animate(scalar_t deltaTime, CTable *table); }; #endif