• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ getSelf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getSelf

         QScriptValue
        REcmaToolMatrixItemDelegate::sizeHint
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaToolMatrixItemDelegate::sizeHint", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaToolMatrixItemDelegate::sizeHint";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RToolMatrixItemDelegate* self = 
                        getSelf("sizeHint", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: QStyleOptionViewItem */
     && (
            context->argument(1).isVariant() || 
            context->argument(1).isQObject() || 
            context->argument(1).isNull()
        ) /* type: QModelIndex */
    
    ){
    // prepare arguments:
    
                    // argument is reference
                    QStyleOptionViewItem*
                    ap0 =
                    qscriptvalue_cast<
                    QStyleOptionViewItem*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if( ap0 == NULL ){
                           return REcmaHelper::throwError("RToolMatrixItemDelegate: Argument 0 is not of type QStyleOptionViewItem*.",
                               context);                    
                    }
                    QStyleOptionViewItem& a0 = *ap0;
                
                    // argument is reference
                    QModelIndex*
                    ap1 =
                    qscriptvalue_cast<
                    QModelIndex*
                        >(
                        context->argument(
                        1
                        )
                    );
                    if( ap1 == NULL ){
                           return REcmaHelper::throwError("RToolMatrixItemDelegate: Argument 1 is not of type QModelIndex*.",
                               context);                    
                    }
                    QModelIndex& a1 = *ap1;
                
    // end of arguments

    // call C++ function:
    // return type 'QSize'
    QSize cppResult =
        
               self->sizeHint(a0
        ,
    a1);
        // return type: QSize
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RToolMatrixItemDelegate.sizeHint().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaToolMatrixItemDelegate::sizeHint", context, engine);
            return result;
        }
开发者ID:fallenwind,项目名称:qcad,代码行数:93,代码来源:REcmaToolMatrixItemDelegate.cpp


示例2: getSelf

    // public methods:
     QScriptValue
        REcmaRestrictAngleLength::restrictSnap
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaRestrictAngleLength::restrictSnap", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaRestrictAngleLength::restrictSnap";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RRestrictAngleLength* self = 
                        getSelf("restrictSnap", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RVector */
     && (
            context->argument(1).isVariant() || 
            context->argument(1).isQObject() || 
            context->argument(1).isNull()
        ) /* type: RVector */
    
    ){
    // prepare arguments:
    
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RVector*
                    ap0 =
                    qscriptvalue_cast<
                    RVector*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if (ap0 == NULL) {
                           return REcmaHelper::throwError("RRestrictAngleLength: Argument 0 is not of type RVector.",
                               context);                    
                    }
                    RVector 
                    a0 = 
                    *ap0;
                
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RVector*
                    ap1 =
                    qscriptvalue_cast<
                    RVector*
                        >(
                        context->argument(
                        1
                        )
                    );
                    if (ap1 == NULL) {
                           return REcmaHelper::throwError("RRestrictAngleLength: Argument 1 is not of type RVector.",
                               context);                    
                    }
                    RVector 
                    a1 = 
                    *ap1;
                
    // end of arguments

    // call C++ function:
    // return type 'RVector'
    RVector cppResult =
        
               self->restrictSnap(a0
        ,
    a1);
        // return type: RVector
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RRestrictAngleLength.restrictSnap().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaRestrictAngleLength::restrictSnap", context, engine);
            return result;
        }
开发者ID:fallenwind,项目名称:qcad,代码行数:98,代码来源:REcmaRestrictAngleLength.cpp


