📄 player.h
字号:
#ifndef __PLAYER_H
#define __PLAYER_H
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <gl/glaux.h>
#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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -