www.pudn.com > airhockey.rar > player.h
#ifndef __PLAYER_H #define __PLAYER_H #include#include #include #include #include #include #include #include "object.h" #include "vector.h" #include "table.h" #include "puck.h" static float playerData[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.8, 1.0 }, { 0.3827, 0.8, 0.9239 }, { 0.7071, 0.8, 0.7071 }, { 0.9239, 0.8, 0.3827 }, { 1.0, 0.8, 0.0 }, { 0.9239, 0.8, -0.3827 }, { 0.7071, 0.8, -0.7071 }, { 0.3827, 0.8, -0.9239 }, { 0.0, 0.8, -1.0 }, { -0.3827, 0.8, -0.9239 }, { -0.7071, 0.8, -0.7071 }, { -0.9239, 0.8, -0.3827 }, { -1.0, 0.8, 0.0 }, { -0.9237, 0.8, 0.3827 }, { -0.7071, 0.8, 0.7071 }, { -0.3827, 0.8, 0.9239 } }; class CPlayer : public CObject { private: float radius; int oldMouseX; int oldMouseY; public: CPlayer() { acceleration = CVector(0.0, 0.0, 0.0); velocity = CVector(0.0, 0.0, 0.0); position = CVector(150.0, 0.0, -110.0); oldMouseX = 0; oldMouseY = 0; radius = size = 10.0; } ~CPlayer() {} void Draw(); void Load(); void Unload(); void Animate(scalar_t deltaTime); void Move(scalar_t deltaTime, int mouseX, int mouseY, CTable *table, CPuck *puck); }; #endif