示例3: getSelf

         QScriptValue
        REcmaSharedPointerPointEntity::setProperty
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSharedPointerPointEntity::setProperty", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSharedPointerPointEntity::setProperty";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RPointEntity* self = 
                        getSelf("setProperty", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RPropertyTypeId */
     && (
            context->argument(1).isVariant() || 
            context->argument(1).isQObject() || 
            context->argument(1).isNumber() || 
            context->argument(1).isString() || 
            context->argument(1).isBool() || 
            context->argument(1).isArray() || 
            context->argument(1).isNull() || 
            context->argument(1).isUndefined()
        ) /* type: QVariant */
    
    ){
    // prepare arguments:
    
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RPropertyTypeId*
                    ap0 =
                    qscriptvalue_cast<
                    RPropertyTypeId*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if (ap0 == NULL) {
                           return REcmaHelper::throwError("RPointEntity: Argument 0 is not of type RPropertyTypeId.",
                               context);                    
                    }
                    RPropertyTypeId 
                    a0 = 
                    *ap0;
                
                    // argument isCopyable or pointer
                    QVariant
                    a1 =
                    qscriptvalue_cast<
                    QVariant
                        >(
                        context->argument(
                        1
                        )
                    );
                
    // end of arguments

    // call C++ function:
    // return type 'bool'
    bool cppResult =
        
               self->setProperty(a0
        ,
    a1);
        // return type: bool
                // standard Type
                result = QScriptValue(cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RPointEntity.setProperty().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSharedPointerPointEntity::setProperty", context, engine);
            return result;
        }
开发者ID:VixMobile,项目名称:qcad,代码行数:95,代码来源:REcmaSharedPointerPointEntity.cpp


示例4: getSelf

         QScriptValue
        REcmaSpatialIndexNavel::bulkLoad
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaSpatialIndexNavel::bulkLoad", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaSpatialIndexNavel::bulkLoad";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RSpatialIndexNavel* self = 
                        getSelf("bulkLoad", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isArray()
        ) /* type: QList < int > */
     && (
            context->argument(1).isArray()
        ) /* type: QList < QList < RBox > > */
    
    ){
    // prepare arguments:
    
                    // argument isArray
                    QList < int >
                    a0;
                    REcmaHelper::fromScriptValue(
                        engine,
                        context->argument(0),
                        a0
                    );
                
                    // argument isArray
                    QList < QList < RBox > >
                    a1;
                    REcmaHelper::fromScriptValue(
                        engine,
                        context->argument(1),
                        a1
                    );
                
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->bulkLoad(a0
        ,
    a1);
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RSpatialIndexNavel.bulkLoad().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaSpatialIndexNavel::bulkLoad", context, engine);
            return result;
        }
开发者ID:Jackieee,项目名称:qcad,代码行数:70,代码来源:REcmaSpatialIndexNavel.cpp


示例5: getSelf

         QScriptValue
        REcmaImporter::setDocument
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaImporter::setDocument", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaImporter::setDocument";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RImporter* self = 
                        getSelf("setDocument", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RDocument * */
    
    ){
    // prepare arguments:
    
                    // argument is pointer
                    RDocument * a0 = NULL;

                    a0 = 
                        REcmaHelper::scriptValueTo<RDocument >(
                            context->argument(0)
                        );
                    
                    if (a0==NULL && 
                        !context->argument(0).isNull()) {
                        return REcmaHelper::throwError("RImporter: Argument 0 is not of type RDocument *RDocument *.", context);                    
                    }
                
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->setDocument(a0);
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RImporter.setDocument().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaImporter::setDocument", context, engine);
            return result;
        }
开发者ID:Jackieee,项目名称:qcad,代码行数:62,代码来源:REcmaImporter.cpp


示例6: getSelf

