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


C++ PT函数代码示例

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


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

示例1: LVector3f

void World::start()
   {
   // The maze model also has a locator in it for where to start the ball
   // To access it we use the find command
   LPoint3f startPos = m_mazeNp.find("**/start").get_pos();
   // Set the ball in the starting position
   m_ballRootNp.set_pos(startPos);
   // Initial velocity is 0
   m_ballV = LVector3f(0,0,0);
   // Initial acceleration is 0
   m_accelV = LVector3f(0,0,0);

   // For a traverser to actually do collisions, you need to call
   // traverser.traverse() on a part of the scene. Fortunately, base has a
   // task that does this for the entire scene once a frame. This sets up our
   // traverser as the one to be called automatically
   // Note: have to do it manually in C++
   PT(GenericAsyncTask) traverserTaskPtr = new GenericAsyncTask("traverser", call_traverse, this);
   if(traverserTaskPtr != NULL)
      {
      AsyncTaskManager::get_global_ptr()->add(traverserTaskPtr);
      }

   // Create the movement task, but first make sure it is not already running
   PT(GenericAsyncTask) rollTaskPtr = DCAST(GenericAsyncTask, AsyncTaskManager::get_global_ptr()->find_task("rollTask"));
   if(rollTaskPtr == NULL)
      {
      rollTaskPtr = new GenericAsyncTask("rollTask", call_roll, this);
      if(rollTaskPtr != NULL)
         {
         AsyncTaskManager::get_global_ptr()->add(rollTaskPtr);
         }
      }
   m_last = 0;
   }
开发者ID:drivird,项目名称:drunken-octo-robot,代码行数:35,代码来源:world.cpp

示例2: startListening

cmd_type commBase::read()
{
	//Required - insures we can read the packets 
	startListening();

	cmd_type ret = PKT_EMPTY;
	byte packet[PACKET_SIZE]; //packet buffer
	if (com.available())
	{
		delay(5);
		com.read(packet, PACKET_SIZE);
	}
	else
		return ret;


	for (int i = 0; i < PACKET_SIZE; i++)
		PT(packet[i]);
	PTL();

	byte cmd = packet[0]; //first packet gives the type of packet
	if (cmd == PKT_UPDATE_TEMPERATURE)
	{
		PT("Updating Temp ");
		float * value = (float*)&packet[1];
		temperature_sensor = *value;
		ret = PKT_UPDATE_TEMPERATURE;
		PTL(*value);
	}

	// stopListening();
	return ret;
}
开发者ID:oprospero,项目名称:plug-thermo,代码行数:33,代码来源:Comm.cpp

示例3: Q

void FB_TOF::executeEvent(int pa_nEIID){
  if(scm_nEventREQID == pa_nEIID){
    if(IN() == true){
      Q() = true;
      ET() = 0;
      fallingEdge = false;
      notFirstRisingEdge = true;
      start = 0;
    }
    else{
      if(true == notFirstRisingEdge){
        if(fallingEdge == false){
          fallingEdge = true;
          start = TIME();
        }
        else{
          count = TIME() - start;
          if(PT() <= count){
            Q() = false;
            ET() = PT();
          }else{
            ET() = count;
          }
        }
      }
    }
    sendOutputEvent(scm_nEventCNFID);
  }
}
开发者ID:EstebanQuerol,项目名称:Black_FORTE,代码行数:29,代码来源:FB_TOF.cpp

示例4: Q

void FB_TON::executeEvent(int pa_nEIID){
  if(scm_nEventREQID == pa_nEIID){
    if(IN() == false){
      Q() = false;
      ET() = 0;
      risingEdge = false;
      start = 0;
    }
    else{
      if(risingEdge == false){
        risingEdge = true;
        start = TIME();
      }else{
        count = TIME() - start;
        if(PT() <= count){
          Q() = true;
          ET() = PT();
        }else{
          ET() = count;
        }
      }
    }
    sendOutputEvent(scm_nEventCNFID);
  }
}
开发者ID:EstebanQuerol,项目名称:Black_FORTE,代码行数:25,代码来源:FB_TON.cpp

示例5: _entrance_session_userid_set

