本文整理汇总了C++中Output::FlushKeyQueue方法的典型用法代码示例。如果您正苦于以下问题:C++ Output::FlushKeyQueue方法的具体用法?C++ Output::FlushKeyQueue怎么用?C++ Output::FlushKeyQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Output
的用法示例。
在下文中一共展示了Output::FlushKeyQueue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MoveDest
bool Select::MoveDest(Connection * Comp)
{
//Get a Pointer to the Input / Output Interfaces
Output* pOut = pManager->GetOutput();
Input* pIn = pManager->GetInput();
pOut->FlushKeyQueue();
pOut->ClearStatusBar();
//Print Action Message
pOut->PrintMsg("Changing the Destination Pin press Escape to cansel");
pOut->UpdateBuffer();
int Cx = 0, Cy = 0;
GraphicsInfo GInfo;
GInfo.x1 = Comp->get_GraphicInfo().x1;
GInfo.y1 = Comp->get_GraphicInfo().y1;
GInfo.x2 = Comp->get_GraphicInfo().x2;
GInfo.y2 = Comp->get_GraphicInfo().y2;
bool check = false;
do {
if (pIn->GetKeyPressed() == ESCAPE)
return false;
if (pIn->GetPointClicked(Cx, Cy) == LEFT_CLICK && (pManager->GetArr()[Cy][Cx]) != NULL)
{
if (pManager->GetArr()[Cy][Cx]->GetInputPinCoordinates(make_pair(Cx, Cy)) != NULL) {
GInfo.x2 = (pManager->GetArr()[Cy][Cx])->GetInputPinCoordinates(make_pair(Cx, Cy))->first;
GInfo.y2 = (pManager->GetArr()[Cy][Cx])->GetInputPinCoordinates(make_pair(Cx, Cy))->second;
break;
}
else
{
pOut->ClearStatusBar();
pOut->PrintMsg("You choosed an invalid Component, please choose a Gate or Led ");
pOut->UpdateBuffer();
}
}
} while (true);
if (check) {
Comp->EraseConnections(pManager);
pManager->GetArr()[GInfo.y1][GInfo.x1 - 15]->GetOutputPin()->ConnectTo(Comp);
pManager->GetArr()[GInfo.y2][GInfo.x2]->GetInputPin(make_pair(GInfo.x2, GInfo.y2))->set_connection(Comp);
if (bfs(GInfo.x1, GInfo.y1, GInfo.x2, GInfo.y2, pManager->GetArr(), Comp->get_path()))
Comp->set_GraphicInfo(GInfo);
GInfo.x1 = Comp->get_GraphicInfo().x1;
GInfo.y1 = Comp->get_GraphicInfo().y1;
GInfo.x2 = Comp->get_GraphicInfo().x2;
GInfo.y2 = Comp->get_GraphicInfo().y2;
pManager->GetArr()[GInfo.y1][GInfo.x1 - 15]->GetOutputPin()->ConnectTo(Comp);
pManager->GetArr()[GInfo.y2][GInfo.x2]->GetInputPin(make_pair(GInfo.x2, GInfo.y2))->set_connection(Comp);
return true;
}
return false;
}
示例2: ReadActionParameters
bool AddConnection::ReadActionParameters()
{
//Get a Pointer to the Input / Output Interfaces
Output* pOut = pManager->GetOutput();
Input* pIn = pManager->GetInput();
pOut->FlushKeyQueue();
pOut->ClearStatusBar();
//Print Action Message
pOut->PrintMsg("Adding Connection : Click to add the first edge ");
pOut->UpdateBuffer();
if ( pManager->GetComponent( UI.u_GfxInfo.x1 , UI.u_GfxInfo.y1 )==NULL)
do {
if (pIn->GetKeyPressed() == ESCAPE)
return false;
if (pIn->GetPointClicked(Cx, Cy) == LEFT_CLICK&& (pManager->GetArr()[Cy][Cx])!=NULL) {
if (((pManager->GetArr()[Cy][Cx])->GetOutputPinCoordinates().first != 0
&& (pManager->GetArr()[Cy][Cx])->GetOutputPinCoordinates().second != 0)) {
GInfo.x1 = (pManager->GetArr()[Cy][Cx])->GetOutputPinCoordinates().first;
GInfo.y1 = (pManager->GetArr()[Cy][Cx])->GetOutputPinCoordinates().second;
break;
}
else {
pOut->ClearStatusBar();
pOut->PrintMsg("Please choose a vaild Gate or Switch ");
pOut->UpdateBuffer();
}
}
} while (true);
else
{
GInfo.x1 = (pManager->GetComponent( UI.u_GfxInfo.x1,UI.u_GfxInfo.y1))->GetOutputPinCoordinates( ).first;
GInfo.y1 = (pManager->GetComponent(UI.u_GfxInfo.x1,UI.u_GfxInfo.y1))->GetOutputPinCoordinates( ).second;
}
pOut->ClearStatusBar();
pOut->PrintMsg("Adding Connection : Click to add the second edge ");
pOut->UpdateBuffer();
do {
if (pIn->GetKeyPressed() == ESCAPE)
return false;
if (pIn->GetPointClicked(Cx, Cy) == LEFT_CLICK && (pManager->GetArr()[Cy][Cx]) != NULL)
{
pOut->Magnetize(Cx, Cy);
if (pManager->GetArr()[Cy][Cx]->GetInputPinCoordinates(make_pair(Cx, Cy)) != NULL) {
GInfo.x2 = (pManager->GetComponent( Cx , Cy ))->GetInputPinCoordinates( make_pair( Cx , Cy ) )->first;
GInfo.y2 = (pManager->GetComponent( Cx , Cy ))->GetInputPinCoordinates( make_pair( Cx , Cy ) )->second;
break;
}
else
{
pOut->ClearStatusBar();
pOut->PrintMsg("You choosed an invalid Component, please choose a Gate or Led !!");
pOut->UpdateBuffer();
}
}
} while (true);
bfs(GInfo.x1, GInfo.y1, GInfo.x2, GInfo.y2, pManager->GetArr(), outx);
if (outx.check)
return true;
else {
pManager->GetOutput()->ClearStatusBar();
pManager->GetOutput()->PrintMsg("There is no valid path");
pManager->GetOutput()->UpdateBuffer();
return false;
}
}