本文整理汇总了C++中Tool::GetToolID方法的典型用法代码示例。如果您正苦于以下问题:C++ Tool::GetToolID方法的具体用法?C++ Tool::GetToolID怎么用?C++ Tool::GetToolID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tool
的用法示例。
在下文中一共展示了Tool::GetToolID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void GameController::Update()
{
ui::Point pos = gameView->GetMousePosition();
gameModel->GetRenderer()->mousePos = PointTranslate(pos);
if (pos.X < XRES && pos.Y < YRES)
gameView->SetSample(gameModel->GetSimulation()->GetSample(PointTranslate(pos).X, PointTranslate(pos).Y));
else
gameView->SetSample(gameModel->GetSimulation()->GetSample(pos.X, pos.Y));
Simulation * sim = gameModel->GetSimulation();
sim->update_particles();
//if either STKM or STK2 isn't out, reset it's selected element. Defaults to PT_DUST unless right selected is something else
//This won't run if the stickmen dies in a frame, since it respawns instantly
if (!sim->player.spwn || !sim->player2.spwn)
{
int rightSelected = PT_DUST;
Tool * activeTool = gameModel->GetActiveTool(1);
if (activeTool->GetIdentifier().find("DEFAULT_PT_") != activeTool->GetIdentifier().npos)
{
int sr = activeTool->GetToolID();
if ((sr>0 && sr<PT_NUM && sim->elements[sr].Enabled && sim->elements[sr].Falldown>0) || sr==SPC_AIR || sr == PT_NEUT || sr == PT_PHOT || sr == PT_LIGH)
rightSelected = sr;
}
if (!sim->player.spwn)
sim->player.elem = rightSelected;
if (!sim->player2.spwn)
sim->player2.elem = rightSelected;
}
if(renderOptions && renderOptions->HasExited)
{
delete renderOptions;
renderOptions = NULL;
}
if(search && search->HasExited)
{
delete search;
search = NULL;
}
if(activePreview && activePreview->HasExited)
{
delete activePreview;
activePreview = NULL;
}
if(loginWindow && loginWindow->HasExited)
{
delete loginWindow;
loginWindow = NULL;
}
if(localBrowser && localBrowser->HasDone)
{
delete localBrowser;
localBrowser = NULL;
}
}
示例2: Draw
void SampleTool::Draw(Simulation * sim, Brush * brush, ui::Point position)
{
if(gameModel->GetColourSelectorVisibility())
{
pixel colour = gameModel->GetRenderer()->sampleColor;
gameModel->SetColourSelectorColour(ui::Colour(PIXR(colour), PIXG(colour), PIXB(colour), 255));
}
else
{
int particleType = 0;
int particleCtype = 0;
if (sim->photons[position.Y][position.X])
{
particleType = sim->parts[ID(sim->photons[position.Y][position.X])].type;
particleCtype = sim->parts[ID(sim->pmap[position.Y][position.X])].ctype;
}
else if (sim->pmap[position.Y][position.X])
{
particleType = sim->parts[ID(sim->pmap[position.Y][position.X])].type;
particleCtype = sim->parts[ID(sim->pmap[position.Y][position.X])].ctype;
}
if(particleType)
{
if(particleType == PT_LIFE)
{
Menu * lifeMenu = gameModel->GetMenuList()[SC_LIFE];
std::vector<Tool*> elementTools = lifeMenu->GetToolList();
for(std::vector<Tool*>::iterator iter = elementTools.begin(), end = elementTools.end(); iter != end; ++iter)
{
Tool * elementTool = *iter;
if(elementTool && ID(elementTool->GetToolID()) == particleCtype)
gameModel->SetActiveTool(0, elementTool);
}
}
else
{
Tool * elementTool = gameModel->GetElementTool(particleType);
if(elementTool)
gameModel->SetActiveTool(0, elementTool);
}
}
}
}
示例3: Update
void GameController::Update()
{
ui::Point pos = gameView->GetMousePosition();
gameModel->GetRenderer()->mousePos = PointTranslate(pos);
if (pos.X < XRES && pos.Y < YRES)
gameView->SetSample(gameModel->GetSimulation()->GetSample(PointTranslate(pos).X, PointTranslate(pos).Y));
else
gameView->SetSample(gameModel->GetSimulation()->GetSample(pos.X, pos.Y));
Simulation * sim = gameModel->GetSimulation();
sim->BeforeSim();
if (!sim->sys_pause || sim->framerender)
{
sim->UpdateParticles(0, NPART);
sim->AfterSim();
}
//if either STKM or STK2 isn't out, reset it's selected element. Defaults to PT_DUST unless right selected is something else
//This won't run if the stickmen dies in a frame, since it respawns instantly
if (!sim->player.spwn || !sim->player2.spwn)
{
int rightSelected = PT_DUST;
Tool * activeTool = gameModel->GetActiveTool(1);
if (activeTool->GetIdentifier().find("DEFAULT_PT_") != activeTool->GetIdentifier().npos)
{
int sr = activeTool->GetToolID();
if (sr && sim->IsValidElement(sr))
rightSelected = sr;
}
if (!sim->player.spwn)
Element_STKM::STKM_set_element(sim, &sim->player, rightSelected);
if (!sim->player2.spwn)
Element_STKM::STKM_set_element(sim, &sim->player2, rightSelected);
}
if(renderOptions && renderOptions->HasExited)
{
delete renderOptions;
renderOptions = NULL;
}
if(search && search->HasExited)
{
delete search;
search = NULL;
}
if(activePreview && activePreview->HasExited)
{
delete activePreview;
activePreview = NULL;
}
if(loginWindow && loginWindow->HasExited)
{
delete loginWindow;
loginWindow = NULL;
}
if(localBrowser && localBrowser->HasDone)
{
delete localBrowser;
localBrowser = NULL;
}
}