leg.h

来自「一个三维打斗游戏」· C头文件 代码 · 共 100 行

H
100
字号
// (C) Copyright 1996 by Anthony J. Carin.  All Rights Reserved.

#ifndef LEG_H
#define LEG_H

#include "baseobj.h"
#include "attach.h"
#include "personal.h"

class shin;

class leg : public baseobject
{
public:

         leg(personal *p);
        ~leg();
void     setcolor(COLORREF c);
void     draw();
void     setto(view& c);
void     bendknee(float v);

private:

attachment *knee;
shin       *m_shin;

};

class foot;

class shin : public baseobject
{
public:
         shin(personal *p);
        ~shin();
void     setcolor(COLORREF c);
void     draw();
void     setto(view& c);

private:

attachment *ankle;
foot       *m_foot;

};

class foot : public baseobject
{
public:
         foot(personal *p);
        ~foot();

};

class totalleg
{
public:
         totalleg(coordinate& offset, personal *p);
        ~totalleg();
void     setto(view& c)       { legjoint->setto(c); }
void     setcolor(COLORREF c) { m_leg->setcolor(c); }
void     draw()               { legjoint->draw(); }
void     raisefoward(float v);
void     raisebackward(float v);
void     raisesideward(float v);
void     bendknee(float v);

private:
attachment *legjoint;
leg        *m_leg;
};

inline void leg::bendknee(float v)
{
    m_shin->setxposition((direction) (short)(TC_PI*v));
}

inline void totalleg::raisefoward(float v)
{
    m_leg->setxposition((direction) (-TC_PI*v));
}

inline void totalleg::raisebackward(float v)
{
    m_leg->setxposition((direction) (TC_PI*v));
}

inline void totalleg::raisesideward(float v)
{
    m_leg->setzposition((direction) (TC_PI*v));
}

inline void totalleg::bendknee(float v)
{
    m_leg->bendknee(v);
}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?