static int
_entrance_session_userid_set(struct passwd *pwd)
{
   if (!pwd)
     {
        PT("no passwd !\n");
        return 1;
     }
   if (initgroups(pwd->pw_name, pwd->pw_gid) != 0)
     {
        PT("can't init group\n");
        return 1;
     }
   if (setgid(pwd->pw_gid) != 0)
     {
        PT("can't set gid\n");
        return 1;
     }
   if (setuid(pwd->pw_uid) != 0)
     {
        PT("can't set uid\n");
        return 1;
     }

/*   PT("name -> %s, gid -> %d, uid -> %d\n",
           pwd->pw_name, pwd->pw_gid, pwd->pw_uid); */
   return 0;
}
开发者ID:Limsik,项目名称:e17,代码行数:28,代码来源:entrance_session.c

示例6: make_move

int make_move(const GameState* state, int i, int d)
{
  assert(d > 0);
  int player = ai_current_player();
  MoveResult move = is_valid_move(state, player, i, d);
  DEBUG("make_move(): P%d moves %d -> %d (result %d)\n", player, i, i-d, move);
  int src = PT(player,i);
  int dest = PT(player,i-d);
  switch (move)
  {
    case MOVE_INVALID:
      return 0;
    case MOVE_BEAROFF:
      assert(src >= 0 && src < 24);
      SET(state->points[src], MAKEPOINT(player, state->points[src].count-1));
      DEC(state->total[player]);
      ai_set_player_score(player, 15 - state->total[player]);
      DEBUG("make_move(): P%d beared off @ %d; %d left\n", player, i, state->total[player]);
      return 1;
    case MOVE_UNOCCUPIED:
    case MOVE_MERGE:
      assert(src >= 0 && src < 24);
      assert(dest >= 0 && dest < 24);
      SET(state->points[src], MAKEPOINT(player, state->points[src].count-1));
      SET(state->points[dest], MAKEPOINT(player, state->points[dest].count+1));
      return 1;
    case MOVE_HITBLOT:
      assert(src >= 0 && src < 24);
      assert(dest >= 0 && dest < 24);
      SET(state->points[src], MAKEPOINT(player, state->points[src].count-1));
      SET(state->points[dest], MAKEPOINT(player, 1));
      INC(state->bar[player^1]);
      return 1;
  }
}
开发者ID:sehugg,项目名称:Starthinker,代码行数:35,代码来源:backgammon.c

示例7: if

    PT convert_script_value_f_point<PT>::operator()( QScriptEngine *,
						  const QScriptValue & args ) const
    {
	typedef typename point_valtype<PT>::value_type value_type;
	value_type x = 0;
	value_type y = 0;
	QScriptValue obj;
	bool smellArray = (args.isArray() || ! args.property("length").isUndefined());
	if( smellArray )
	{
	    if(0) qDebug() << "Looks like arguments array.";
	    obj = args.property(0);
	}
	else if( args.isObject() )
	{
	    if(0) qDebug() << "Looks like an object.";
	    obj = args;
	}

	if( smellArray && !obj.isObject() )
	{
	    if(0) qDebug() << "Trying arguments array.";
	    x = value_type(args.property(0).toNumber());
	    y = value_type(args.property(1).toNumber());
	}
	else
	{
	    if(0) qDebug() << "Trying object x/y:" << obj.toString() << ":" << toSource( obj );
	    if(0) qDebug() << "obj.property(x).toNumber():"<<obj.property("x").toNumber();
	    x = value_type(obj.property("x").toNumber());
	    y = value_type(obj.property("y").toNumber());
	}
	if(0) qDebug() << "PT:"<<PT(x,y);
	return PT(x,y);
    }
开发者ID:Mr-Kumar-Abhishek,项目名称:qboard,代码行数:35,代码来源:ScriptQt.cpp

示例8: ft_farthest

