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


C++ dub_checknumber函数代码示例

本文整理汇总了C++中dub_checknumber函数的典型用法代码示例。如果您正苦于以下问题:C++ dub_checknumber函数的具体用法?C++ dub_checknumber怎么用?C++ dub_checknumber使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: ofVec2f_set

/** void ofVec2f::set(float _scalar)
 * api/openFrameworks/math/ofVec2f.h:37
 */
static int ofVec2f_set(lua_State *L) {
  try {
    ofVec2f *self = *((ofVec2f **)dub_checksdata(L, 1, "ofVec2f"));
    int top__ = lua_gettop(L);
    if (top__ >= 3) {
      float _x = dub_checknumber(L, 2);
      float _y = dub_checknumber(L, 3);
      self->set(_x, _y);
      return 0;
    } else {
      int type__ = lua_type(L, 2);
      if (type__ == LUA_TNUMBER) {
        float _scalar = dub_checknumber(L, 2);
        self->set(_scalar);
        return 0;
      } else {
        ofVec2f *vec = *((ofVec2f **)dub_checksdata(L, 2, "ofVec2f"));
        self->set(*vec);
        return 0;
      }
    }
  } catch (std::exception &e) {
    lua_pushfstring(L, "set: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "set: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:cigraphics,项目名称:ofxMoonLight,代码行数:31,代码来源:ofVec2f.cpp

示例2: ofPolyline_inside

/** bool ofPolyline::inside(float x, float y)
 * api/openFrameworks/graphics/ofPolyline.h:107
 */
static int ofPolyline_inside(lua_State *L) {
  try {
    ofPolyline *self = *((ofPolyline **)dub_checksdata(L, 1, "ofPolyline"));
    int top__ = lua_gettop(L);
    if (top__ >= 4) {
      float x = dub_checknumber(L, 2);
      float y = dub_checknumber(L, 3);
      ofPolyline *polyline = *((ofPolyline **)dub_checksdata(L, 4, "ofPolyline"));
      lua_pushboolean(L, ofPolyline::inside(x, y, *polyline));
      return 1;
    } else if (top__ >= 3) {
      int type__ = lua_type(L, 2);
      if (type__ == LUA_TNUMBER) {
        float x = dub_checknumber(L, 2);
        float y = dub_checknumber(L, 3);
        lua_pushboolean(L, self->inside(x, y));
        return 1;
      } else {
        ofVec3f *p = *((ofVec3f **)dub_checksdata(L, 2, "ofVec3f"));
        ofPolyline *polyline = *((ofPolyline **)dub_checksdata(L, 3, "ofPolyline"));
        lua_pushboolean(L, ofPolyline::inside(*p, *polyline));
        return 1;
      }
    } else {
      ofVec3f *p = *((ofVec3f **)dub_checksdata(L, 2, "ofVec3f"));
      lua_pushboolean(L, self->inside(*p));
      return 1;
    }
  } catch (std::exception &e) {
    lua_pushfstring(L, "inside: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "inside: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:cigraphics,项目名称:ofxMoonLight,代码行数:38,代码来源:ofPolyline.cpp

示例3: ofPolyline_addVertex

/** void ofPolyline::addVertex(const ofPoint &p)
 * api/openFrameworks/graphics/ofPolyline.h:23
 */
static int ofPolyline_addVertex(lua_State *L) {
  try {
    ofPolyline *self = *((ofPolyline **)dub_checksdata(L, 1, "ofPolyline"));
    int top__ = lua_gettop(L);
    if (top__ >= 4) {
      float x = dub_checknumber(L, 2);
      float y = dub_checknumber(L, 3);
      float z = dub_checknumber(L, 4);
      self->addVertex(x, y, z);
      return 0;
    } else if (top__ >= 3) {
      float x = dub_checknumber(L, 2);
      float y = dub_checknumber(L, 3);
      self->addVertex(x, y);
      return 0;
    } else {
      ofVec3f *p = *((ofVec3f **)dub_checksdata(L, 2, "ofVec3f"));
      self->addVertex(*p);
      return 0;
    }
  } catch (std::exception &e) {
    lua_pushfstring(L, "addVertex: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "addVertex: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:cigraphics,项目名称:ofxMoonLight,代码行数:30,代码来源:ofPolyline.cpp

示例4: btRigidBodyConstructionInfo_btRigidBodyConstructionInfo

/** btRigidBody::btRigidBodyConstructionInfo::btRigidBodyConstructionInfo(btScalar mass, btMotionState *motionState, btCollisionShape *collisionShape, const btVector3 &localInertia=btVector3(0, 0, 0))
 * src/vendor/bullet/src/BulletDynamics/Dynamics/btRigidBody.h:166
 */
static int btRigidBodyConstructionInfo_btRigidBodyConstructionInfo(lua_State *L) {
  try {
    int top__ = lua_gettop(L);
    if (top__ >= 4) {
      btScalar mass = dub_checknumber(L, 1);
      btMotionState *motionState = *((btMotionState **)dub_checksdata(L, 2, "bt.MotionState"));
      btCollisionShape *collisionShape = *((btCollisionShape **)dub_checksdata(L, 3, "bt.CollisionShape"));
      btVector3 *localInertia = *((btVector3 **)dub_checksdata(L, 4, "bt.Vector3"));
      btRigidBody::btRigidBodyConstructionInfo *retval__ = new btRigidBody::btRigidBodyConstructionInfo(mass, motionState, collisionShape, *localInertia);
      dub_pushudata(L, retval__, "bt.RigidBody.RigidBodyConstructionInfo", true);
      return 1;
    } else {
      btScalar mass = dub_checknumber(L, 1);
      btMotionState *motionState = *((btMotionState **)dub_checksdata(L, 2, "bt.MotionState"));
      btCollisionShape *collisionShape = *((btCollisionShape **)dub_checksdata(L, 3, "bt.CollisionShape"));
      btRigidBody::btRigidBodyConstructionInfo *retval__ = new btRigidBody::btRigidBodyConstructionInfo(mass, motionState, collisionShape);
      dub_pushudata(L, retval__, "bt.RigidBody.RigidBodyConstructionInfo", true);
      return 1;
    }
  } catch (std::exception &e) {
    lua_pushfstring(L, "new: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "new: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:lubyk,项目名称:old_bt,代码行数:29,代码来源:bt_RigidBody_RigidBodyConstructionInfo.cpp

示例5: Pen_setHsva

/** void Pen::setHsva(float h, float s=1.0, float v=1.0, float a=1.0)
 * include/mimas/Pen.h:69
 */
static int Pen_setHsva(lua_State *L) {
  try {
    Pen *self = *((Pen **)dub_checksdata(L, 1, "mimas.Pen"));
    int top__ = lua_gettop(L);
    if (top__ >= 5) {
      float h = dub_checknumber(L, 2);
      float s = dub_checknumber(L, 3);
      float v = dub_checknumber(L, 4);
      float a = dub_checknumber(L, 5);
      self->setHsva(h, s, v, a);
      return 0;
    } else if (top__ >= 4) {
      float h = dub_checknumber(L, 2);
      float s = dub_checknumber(L, 3);
      float v = dub_checknumber(L, 4);
      self->setHsva(h, s, v);
      return 0;
    } else if (top__ >= 3) {
      float h = dub_checknumber(L, 2);
      float s = dub_checknumber(L, 3);
      self->setHsva(h, s);
      return 0;
    } else {
      float h = dub_checknumber(L, 2);
      self->setHsva(h);
      return 0;
    }
  } catch (std::exception &e) {
    lua_pushfstring(L, "setHsva: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "setHsva: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:lubyk,项目名称:mimas,代码行数:37,代码来源:mimas_Pen.cpp

示例6: TableView_setMinimumSize

/** void QWidget::setMinimumSize(float w, float h)
 * bind/QWidget.h:25
 */
static int TableView_setMinimumSize(lua_State *L) {
  try {
    TableView *self = *((TableView **)dub_checksdata(L, 1, "mimas.TableView"));
    float w = dub_checknumber(L, 2);
    float h = dub_checknumber(L, 3);
    self->setMinimumSize(w, h);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "setMinimumSize: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "setMinimumSize: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:lubyk,项目名称:mimas,代码行数:17,代码来源:mimas_TableView.cpp

示例7: ofPolyline_arcNegative

/** void ofPolyline::arcNegative(const ofPoint &center, float radiusX, float radiusY, float angleBegin, float angleEnd, int curveResolution=20)
 * api/openFrameworks/graphics/ofPolyline.h:52
 */
static int ofPolyline_arcNegative(lua_State *L) {
  try {
    ofPolyline *self = *((ofPolyline **)dub_checksdata(L, 1, "ofPolyline"));
    int top__ = lua_gettop(L);
    if (top__ >= 7) {
      ofVec3f *center = *((ofVec3f **)dub_checksdata(L, 2, "ofVec3f"));
      float radiusX = dub_checknumber(L, 3);
      float radiusY = dub_checknumber(L, 4);
      float angleBegin = dub_checknumber(L, 5);
      float angleEnd = dub_checknumber(L, 6);
      int curveResolution = dub_checkint(L, 7);
      self->arcNegative(*center, radiusX, radiusY, angleBegin, angleEnd, curveResolution);
      return 0;
    } else {
      ofVec3f *center = *((ofVec3f **)dub_checksdata(L, 2, "ofVec3f"));
      float radiusX = dub_checknumber(L, 3);
      float radiusY = dub_checknumber(L, 4);
      float angleBegin = dub_checknumber(L, 5);
      float angleEnd = dub_checknumber(L, 6);
      self->arcNegative(*center, radiusX, radiusY, angleBegin, angleEnd);
      return 0;
    }
  } catch (std::exception &e) {
    lua_pushfstring(L, "arcNegative: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "arcNegative: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:cigraphics,项目名称:ofxMoonLight,代码行数:32,代码来源:ofPolyline.cpp

示例8: btHingeConstraint_setMotorTarget

/** void btHingeConstraint::setMotorTarget(btScalar targetAngle, btScalar dt)
 * bind/btHingeConstraint.h:36
 */
static int btHingeConstraint_setMotorTarget(lua_State *L) {
  try {
    btHingeConstraint *self = *((btHingeConstraint **)dub_checksdata(L, 1, "bt.HingeConstraint"));
    btScalar targetAngle = dub_checknumber(L, 2);
    btScalar dt = dub_checknumber(L, 3);
    self->setMotorTarget(targetAngle, dt);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "setMotorTarget: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "setMotorTarget: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:lubyk,项目名称:old_bt,代码行数:17,代码来源:bt_HingeConstraint.cpp

示例9: ofVideoGrabber_setAnchorPoint

/** void ofVideoGrabber::setAnchorPoint(float x, float y)
 * api/openFrameworks/video/ofVideoGrabber.h:45
 */
static int ofVideoGrabber_setAnchorPoint(lua_State *L) {
  try {
    ofVideoGrabber *self = *((ofVideoGrabber **)dub_checksdata(L, 1, "ofVideoGrabber"));
    float x = dub_checknumber(L, 2);
    float y = dub_checknumber(L, 3);
    self->setAnchorPoint(x, y);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "setAnchorPoint: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "setAnchorPoint: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:cigraphics,项目名称:ofxMoonLight,代码行数:17,代码来源:ofVideoGrabber.cpp

示例10: ofFbo_setAnchorPercent

/** void ofFbo::setAnchorPercent(float xPct, float yPct)
 * api/openFrameworks/gl/ofFbo.h:22
 */
static int ofFbo_setAnchorPercent(lua_State *L) {
  try {
    ofFbo *self = *((ofFbo **)dub_checksdata(L, 1, "ofFbo"));
    float xPct = dub_checknumber(L, 2);
    float yPct = dub_checknumber(L, 3);
    self->setAnchorPercent(xPct, yPct);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "setAnchorPercent: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "setAnchorPercent: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:cigraphics,项目名称:ofxMoonLight,代码行数:17,代码来源:ofFbo.cpp

示例11: b2Color_Set

/** void b2Color::Set(float32 ri, float32 gi, float32 bi)
 * vendor/Box2D/Box2D/Common/b2Draw.h:29
 */
static int b2Color_Set(lua_State *L) {
    try {
        b2Color *self = *((b2Color **)dub_checksdata(L, 1, "b2.Color"));
        float32 ri = dub_checknumber(L, 2);
        float32 gi = dub_checknumber(L, 3);
        float32 bi = dub_checknumber(L, 4);
        self->Set(ri, gi, bi);
        return 0;
    } catch (std::exception &e) {
        lua_pushfstring(L, "Set: %s", e.what());
    } catch (...) {
        lua_pushfstring(L, "Set: Unknown exception");
    }
    return dub_error(L);
}
开发者ID:lubyk,项目名称:b2,代码行数:18,代码来源:b2_Color.cpp

示例12: btHingeConstraint_enableAngularMotor

/** void btHingeConstraint::enableAngularMotor(bool enableMotor, btScalar targetVelocity, btScalar maxMotorImpulse)
 * bind/btHingeConstraint.h:34
 */
static int btHingeConstraint_enableAngularMotor(lua_State *L) {
  try {
    btHingeConstraint *self = *((btHingeConstraint **)dub_checksdata(L, 1, "bt.HingeConstraint"));
    bool enableMotor = dub_checkboolean(L, 2);
    btScalar targetVelocity = dub_checknumber(L, 3);
    btScalar maxMotorImpulse = dub_checknumber(L, 4);
    self->enableAngularMotor(enableMotor, targetVelocity, maxMotorImpulse);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "enableAngularMotor: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "enableAngularMotor: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:lubyk,项目名称:old_bt,代码行数:18,代码来源:bt_HingeConstraint.cpp

示例13: btMatrix3x3_getEulerYPR

/** void btMatrix3x3::getEulerYPR(btScalar &yaw, btScalar &pitch, btScalar &roll) const
 * src/vendor/bullet/src/LinearMath/btMatrix3x3.h:488
 */
static int btMatrix3x3_getEulerYPR(lua_State *L) {
  try {
    btMatrix3x3 *self = *((btMatrix3x3 **)dub_checksdata(L, 1, "bt.Matrix3x3"));
    btScalar yaw = dub_checknumber(L, 2);
    btScalar pitch = dub_checknumber(L, 3);
    btScalar roll = dub_checknumber(L, 4);
    self->getEulerYPR(yaw, pitch, roll);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "getEulerYPR: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "getEulerYPR: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:lubyk,项目名称:old_bt,代码行数:18,代码来源:bt_Matrix3x3.cpp

示例14: btMatrix3x3_setEulerZYX

/** void btMatrix3x3::setEulerZYX(btScalar eulerX, btScalar eulerY, btScalar eulerZ)
 * src/vendor/bullet/src/LinearMath/btMatrix3x3.h:293
 */
static int btMatrix3x3_setEulerZYX(lua_State *L) {
  try {
    btMatrix3x3 *self = *((btMatrix3x3 **)dub_checksdata(L, 1, "bt.Matrix3x3"));
    btScalar eulerX = dub_checknumber(L, 2);
    btScalar eulerY = dub_checknumber(L, 3);
    btScalar eulerZ = dub_checknumber(L, 4);
    self->setEulerZYX(eulerX, eulerY, eulerZ);
    return 0;
  } catch (std::exception &e) {
    lua_pushfstring(L, "setEulerZYX: %s", e.what());
  } catch (...) {
    lua_pushfstring(L, "setEulerZYX: Unknown exception");
  }
  return dub_error(L);
}
开发者ID:lubyk,项目名称:old_bt,代码行数:18,代码来源:bt_Matrix3x3.cpp

示例15: btPolyhedralConvexShape_project

/** virtual void btConvexShape::project(const btTransform &trans, const btVector3 &dir, btScalar &min, btScalar &max) const
 * src/vendor/bullet/src/BulletCollision/CollisionShapes/btConvexShape.h:55
 */
static int btPolyhedralConvexShape_project(lua_State *L) {
    try {
        btPolyhedralConvexShape *self = *((btPolyhedralConvexShape **)dub_checksdata(L, 1, "bt.PolyhedralConvexShape"));
        btTransform *trans = *((btTransform **)dub_checksdata(L, 2, "bt.Transform"));
        btVector3 *dir = *((btVector3 **)dub_checksdata(L, 3, "bt.Vector3"));
        btScalar min = dub_checknumber(L, 4);
        btScalar max = dub_checknumber(L, 5);
        self->project(*trans, *dir, min, max);
        return 0;
    } catch (std::exception &e) {
        lua_pushfstring(L, "project: %s", e.what());
    } catch (...) {
        lua_pushfstring(L, "project: Unknown exception");
    }
    return dub_error(L);
}
开发者ID:lubyk,项目名称:old_bt,代码行数:19,代码来源:bt_PolyhedralConvexShape.cpp


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