void ObservationGenerator::generateGoalObservations() {
  getSelf(gtSelf, obsSelf, player_);
  int seenPostCount = 0;
  int firstPost = 0;
  for (int i = WO_OWN_LEFT_GOALPOST; i <= WO_OPP_RIGHT_GOALPOST; i++){
    getObject(gtPost, obsPost, i);
    float bearing = gtSelf.loc.getBearingTo(gtPost.loc,gtSelf.orientation);
    float distance = gtSelf.loc.getDistanceTo(gtPost.loc);
    if(isVisible(i)) {
      float missedObsRate = 1.0/10.0;
      if (distance > 3000) 
        missedObsRate = 1.0/3.0;
      float randPct = rand_.sampleU();
      if (randPct > (missedObsRate * MISSED_OBS_FACTOR) && distance < 7000){
        // seen
        obsPost.seen = true;
        if (seenPostCount == 0) firstPost = i;
        seenPostCount++;
        float diff = joint_->values_[HeadPan] - bearing;
        obsPost.imageCenterX = iparams_.width/2.0 + (diff / (FOVx/2.0) * iparams_.width/2.0);
        obsPost.imageCenterY = iparams_.height/2.0;
        // add distance and bearing noise
        float randNoise = rand_.sampleU()-0.5;
        obsPost.visionDistance = distance + randNoise * VISION_ERROR_FACTOR * 0.25*distance;// up to 25% distance error
        obsPost.visionBearing = bearing + randNoise * VISION_ERROR_FACTOR * 5.0*DEG_T_RAD;// up to 5 deg bearing error
        obsPost.visionConfidence = 1.0;


      }
    }
  }

  // actually have to fill those into unknown post spot
  if (seenPostCount == 1){
    // fill in unknown post
    WorldObject& obsPost = obs_object_->objects_[WO_UNKNOWN_GOALPOST];
    WorldObject& known = obs_object_->objects_[firstPost];
    obsPost.seen = true;
    obsPost.frameLastSeen = frame_info_->frame_id;
    obsPost.imageCenterX = known.imageCenterX;
    obsPost.imageCenterY = known.imageCenterY;
    obsPost.visionDistance = known.visionDistance;
    obsPost.visionBearing = known.visionBearing;
    obsPost.visionConfidence = 1.0;
    known.seen = false;

  }
  else if (seenPostCount == 2){
    // fill in left and right post and goal with average of two
    float sumX = 0;
    float sumDist = 0;
    float sumBear = 0;
    for (int i = 0; i < 2; i++){
      WorldObject& obsPost = obs_object_->objects_[WO_UNKNOWN_LEFT_GOALPOST+i];
      WorldObject& known = obs_object_->objects_[firstPost+(i*2)];
      obsPost.seen = true;
      obsPost.frameLastSeen = frame_info_->frame_id;
      obsPost.imageCenterX = known.imageCenterX;
      obsPost.imageCenterY = known.imageCenterY;
      obsPost.visionDistance = known.visionDistance;
      obsPost.visionBearing = known.visionBearing;
      obsPost.visionConfidence = 1.0;

      known.seen = false;
      sumX += obsPost.imageCenterX;
      sumDist += obsPost.visionDistance;
      sumBear += obsPost.visionBearing;

    }
    WorldObject& obsPost = obs_object_->objects_[WO_UNKNOWN_GOAL];
    obsPost.seen = true;
    obsPost.frameLastSeen = frame_info_->frame_id;
    obsPost.imageCenterX = sumX / 2.0;
    obsPost.imageCenterY = iparams_.height/2.0;
    obsPost.visionDistance = sumDist / 2.0;
    obsPost.visionBearing = sumBear / 2.0;
    obsPost.visionConfidence = 1.0;

  } else if (seenPostCount > 2){
    //cout << index_ << " error saw more than 2 posts: " << seenPostCount << endl;
  }
}
开发者ID:joeliven,项目名称:robotics,代码行数:82,代码来源:ObservationGenerator.cpp


示例7: getSelf

         QScriptValue
        REcmaPointEntity::exportEntity
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaPointEntity::exportEntity", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaPointEntity::exportEntity";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RPointEntity* self = 
                        getSelf("exportEntity", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RExporter */
    
    ){
    // prepare arguments:
    
                    // argument is reference
                    RExporter*
                    ap0 =
                    qscriptvalue_cast<
                    RExporter*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if( ap0 == NULL ){
                           return REcmaHelper::throwError("RPointEntity: Argument 0 is not of type RExporter*.",
                               context);                    
                    }
                    RExporter& a0 = *ap0;
                
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->exportEntity(a0);
    } else


        
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RExporter */
     && (
            context->argument(1).isBool()
        ) /* type: bool */
    
    ){
    // prepare arguments:
    
                    // argument is reference
                    RExporter*
                    ap0 =
                    qscriptvalue_cast<
                    RExporter*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if( ap0 == NULL ){
                           return REcmaHelper::throwError("RPointEntity: Argument 0 is not of type RExporter*.",
                               context);                    
                    }
                    RExporter& a0 = *ap0;
                
                    // argument isStandardType
                    bool
                    a1 =
                    (bool)
                    
                    context->argument( 1 ).
                    toBool();
                
    // end of arguments

    // call C++ function:
    // return type 'void'
//.........这里部分代码省略.........
开发者ID:konysulphrea,项目名称:qcad,代码行数:101,代码来源:REcmaPointEntity.cpp


示例8: getSelf

         QScriptValue
        REcmaLeaderData::getReferencePoints
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaLeaderData::getReferencePoints", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaLeaderData::getReferencePoints";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RLeaderData* self = 
                        getSelf("getReferencePoints", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    0
    ){
    // prepare arguments:
    
    // end of arguments

    // call C++ function:
    // return type 'QList < RVector >'
    QList < RVector > cppResult =
        
               self->getReferencePoints();
        // return type: QList < RVector >
                // List of ...:
                result = REcmaHelper::listToScriptValue(engine, cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isNumber()
        ) /* type: RS::ProjectionRenderingHint */
    
    ){
    // prepare arguments:
    
                    // argument isStandardType
                    RS::ProjectionRenderingHint
                    a0 =
                    (RS::ProjectionRenderingHint)
                    (int)
                    context->argument( 0 ).
                    toNumber();
                
    // end of arguments

    // call C++ function:
    // return type 'QList < RVector >'
    QList < RVector > cppResult =
        
               self->getReferencePoints(a0);
        // return type: QList < RVector >
                // List of ...:
                result = REcmaHelper::listToScriptValue(engine, cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RLeaderData.getReferencePoints().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaLeaderData::getReferencePoints", context, engine);
            return result;
        }
开发者ID:Alpha-Kand,项目名称:qcad,代码行数:81,代码来源:REcmaLeaderData.cpp


示例9: getSelf

    // public methods:
     QScriptValue
        REcmaMoveReferencePointOperation::apply
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaMoveReferencePointOperation::apply", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaMoveReferencePointOperation::apply";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RMoveReferencePointOperation* self = 
                        getSelf("apply", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RDocument */
    
    ){
    // prepare arguments:
    
                    // argument is reference
                    RDocument*
                    ap0 =
                    qscriptvalue_cast<
                    RDocument*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if( ap0 == NULL ){
                           return REcmaHelper::throwError("RMoveReferencePointOperation: Argument 0 is not of type RDocument*.",
                               context);                    
                    }
                    RDocument& a0 = *ap0;
                
    // end of arguments

    // call C++ function:
    // return type 'RTransaction'
    RTransaction cppResult =
        
               self->apply(a0);
        // return type: RTransaction
                // not standard type nor reference
                result = qScriptValueFromValue(engine, cppResult);
            
    } else


        
    
    if( context->argumentCount() ==
    2 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RDocument */
     && (
            context->argument(1).isBool()
        ) /* type: bool */
    
    ){
    // prepare arguments:
    
                    // argument is reference
                    RDocument*
                    ap0 =
                    qscriptvalue_cast<
                    RDocument*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if( ap0 == NULL ){
                           return REcmaHelper::throwError("RMoveReferencePointOperation: Argument 0 is not of type RDocument*.",
                               context);                    
                    }
                    RDocument& a0 = *ap0;
                
                    // argument isStandardType
                    bool
                    a1 =
                    (bool)
                    
                    context->argument( 1 ).
//.........这里部分代码省略.........
开发者ID:fallenwind,项目名称:qcad,代码行数:101,代码来源:REcmaMoveReferencePointOperation.cpp


示例10: main

int main(int argc, char *argv[])
{
	int counter=0;
	FILE *fd = NULL;fopen("./client.out", "w+");
	if ( fd != NULL )
		setOutputType(fd);
	else
		setOutputType(stderr);

	
	setLogLevel(LOG_LEVEL_DEBUG);

	uint8_t keep_alive = 1;
	uint8_t msg_type = 0, timeout = 0;
	int sockfd = 0, n = 0,c=0,xadd=0,yadd=1,BCD=0,running=1, startx=30,starty=30;
	char recvBuff[1024];
	uint8_t gameStarted = 0,fakeResponded=0;
	struct EventPlayer event;
	sleep_time.tv_sec  = 0;
    	sleep_time.tv_nsec = 450000000;

	memset(recvBuff, '0',sizeof(recvBuff));


	if(argc != 3)
	{
		printf("\n Usage: %s <ip of server> <port of server>\n",argv[0]);
		return 1;
	}

	init_game();
	
	keep_alive = ConnectToServer(argv[1], argv[2], &sockfd);

	while (keep_alive)
	{
		
		void *buf = NULL;
		buf = RecieveMessage(sockfd, &msg_type, &timeout);
		
		if ( timeout == 5 ) {
			keep_alive = 0;
			ERROR("Connection to server timed out\n");
		} else {
			if(buf){
				switch(msg_type) {
					case 2:
						/* Player just connected to server;
							Message contains servers rules; */
						NOTICE("Connected to server, please stand by\n");
						CreateClientWorld(&game, buf);
						break;
					case 3:
						/* Update message received; calculate wait for button pressed */
						DEBUG("Update information recieved\n" /*TODO add data here for debuging */);
						updateClientWorld(&game,buf);
						gameStarted = 1;
						break;
					default:
						keep_alive = 0;
						DEBUG("Trashed unhandeled message type:%d\n", msg_type);
						break;
				}
				free(buf);
			}

			if (gameStarted)
			{
				
				//init_game();
				c = wgetch(key_detecter);
				
				if ( c != ERR ) {
					NOTICE(" WE PRESSED: %c\n",c);
					ClientMove(c, &game);//TODO pass c to world-done
				}		
				event.direction = (getSelf(&game))->direction;
				if ( c == ' ')
					event.shot = 1;
				else
					event.shot = 0;
				SendMessage(sockfd, &event, sizeof(event), PCKT_EVENT);
			 	DEBUG("Sending update event { %d, %d } to server \n", event.direction, event.shot );

	    	}
			drawWorld(&game);	
			getchar();		
			refresh();			
		}
	}
	NOTICE("Disconnected from server\n");
	if (fd != NULL)
		fclose(fd);
	//terminate_game();
	return 0;
}
开发者ID:krjohnn,项目名称:tron,代码行数:96,代码来源:client.c


示例11: getSelf

         QScriptValue
        REcmaLinetypePattern::equals
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaLinetypePattern::operator==", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaLinetypePattern::operator==";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RLinetypePattern* self = 
                        getSelf("operator==", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RLinetypePattern */
    
    ){
    // prepare arguments:
    
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RLinetypePattern*
                    ap0 =
                    qscriptvalue_cast<
                    RLinetypePattern*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if (ap0 == NULL) {
                           return REcmaHelper::throwError("RLinetypePattern: Argument 0 is not of type RLinetypePattern.",
                               context);                    
                    }
                    RLinetypePattern 
                    a0 = 
                    *ap0;
                
    // end of arguments

    // call C++ function:
    // return type 'bool'
    bool cppResult =
        
               self->operator==(a0);
        // return type: bool
                // standard Type
                result = QScriptValue(cppResult);
            
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RLinetypePattern.equals().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaLinetypePattern::operator==", context, engine);
            return result;
        }
开发者ID:VixMobile,项目名称:qcad,代码行数:72,代码来源:REcmaLinetypePattern.cpp


示例12: _l

// only for debugging / logging
int FramebufferNativeWindow::getCurrentBufferIndex() const
{
    Mutex::Autolock _l(mutex);
    const int index = mCurrentBufferIndex;
    return index;
}

int FramebufferNativeWindow::dequeueBuffer(ANativeWindow* window, 
#ifdef QCOM_HARDWARE
        android_native_buffer_t** buffer)
#else
        ANativeWindowBuffer** buffer)
#endif
{
    FramebufferNativeWindow* self = getSelf(window);
#ifndef QCOM_HARDWARE
    Mutex::Autolock _l(self->mutex);
#endif
    framebuffer_device_t* fb = self->fbDev;

#ifdef QCOM_HARDWARE
    int index = self->mBufferHead;
#else
    int index = self->mBufferHead++;
    if (self->mBufferHead >= self->mNumBuffers)
        self->mBufferHead = 0;
#endif

    GraphicLog& logger(GraphicLog::getInstance());
    logger.log(GraphicLog::SF_FB_DEQUEUE_BEFORE, index);
开发者ID:arjen75,项目名称:Android_Frameworks_Base-,代码行数:31,代码来源:FramebufferNativeWindow.cpp


示例13: getSelf

int GonkNativeWindowClient::hook_lockBuffer_DEPRECATED(ANativeWindow* window,
        ANativeWindowBuffer* buffer) {
    GonkNativeWindowClient* c = getSelf(window);
    return c->lockBuffer_DEPRECATED(buffer);
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:5,代码来源:GonkNativeWindowClientKK.cpp


示例14: va_start

int GonkNativeWindowClient::hook_perform(ANativeWindow* window, int operation, ...) {
    va_list args;
    va_start(args, operation);
    GonkNativeWindowClient* c = getSelf(window);
    return c->perform(operation, args);
}
开发者ID:AtulKumar2,项目名称:gecko-dev,代码行数:6,代码来源:GonkNativeWindowClientKK.cpp


示例15: getSelf

         QScriptValue
        REcmaTextEntity::setData
        (QScriptContext* context, QScriptEngine* engine) 
        
        {
            //REcmaHelper::functionStart("REcmaTextEntity::setData", context, engine);
            //qDebug() << "ECMAScript WRAPPER: REcmaTextEntity::setData";
            //QCoreApplication::processEvents();

            QScriptValue result = engine->undefinedValue();
            
                    // public function: can be called from ECMA wrapper of ECMA shell:
                    RTextEntity* self = 
                        getSelf("setData", context);
                  

                //Q_ASSERT(self!=NULL);
                if (self==NULL) {
                    return REcmaHelper::throwError("self is NULL", context);
                }
                
    
    if( context->argumentCount() ==
    1 && (
            context->argument(0).isVariant() || 
            context->argument(0).isQObject() || 
            context->argument(0).isNull()
        ) /* type: RTextData */
    
    ){
    // prepare arguments:
    
                    // argument isCopyable and has default constructor and isSimpleClass 
                    RTextData*
                    ap0 =
                    qscriptvalue_cast<
                    RTextData*
                        >(
                        context->argument(
                        0
                        )
                    );
                    if (ap0 == NULL) {
                           return REcmaHelper::throwError("RTextEntity: Argument 0 is not of type RTextData.",
                               context);                    
                    }
                    RTextData 
                    a0 = 
                    *ap0;
                
    // end of arguments

    // call C++ function:
    // return type 'void'
    
               self->setData(a0);
    } else


        
            {
               return REcmaHelper::throwError("Wrong number/types of arguments for RTextEntity.setData().",
                   context);
            }
            //REcmaHelper::functionEnd("REcmaTextEntity::setData", context, engine);
            return result;
        }
开发者ID:DanielJSlick,项目名称:qcad,代码行数:67,代码来源:REcmaTextEntity.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ getSensor函数代码示例发布时间:2022-05-28
下一篇:
C++ getSelection函数代码示例发布时间:2022-05-28
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap