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


C++ Platform类代码示例

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


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

示例1: Platform

void NickScene::shootGlobeHit(NickButton *button) {
    // shoot cannon at the globe
    m_globeCannon->shootCannon();
    
    //// create a platform
    Platform *platform = new Platform(this, Vector3(30.0f, 1.0f, 30.0f));
    if ( !platform->initialize(new LightShader(0.2f, 1.0f, 4, RAND_COLOR))) { GLOG("ERROR: Could not initialize second to last platform\n"); }
    platform->setPosition(Vector3(-60.0f, 50.0f, -560.0f));
    platform->addToDynamicWorld(m_dynamicsWorld);
    m_graph->attach(platform);
    
    ParticleSystem *system = new RandomParticleSystem(400);
    system->moveToPoint(0.0f, 50.0f, -600.0f);
    system->speed = 4.0f;
    system->speedVar = 3.0f;
    system->startSystem();
    m_graph->attach(system);
    
    // create a checkpoint now that user has gotten through trampolines
    FinishCheckPoint *cp = new FinishCheckPoint(this, "Objects/goal.obj", 0.125f);
    if ( !cp->initialize(new LightShader(0.1f, 1.0, 8, RAND_COLOR))) { GLOG("ERROR: could not create OBJmodel\n");}
    cp->setPosition(Vector3(0.0f, 32.0f, -600.0f));
    m_allCheckpoints.push_back(cp);
    cp->addToDynamicWorld(m_dynamicsWorld);
    m_graph->attach(cp);
}
开发者ID:ChuckNice,项目名称:SBU_Sources,代码行数:26,代码来源:nicks_scene.cpp

示例2: Update

void Pickup::Update(float dt, XNA::AxisAlignedBox *player, World* w)
{
	Platform* p = w->getPlatform(this->getCPID());

	if(p != NULL)
	{
		XMFLOAT3 pos = p->getPos();
		pos.x += this->mPos.x;
		pos.y += this->mPos.y;
		pos.z += this->mPos.z;

		mEntity->SetPosition(pos);
		this->mSphere.Center = pos;
	}

	if(XNA::IntersectSphereAxisAlignedBox(&mSphere, player))
	{
		struct Data
		{
			int id; //dummy
		};
		Data* data = new Data;
		data->id = this->mID;

		Network::GetInstance()->Push(new Package(Package::Header(9, this->mID, sizeof(Data)), Package::Body((char*)(data))));
	}
}
开发者ID:hyzor,项目名称:GameProject,代码行数:27,代码来源:Pickup.cpp

示例3: fileName

