本文整理汇总了C++中BezierCurve::addControlPoint2dWithHandles方法的典型用法代码示例。如果您正苦于以下问题:C++ BezierCurve::addControlPoint2dWithHandles方法的具体用法?C++ BezierCurve::addControlPoint2dWithHandles怎么用?C++ BezierCurve::addControlPoint2dWithHandles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BezierCurve
的用法示例。
在下文中一共展示了BezierCurve::addControlPoint2dWithHandles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleEvent
void CurveEditor::handleEvent(Event *event) {
if(mode == MODE_ADD) {
if(event->getDispatcher() == bg) {
if(event->getEventCode() == InputEvent::EVENT_MOUSEDOWN) {
InputEvent *inputEvent = (InputEvent*)event;
if(selectedCurve) {
Vector2 pos = inputEvent->mousePosition;
pos.x = pos.x/610.0;
pos.y = 1.0-(pos.y/254.0);
BezierCurve *targetCurve = selectedCurve->targetCurve;
bool done = false;
for(int i=0; i < targetCurve->getNumControlPoints(); i++) {
if(pos.x < targetCurve->getControlPoint(i)->p2.x && !done) {
targetCurve->insertPoint = targetCurve->getControlPoint(i);
done = true;
}
}
targetCurve->addControlPoint2dWithHandles(pos.x-0.1, pos.y, pos.x, pos.y, pos.x + 0.1, pos.y);
selectedCurve->updatePoints();
selectedCurve->updateCurve();
}
}
}
}
if(event->getDispatcher() == selectButton) {
selectorImage->setPosition(selectButton->getPosition().x - 4, selectButton->getPosition().y - 4);
setMode(0);
}
if(event->getDispatcher() == addButton) {
selectorImage->setPosition(addButton->getPosition().x - 4, addButton->getPosition().y - 4);
setMode(1);
}
if(event->getDispatcher() == removeButton) {
selectorImage->setPosition(removeButton->getPosition().x - 4, removeButton->getPosition().y - 4);
setMode(2);
}
if(event->getDispatcher() == treeContainer->getRootNode()) {
if(event->getEventCode() == UITreeEvent::SELECTED_EVENT) {
EditCurve *curve = (EditCurve *)treeContainer->getRootNode()->getSelectedNode()->getUserData();
if(selectedCurve) {
selectedCurve->Deactivate();
}
selectedCurve = curve;
if(curve) {
curve->Activate();
curve->setMode(mode);
}
}
}
UIWindow::handleEvent(event);
}