⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 leg.cpp

📁 一个三维打斗游戏
💻 CPP
字号:
// (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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -