leg.cpp

来自「一个三维打斗游戏」· C++ 代码 · 共 97 行

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

#include "stdafx.h"
#include "leg.h"


leg::leg(personal *p) : baseobject(p->thigh())
{
   coordinate tmp(0.0f,-0.5f*p->hight(),0.0f);
   knee    = new attachment(tmp);
   m_shin  = new shin(p);
   knee->attachto(m_shin);
}

leg::~leg()
{
   delete knee;
   delete m_shin;
}

void leg::setcolor(COLORREF c)
{
   baseobject::setcolor(c);
   m_shin->setcolor(c);
}

void leg::draw()
{
   baseobject::draw();
   knee->draw();
}

void leg::setto(view& c)
{
   baseobject::setto(c);
   knee->setxoff(xposition);
   knee->setyoff(yposition);
   knee->setzoff(zposition);
   knee->setto(c);
}

shin::shin(personal *p) : baseobject(p->lowerleg())
{
   coordinate tmp(0.0f,-0.5f*p->hight(),0.0f);
   ankle    = new attachment(tmp);
   m_foot  = new foot(p);
   ankle->attachto(m_foot);
}

shin::~shin()
{
   delete ankle;
   delete m_foot;
}

void shin::setcolor(COLORREF c)
{
   baseobject::setcolor(c);
}

void shin::draw()
{
   baseobject::draw();
   ankle->draw();
}

void shin::setto(view& c)
{
   baseobject::setto(c);
   ankle->setxoff(xposition);
   ankle->setyoff(yposition);
   ankle->setzoff(zposition);
   ankle->setto(c);
}

foot::foot(personal *p) : baseobject(p->foot())
{
    setcolor(RGB(10,10,10));
}

foot::~foot()
{
}

totalleg::totalleg(coordinate& offset, personal *p)
{
   legjoint = new attachment(offset);
   m_leg    = new leg(p);
   legjoint->attachto(m_leg);
}

totalleg::~totalleg()
{
   delete m_leg;
   delete legjoint;
}

⌨️ 快捷键说明

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