QList<Platform*>* MainWindow::loadPlatforms()
{
    QList<Platform*>* platfList = new QList<Platform*>;
    QString fileName("platforms.bin");
    QFile file(fileName);
    if(file.open(QIODevice::ReadOnly))
    {
        QDataStream stream(&file);
        stream.setVersion(QDataStream::Qt_5_3);
        while(!stream.atEnd())
        {
            Platform* platf = new Platform(this);
            stream >> platf;
            platfList->append(platf);
            qDebug() << "Платформа" << platf->getName() << "загружена";
        }
        if (stream.status() != QDataStream::Ok)
        {
            qDebug() << "Ошибка чтения файла";
            ui->statusBar->showMessage("Ошибка чтения файла");
        }
        else
        {
            qDebug() << "Все платформы загружены";
            ui->statusBar->showMessage("Все платформы загружены");
        }
    }
开发者ID:CyberYurich,项目名称:PC-Configurator,代码行数:27,代码来源:mainwindow.cpp

示例4: TODO

msg_t ControlThread::main() {
  // Build and initialize the system
  Platform platform;
  platform.init();

  auto& primaryStream = platform.get<USARTPlatform>().getPrimaryStream();
  SDCDriver& sdcd = platform.get<SDCPlatform>().getSDCDriver();   // TODO(yoos): make optional

  ParameterRepository params;
  GlobalParameters globalParams(params);

  // Start the background threads
  static HeartbeatThread heartbeatThread(params);
  static Communicator communicator(primaryStream);
  static Logger logger(sdcd, communicator);

  heartbeatThread.start(LOWPRIO);
  communicator.start();
  logger.start();

  // Build the unit
  Unit unit(platform, params, communicator, logger);

  // Loop at a fixed rate forever
  // NOTE: If the deadline is ever missed then the loop will hang indefinitely.
  systime_t deadline = chibios_rt::System::getTime();
  while(true) {
    deadline += MS2ST(params.get(GlobalParameters::PARAM_DT) * 1000);

    unit.getSystem().update();

    sleepUntil(deadline);
  }
}
开发者ID:OSURoboticsClub,项目名称:aerial_control,代码行数:34,代码来源:control_thread.cpp

示例5: FollowGround

bool Bipedal::FollowGround(Object & object, World & world, Sint8 velocity){
	if(velocity == 0 || currentplatformid == 0){
		return true;
	}
	object.x += velocity;
	Platform * currentplatform = world.map.platformids[currentplatformid];
	Platform * oldplatform = currentplatform;
	object.y = currentplatform->XtoY(object.x);
	if(object.x > currentplatform->x2){
		velocity = object.x - currentplatform->x2;
		object.x = currentplatform->x2;
		currentplatform = currentplatform->adjacentr;
	}else
	if(object.x < currentplatform->x1){
		velocity = -(Sint8)(currentplatform->x1 - object.x);
		object.x = currentplatform->x1;
		currentplatform = currentplatform->adjacentl;
	}else{
		return true;
	}
	if(currentplatform){
		currentplatformid = currentplatform->id;
		return FollowGround(object, world, velocity);
	}else{
		Platform * collided = world.map.TestAABB(object.x, object.y - height, object.x, object.y, Platform::RECTANGLE | Platform::STAIRSUP | Platform::STAIRSDOWN, oldplatform);
		if(collided){
			return true;
		}
		return false;
	}
	return true;
}
开发者ID:Phobia0ptik,项目名称:zSILENCER,代码行数:32,代码来源:bipedal.cpp

示例6: platform

    Platform* PlatformFactory::platform(const std::string &description)
    {
        int platform_id;
        bool is_found = false;
        Platform *result = NULL;
        platform_id = read_cpuid();
        for (auto it = platforms.begin(); it != platforms.end(); ++it) {
            if ((*it) != NULL && (*it)->model_supported(platform_id, description)) {
                result = (*it);
                break;
            }
        }
        for (auto it = platform_imps.begin(); it != platform_imps.end(); ++it) {
            if ((*it) != NULL && result != NULL &&
                (*it)->model_supported(platform_id)) {
                result->set_implementation((*it));
                is_found = true;
                break;
            }
        }
        if (!is_found) {
            result = NULL;
        }
        if (!result) {
            // If we get here, no acceptable platform was found
            throw Exception("cpuid: " + std::to_string(platform_id), GEOPM_ERROR_PLATFORM_UNSUPPORTED, __FILE__, __LINE__);
        }

        return result;
    }
开发者ID:bgeltz,项目名称:geopm,代码行数:30,代码来源:PlatformFactory.cpp

示例7: Should_Compile

bool AtlasResourceCompiler::Should_Compile()
{
	Platform* platform = Platform::Get();

	// If input dosen't exist, the wtf.
	if (!platform->Is_File(m_input_path.c_str()))
	{
		DBG_ASSERT_STR(false, "Attempt to compile non-existing resource '%s'.", m_input_path.c_str());
		return false;
	}

	// If input has been modified, compile is definitely required.
	if (Check_File_Timestamp(m_input_path))
	{
		return true;
	}

	// Read in the XML, so we can determine if there are any other dependent files.
	if (!Load_Config())
	{
		return false;
	}

	// Check dependent files.
	for (std::vector<std::string>::iterator iter = m_dependent_files.begin(); iter != m_dependent_files.end(); iter++)
	{
		std::string& path = *iter;
		if (Check_File_Timestamp(path.c_str()))
		{
			return true;
		}
	}

	return false;
}
开发者ID:HampsterEater,项目名称:VoxelEngine,代码行数:35,代码来源:AtlasResourceCompiler.cpp

示例8: clearLayer

void GameLayer::loadLevel (int level) {
    
    clearLayer();
    
    _currentLevel = level;
    
    resetLevel();
    
    CCDictionary * levelData = (CCDictionary *) _levels->objectAtIndex(_currentLevel);
    
    int count;
    CCDictionary * data;
    
    //create platforms
    CCArray * platforms = (CCArray *) levelData->objectForKey("platforms");
    Platform * platform;
    count = platforms->count();
    
    for (int i = 0; i < count; i++) {
        platform = (Platform *) _platformPool->objectAtIndex(_platformPoolIndex);
        _platformPoolIndex++;
        if (_platformPoolIndex == _platformPool->count()) _platformPoolIndex = 0;
        
        data = (CCDictionary *) platforms->objectAtIndex(i);
        platform->initPlatform (
                                data->valueForKey("width")->intValue() * TILE,
                                data->valueForKey("angle")->floatValue(),
                                ccp(data->valueForKey("x")->floatValue() * TILE,
                                    data->valueForKey("y")->floatValue() * TILE)
                                );
    }
}
开发者ID:pdpdds,项目名称:cocos2dx-dev,代码行数:32,代码来源:GameLayer.cpp

示例9: Error

void PlatformAddCmd::Run()
{
    ToolSystem* tsystem = GetSubsystem<ToolSystem>();
    Project* project = tsystem->GetProject();

    Platform* platform = tsystem->GetPlatformByName(platformToAdd_);

    if (!platform)
    {
        Error(ToString("Unknown platform: %s", platformToAdd_.CString()));
        return;
    }

    if (project->ContainsPlatform(platform->GetPlatformID()))
    {
        Error(ToString("Project already contains platform: %s", platformToAdd_.CString()));
        return;
    }

    LOGINFOF("Adding platform: %s", platformToAdd_.CString());

    project->AddPlatform(platform->GetPlatformID());

    Finished();
}
开发者ID:GREYFOXRGR,项目名称:AtomicGameEngine,代码行数:25,代码来源:PlatformAddCmd.cpp

示例10: if

int Ball::Update(){
    //if object is alive we update it 
    if(isAlive()){
        
        if(stand_on_platform){
            x = dynamic_cast<PlayingState*>(g_GamePtr->GetState())->GetPlatform()->GetX();
            y = dynamic_cast<PlayingState*>(g_GamePtr->GetState())->GetPlatform()->GetY()-15;
        }
        else{
            GameObject::Update();
            
            // we do a boundry checking
            if( x >= g_Game.GetScreen_W() -boundX || x<= boundX)
                dirX *= -1;
            else if( y <= boundY)
                dirY *= -1;
            else if ( y >= g_Game.GetScreen_H()){
                SetAlive(false);
                LoseEffect();
                Platform* platform = dynamic_cast<PlayingState*>(g_GamePtr->GetState())->GetPlatform();
                platform->LoseLife();
                platform->MorphPlatform(-1);            // calling platform to lose it's effect because ball has just died
            }
        }
        // we also update its animation if it exists
        if(animation) animation->Animate();
    }
    return 0;
}
开发者ID:Asiron,项目名称:Arkanoid,代码行数:29,代码来源:Ball.cpp

示例11: fileSystem

WebFileSystem* DOMFileSystemBase::fileSystem() const
{
    Platform* platform = Platform::current();
    if (!platform)
        return nullptr;
    return platform->fileSystem();
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:7,代码来源:DOMFileSystemBase.cpp

示例12: main

int main (int argc, char* argv[])
{
	//check parameters
	google::ParseCommandLineFlags(&argc, &argv, false);

	if (FLAGS_binaryFile.compare("")==0) {
		cerr<<"The input/output file parameters are mandatory"<<endl;
		return 1;
	}

	//architecture definition 
	Platform hw;

	if (add_processors(hw)<1) {
		cerr<<"Data not valid."<<endl;
		return -2;
	}

	if (add_links(hw)<1) {
		cerr<<"Data not valid."<<endl;
		return -2;
	}

	//output - serialization
	fstream output(FLAGS_binaryFile.c_str(), ios::out|ios::trunc|ios::binary);
	if (!hw.SerializeToOstream(&output)) {
		cerr << "Failed to serialize." << endl;
		return -1;
	}

	google::protobuf::ShutdownProtobufLibrary();

	return 0;
}
开发者ID:mbambagini,项目名称:mpSolver,代码行数:34,代码来源:hardware.cpp

示例13: lua_Platform_enterMessagePump

int lua_Platform_enterMessagePump(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 1:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA))
            {
                Platform* instance = getInstance(state);
                int result = instance->enterMessagePump();

                // Push the return value onto the stack.
                lua_pushinteger(state, result);

                return 1;
            }

            lua_pushstring(state, "lua_Platform_enterMessagePump - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 1).");
            lua_error(state);
            break;
        }
    }
    return 0;
}
开发者ID:1timmy,项目名称:GamePlay,代码行数:34,代码来源:lua_Platform.cpp

