本文整理汇总了C++中Tool::DrawLine方法的典型用法代码示例。如果您正苦于以下问题:C++ Tool::DrawLine方法的具体用法?C++ Tool::DrawLine怎么用?C++ Tool::DrawLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tool
的用法示例。
在下文中一共展示了Tool::DrawLine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawLine
void GameController::DrawLine(int toolSelection, ui::Point point1, ui::Point point2)
{
Simulation * sim = gameModel->GetSimulation();
Tool * activeTool = gameModel->GetActiveTool(toolSelection);
gameModel->SetLastTool(activeTool);
Brush * cBrush = gameModel->GetBrush();
if(!activeTool || !cBrush)
return;
activeTool->SetStrength(gameModel->GetToolStrength());
activeTool->DrawLine(sim, cBrush, point1, point2);
}
示例2: DrawPoints
void GameController::DrawPoints(int toolSelection, ui::Point oldPos, ui::Point newPos, bool held)
{
Simulation * sim = gameModel->GetSimulation();
Tool * activeTool = gameModel->GetActiveTool(toolSelection);
gameModel->SetLastTool(activeTool);
Brush * cBrush = gameModel->GetBrush();
if (!activeTool || !cBrush)
{
return;
}
activeTool->SetStrength(gameModel->GetToolStrength());
if (!held)
activeTool->Draw(sim, cBrush, newPos);
else
activeTool->DrawLine(sim, cBrush, oldPos, newPos, true);
}
示例3: DrawPoints
void GameController::DrawPoints(int toolSelection, queue<ui::Point> & pointQueue)
{
Simulation * sim = gameModel->GetSimulation();
Tool * activeTool = gameModel->GetActiveTool(toolSelection);
gameModel->SetLastTool(activeTool);
Brush * cBrush = gameModel->GetBrush();
if(!activeTool || !cBrush)
{
if(!pointQueue.empty())
{
while(!pointQueue.empty())
{
pointQueue.pop();
}
}
return;
}
activeTool->SetStrength(gameModel->GetToolStrength());
if(!pointQueue.empty())
{
ui::Point sPoint(0, 0);
int size = pointQueue.size();
bool first = true;
while(!pointQueue.empty())
{
ui::Point fPoint = pointQueue.front();
pointQueue.pop();
if(size > 1)
{
if (!first)
{
activeTool->DrawLine(sim, cBrush, sPoint, fPoint, true);
}
first = false;
}
else
{
activeTool->Draw(sim, cBrush, fPoint);
}
sPoint = fPoint;
}
}
}