本文整理汇总了C++中Squad::checkSelectionColour方法的典型用法代码示例。如果您正苦于以下问题:C++ Squad::checkSelectionColour方法的具体用法?C++ Squad::checkSelectionColour怎么用?C++ Squad::checkSelectionColour使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Squad
的用法示例。
在下文中一共展示了Squad::checkSelectionColour方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doSelection
//----------------------------------------------------------------------------------------------------------------------
void NGLDraw::doSelection(const int _x, const int _y)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
int numberOfSquads = m_gameworld->getSquads().size();
for(int i=0; i < numberOfSquads; i++)
{
Squad* currentSquad = m_gameworld->getSquads()[i];
currentSquad->selectionDraw(m_cam, m_mouseGlobalTX);
currentSquad->setSquadDrawColour(currentSquad->getSquadColour());
}
ngl::Vec3 pixel;
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
glReadPixels(_x, viewport[3] - _y , 1, 1, GL_RGB, GL_FLOAT, &pixel);
bool newSelection = false;
for(int i=0; i < numberOfSquads; i++)
{
Squad* currentSquad = m_gameworld->getSquads()[i];
if(currentSquad->checkSelectionColour(pixel) == true)
{
currentSquad->setSquadDrawColour(currentSquad->getSquadSelectedColour());
//set selected squad colour
if(m_selected == true)
{
m_selected = true;
m_selectedSquad = currentSquad;
m_selectedSquadID = currentSquad->getID();
newSelection = true;
break;
}
else
{
m_selected = true;
m_selectedSquad = currentSquad;
m_selectedSquadID = currentSquad->getID();
newSelection = true;
break;
}
}
}
if(newSelection == false && m_selected == true)
{
doMovement(_x, _y);
m_selected = false;
m_selectedSquad= NULL;
}
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}