t_pt			ft_farthest(t_pt pos, t_pt p1, t_pt p2)
{
	const t_pt		t1 = PT(p1.x - pos.x, p1.y - pos.y);
	const t_pt		t2 = PT(p2.x - pos.x, p2.y - pos.y);

	if (((t1.x * t1.x) + (t1.y * t1.y)) > ((t2.x * t2.x) + (t2.y * t2.y)))
		return (p1);
	return (p2);
}
开发者ID:Julow,项目名称:Arkanoid,代码行数:9,代码来源:ft_farthest.c

示例9: PT

uint64 
NetworkBlockFile::getFreeBlock()
{
	uint64 blocknum ;
	PT("Entering NetworkingBlockFile::getFreeBlock()") ;
	blocknum = sp->getFreeBlock() ;
	PT("Leaving NetworkingBlockFile::getFreeBlock()") ;
	return blocknum ;
}
开发者ID:DEMONkill,项目名称:Nautilus,代码行数:9,代码来源:NetworkBlockFile.cpp

示例10: main

int main() {
    PT val[] = {PT(0, 0), PT(1, 1), PT(2, 2), PT(-1, 0)};
    vector<PT> puntuak;
    for (int i = 0; i < 4; i++)
        puntuak.push_back(val[i]);
    ConvexHull(puntuak);
    for (int i = 0; i < puntuak.size(); i++)
        cout << puntuak[i].x << " " << puntuak[i].y << endl;
    return 0;   
}
开发者ID:SWERC-EHU-2015,项目名称:Swerc-notes-2015,代码行数:10,代码来源:ConvexHull.cpp

示例11: PT

// This is the task that deals with making everything interactive
AsyncTask::DoneStatus World::roll(GenericAsyncTask* taskPtr)
   {
   // Standard technique for finding the amount of time since the last frame
   double dt = taskPtr->get_elapsed_time() - m_last;
   m_last = taskPtr->get_elapsed_time();

   // If dt is large, then there has been a # hiccup that could cause the ball
   // to leave the field if this functions runs, so ignore the frame
   if(dt > 0.2) { return AsyncTask::DS_cont; }

   // The collision handler collects the collisions. We dispatch which function
   // to handle the collision based on the name of what was collided into
   for(int i = 0; i < m_cHandlerPtr->get_num_entries(); ++i)
      {
      PT(CollisionEntry) entryPtr = m_cHandlerPtr->get_entry(i);
      const string& name = entryPtr->get_into_node()->get_name();
      if(name == "wall_collide")        { wall_collide_handler(*entryPtr);   }
      else if(name == "ground_collide") { ground_collide_handler(*entryPtr); }
      else if(name == "loseTrigger")    { lose_game(*entryPtr);              }
      }

   // Read the mouse position and tilt the maze accordingly
   PT(MouseWatcher) mouseWatcherPtr = DCAST(MouseWatcher, m_windowFrameworkPtr->get_mouse().node());
   if(mouseWatcherPtr->has_mouse())
      {
      // get the mouse position
      const LPoint2f& mpos = mouseWatcherPtr->get_mouse();
      m_mazeNp.set_p(mpos.get_y() * -10);
      m_mazeNp.set_r(mpos.get_x() * 10);
      }

   // Finally, we move the ball
   // Update the velocity based on acceleration
   m_ballV += m_accelV * dt * ACCEL;
   // Clamp the velocity to the maximum speed
   if(m_ballV.length_squared() > MAX_SPEED_SQ)
      {
      m_ballV.normalize();
      m_ballV *= MAX_SPEED;
      }
   // Update the position based on the velocity
   m_ballRootNp.set_pos(m_ballRootNp.get_pos() + (m_ballV * dt));

   // This block of code rotates the ball. It uses something called a quaternion
   // to rotate the ball around an arbitrary axis. That axis perpendicular to
   // the balls rotation, and the amount has to do with the size of the ball
   // This is multiplied on the previous rotation to incrementally turn it.
   LRotationf prevRot(m_ballNp.get_quat());
   LVector3f axis = UP.cross(m_ballV);
   LRotationf newRot(axis, 45.5 * dt * m_ballV.length());
   m_ballNp.set_quat(prevRot * newRot);

   // Continue the task indefinitely
   return AsyncTask::DS_cont;
   }
开发者ID:drivird,项目名称:drunken-octo-robot,代码行数:56,代码来源:world.cpp

