当前位置: 首页>>代码示例>>C++>>正文


C++ Point2D::getTime方法代码示例

本文整理汇总了C++中Point2D::getTime方法的典型用法代码示例。如果您正苦于以下问题:C++ Point2D::getTime方法的具体用法?C++ Point2D::getTime怎么用?C++ Point2D::getTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point2D的用法示例。


在下文中一共展示了Point2D::getTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawPoint

void ViewportPainter::drawPoint(Point2D & point) {
    if(point.getTime() != "-1") {
      QString text("t = " + point.getTime());
      QRect rect(point.x()+TEXT_OFFSET_X, point.y()-TEXT_OFFSET_Y,10*text.length()+2*TEXT_MARGIN,15+2*TEXT_MARGIN);
      this->setBrush(QColor(255, 255, 255, 255));
      this->drawRect(rect);
      this->drawText(rect,Qt::AlignHCenter|Qt::AlignVCenter,text);
    }
    if(point.selected())
      this->setBrush(QColor(255, 0, 0, 255));
    else
      this->setBrush(QColor(255, 248, 133, 255));
    this->drawEllipse(point.x()-POINT_SIZE/2,point.y()-POINT_SIZE/2,POINT_SIZE,POINT_SIZE);
}
开发者ID:PaulGrandperrin,项目名称:demo-opengl-shootemup,代码行数:14,代码来源:viewportPainter.cpp

示例2: enterTime

void Viewport::enterTime(Point2D * point) {
  double time, min_time = 0, max_time = 2147483647;
  list<Point2D>::iterator itp = points.begin();
  if(point != &(points.front())) {
    Point2D * previous = NULL;
    for(itp = points.begin(); itp != points.end() && &(*itp) != point; itp++)
      previous = &(*itp);
    min_time = previous->getTime().toDouble()+0.1;
  }
  if(point != &(points.back())) {
    itp++;
    max_time = (*itp).getTime().toDouble();
    if(max_time >= 0.1)
      max_time -= 0.1;
  }
  time = QInputDialog::getDouble(this, "Time", "Please enter the time you want to apply this position (in seconds)", min_time, min_time, max_time);
  ostringstream out;
  out << time;
  string text = out.str();
  point->setTime(QString(text.data()));
}
开发者ID:PaulGrandperrin,项目名称:demo-opengl-shootemup,代码行数:21,代码来源:viewport.cpp


注:本文中的Point2D::getTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。