本文整理汇总了C++中Controller::dragSlider方法的典型用法代码示例。如果您正苦于以下问题:C++ Controller::dragSlider方法的具体用法?C++ Controller::dragSlider怎么用?C++ Controller::dragSlider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::dragSlider方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MouseButtonCallback
//.........这里部分代码省略.........
default: ;
break;
}
}
// if clicked outside the canvas
} else {
Button* b = PolyFun->getButton(x,y);
Slider* s = PolyFun->getSlider(x,y);
if(mouseEvent == GLFW_PRESS){
switch(button){
case GLFW_MOUSE_BUTTON_LEFT:
if(b != NULL){
if(b->getName() == "penTool"){
if(b->activated()){
// deactivate the activated button by clicking on it again
std::cout << b->getName() << " has been deactivated" << std::endl;
b->setActivation(false);
PolyFun->deselectAllPolygons(); // reset selection of all polygons
} else {
// activate the pen tool and deactivate the eraser
if(PolyFun->getButton("eraser") != NULL) PolyFun->getButton("eraser")->setActivation(false);
b->setActivation(true);
std::cout << b->getName() << " has been activated" << std::endl;
if(PolyFun->getSelectedPolygon() == NULL) PolyFun->newPolygon(PolyFun->colour.r, PolyFun->colour.g, PolyFun->colour.b, PolyFun->hardness, PolyFun->drawingMode, PolyFun->polygonWidth);
};
} else if(b->getName() == "eraser"){
if(b->activated()){
PolyFun->deselectAllPolygons(); // reset selection of all polygons
// deactivate the activated button by clicking on it again
b->setActivation(false);
std::cout << b->getName() << " has been deactivated" << std::endl;
} else {
// activate the eraser and deactivate the pen tool
if(PolyFun->getButton("penTool") != NULL) PolyFun->getButton("penTool")->setActivation(false);
b->setActivation(true);
std::cout << b->getName() << " has been activated" << std::endl;
};
} else if(b->getName() == "lineStrip"){
std::cout << b->getName() << " has been activated" << std::endl;
// deactivate other mode buttons
if(PolyFun->getButton("lineLoop") != NULL) PolyFun->getButton("lineLoop")->setActivation(false);
if(PolyFun->getButton("filledPolygon") != NULL) PolyFun->getButton("filledPolygon")->setActivation(false);
b->setActivation(true);
PolyFun->setDrawingMode(Polytope2D::LINE);
} else if(b->getName() == "lineLoop"){
std::cout << b->getName() << " has been activated" << std::endl;
// deactivate other mode buttons
if(PolyFun->getButton("lineStrip") != NULL) PolyFun->getButton("lineStrip")->setActivation(false);
if(PolyFun->getButton("filledPolygon") != NULL) PolyFun->getButton("filledPolygon")->setActivation(false);
b->setActivation(true);
PolyFun->setDrawingMode(Polytope2D::LINELOOP);
} else if(b->getName() == "filledPolygon"){
std::cout << b->getName() << " has been activated" << std::endl;
// deactivate other mode buttons
if(PolyFun->getButton("lineStrip") != NULL) PolyFun->getButton("lineStrip")->setActivation(false);
if(PolyFun->getButton("lineLoop") != NULL) PolyFun->getButton("lineLoop")->setActivation(false);
b->setActivation(true);
PolyFun->setDrawingMode(Polytope2D::POLYGON);
} else if(b->getName() == "hardness"){
std::cout << b->getName() << " has been activated" << std::endl;
// deactivate other mode buttons
if(PolyFun->getButton("smoothness") != NULL) PolyFun->getButton("smoothness")->setActivation(false);
b->setActivation(true);
PolyFun->setHardness(Polytope2D::HARD);
} else if(b->getName() == "smoothness"){
std::cout << b->getName() << " has been activated" << std::endl;
// deactivate other mode buttons
if(PolyFun->getButton("hardness") != NULL) PolyFun->getButton("hardness")->setActivation(false);
b->setActivation(true);
PolyFun->setHardness(Polytope2D::SMOOTH);
} else if(b->getName() == "colours" && !(b->activated())){
b->setActivation(true);
std::cout << b->getName() << " has been activated" << std::endl;
glfwSetMousePosCallback(MousePosCallback);
};
PolyFun->updateWindow();
} else if(s != NULL){
PolyFun->dragSlider(x,y);
};
break;
default: ;
break;
}
} else if(mouseEvent == GLFW_RELEASE){
switch(button){
case GLFW_MOUSE_BUTTON_LEFT: PolyFun->releaseSlider();
break;
default: ;
break;
}
if(PolyFun->getButton("colours") != NULL && PolyFun->getButton("colours")->activated()){
PolyFun->getButton("colours")->setActivation(false);
std::cout << "colours has been deactivated" << std::endl;
}
}
}
} catch(...){
throw eFileNotFoundException();
}
}