示例12: pico_give

/*
 * pico_give - free resources and give up picotext struct
 */
void
pico_give(void *w)
{
    register LINE *lp;
    register LINE *fp;

    fp = lforw(PT(w)->linep);
    while((lp = fp) != PT(w)->linep){
        fp = lforw(lp);
	free(lp);
    }
    free(PT(w)->linep);
    free((PICOTEXT *)w);
}
开发者ID:ctubio,项目名称:alpine,代码行数:17,代码来源:pico.c

示例13: executeEvent

void FB_TP::executeEvent(int pa_nEIID){
  if(pa_nEIID == scm_nEventREQID){
      if (edgeFlag) {
        if(ET() >= PT()){
          Q() = false;
          edgeFlag = false;
          DEVLOG_DEBUG("top\n");
        }else{
          ET() = TIME() - start;
          DEVLOG_DEBUG("rising\n");
        }
      }
      else {
        if(IN() == true && ET() == 0){
          Q() = true;
          edgeFlag = true;
          start = TIME();
          DEVLOG_DEBUG("start\n");
        }
        else
          if((false == IN()) && (ET()>0)) {
            ET() = 0;
            DEVLOG_DEBUG("reset\n");
          }
      }
      sendOutputEvent(scm_nEventCNFID);
  }
}
开发者ID:EstebanQuerol,项目名称:Black_FORTE,代码行数:28,代码来源:FB_TP.cpp

示例14: setfill

// Our custom load function to load the textures needed for a movie into a
// list. It assumes the the files are named
// "path/name<serial number>.extention"
// It takes the following arguments
// Frames: The number of frames to load
// name: The "path/name" part of the filename path
// suffix: The "extention" part of the path
// padding: The number of digit the serial number contains:
//          e.g. if the serial number is 0001 then padding is 4
void World::load_texture_movie(int frames,
                               const string& name,
                               const string& suffix,
                               int padding,
                               vector<PT(Texture)>* texs)
   {
   // The following line is very complicated but does a lot in one line
   // Here's the explanation from the inside out:
   // first, a string representing the filename is built an example is:
   // "path/name%04d.extention"
   // The % after the string is an operator that works like C's sprintf function
   // It tells python to put the next argument (i) in place of the %04d
   // For more string formatting information look in the python manual
   // That string is then passed to the loader.loadTexture function
   // The loader.loadTexture command gets done in a loop once for each frame,
   // And the result is returned as a list.
   // For more information on "list comprehensions" see the python manual
   for(int frameItr = 0; frameItr < frames; ++frameItr)
      {
      ostringstream filename;
      filename << name << setfill('0') << setw(padding)
         << frameItr << "." << suffix;
      PT(Texture) tex = TexturePool::load_texture(filename.str());
      (*texs).push_back(tex);
      }
   }
开发者ID:drivird,项目名称:drunken-octo-robot,代码行数:35,代码来源:world.cpp

示例15: PathStart

static void PathStart( PLOT *plot, int style, int axis, double unit )
    {
    double res ;

    if( PathState != 0 )
	IOerror( OpticBomb, "PathStart", "state mismatch" ) ;

    PathFile = PlotKludge( plot ) ;
    PathStyle = PlotKludge2( plot ) ;
    PathAxis = axis ;
    PathUnit = unit ;

    switch( PathStyle )
	{
	case PLOT_PS:
	    PT( "newpath\n" ) ;
	    res = 1.0 / 25400.0 ;		/* 1.0 microns */
	    break ;
	case PLOT_MG:
	    res = 1.0 / 25400.0 ;		/* 1.0 microns */
	    break ;
	case PLOT_AC:
	    PathAxis = 0 ;
	    res = 0.1 / 25.4 ;			/* 0.1 mm */
	    break ;
	default:
	    res = 0.0 ;
	}

    PathRes = (int) ( 0.99 - log10( PathUnit * res ) ) ;
    if( PathRes < 0 )
	PathRes = 0 ;

    PathState = 1 ;
    }
开发者ID:skewray,项目名称:skewray_old,代码行数:35,代码来源:graphics.c


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