linedrawer.cpp
来自「这是整套横扫千军3D版游戏的源码」· C++ 代码 · 共 34 行
CPP
34 行
#include "StdAfx.h"
#include "LineDrawer.h"
#include "Game/UI/CommandColors.h"
CLineDrawer lineDrawer;
CLineDrawer::CLineDrawer()
{
stippleTimer = 0.0f;
}
void CLineDrawer::UpdateLineStipple()
{
stippleTimer += (gu->lastFrameTime * cmdColors.StippleSpeed());
stippleTimer = fmodf(stippleTimer, (16.0f / 20.0f));
}
void CLineDrawer::SetupLineStipple()
{
const unsigned int stipPat = (0xffff & cmdColors.StipplePattern());
if ((stipPat != 0x0000) && (stipPat != 0xffff)) {
lineStipple = true;
} else {
lineStipple = false;
return;
}
const unsigned int fullPat = (stipPat << 16) | (stipPat & 0x0000ffff);
const int shiftBits = 15 - (int(stippleTimer * 20.0f) % 16);
glLineStipple(cmdColors.StippleFactor(), (fullPat >> shiftBits));
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?