示例14: matchPackages

PackagePointerList PackageMatcher::matchPackages(const QString &name, const QString &version,
												 const Platform &host, const Platform &target) const
{
	Platform hst = host;
	if (hst.isEmpty()) {
		hst = Util::currentPlatform();
	}

	PackagePointerList result;
	// pending packages are those where we still have to check whether there isn't any higher
	// version
	QMap<QString, PackagePointer> pending;
	const PackagePointerList packages = m_packages->entities();
	for (PackagePointer pkg : packages) {
		if (pkg->id() == name && pkg->host().fuzzyCompare(hst) && pkg->target().fuzzyCompare(target)) {
			if (version.isEmpty()) {
				const QString identifier = QString("%1#%2#%3").arg(pkg->id(), pkg->host().toString(), pkg->target().toString());
				if (pending.contains(identifier)) {
					if (Util::isVersionHigherThan(pkg->version(),
												  pending[identifier]->version())) {
						pending[identifier] = pkg;
					}
				} else {
					pending[identifier] = pkg;
				}
			} else if (version == pkg->version()) {
				result.append(pkg);
			}
		}
	}
	result.append(pending.values());
	return result;
}
开发者ID:02JanDal,项目名称:soqute,代码行数:33,代码来源:packagematcher.cpp

示例15: getFileSystem

WebFileSystem* LocalFileSystem::getFileSystem() const
{
    Platform* platform = Platform::current();
    if (!platform)
        return nullptr;

    return platform->fileSystem();
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:8,代码来源:LocalFileSystem.cpp


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