Example #1
0
TEST_F( VideoPlayerZIndex, video_overlayed ) {
	ASSERT_TRUE( _player->setProperty( "src", util::getImageName("video.mp4") ));
	ASSERT_TRUE( _player->setProperty( "bounds", canvas::Rect(0,0,100,100) ));

	player::Player* imgPlayer1 = createPlayer( player::type::image );
	ASSERT_TRUE ( imgPlayer1->setProperty( "src", util::getImageName("image.png") ) );
	ASSERT_TRUE ( imgPlayer1->setProperty( "bounds", canvas::Rect(0,0,720,576) ) );
	ASSERT_TRUE ( imgPlayer1->setProperty( "fit","fill" ) );
	ASSERT_TRUE ( imgPlayer1->setProperty( "zIndex", 0 ) );
	ASSERT_TRUE ( imgPlayer1->play() );

	player::Player* imgPlayer2 = createPlayer( player::type::image );
	ASSERT_TRUE ( imgPlayer2->setProperty( "src", util::getImageName("red_100_100.jpg") ) );
	ASSERT_TRUE ( imgPlayer2->setProperty( "bounds", canvas::Rect(0,0,360,288) ) );
	ASSERT_TRUE ( imgPlayer2->setProperty( "fit","fill" ) );
	ASSERT_TRUE ( imgPlayer2->setProperty( "zIndex", 1 ) );
	ASSERT_TRUE ( imgPlayer2->play() );

	player::Player* imgPlayer3 = createPlayer( player::type::image );
	ASSERT_TRUE ( imgPlayer3->setProperty( "src", util::getImageName("green.jpg") ) );
	ASSERT_TRUE ( imgPlayer3->setProperty( "bounds", canvas::Rect(360,288,360,288) ) );
	ASSERT_TRUE ( imgPlayer3->setProperty( "fit","fill" ) );
	ASSERT_TRUE ( imgPlayer3->setProperty( "zIndex", 3 ) );
	ASSERT_TRUE ( imgPlayer3->play() );

	ASSERT_TRUE ( _player->setProperty( "bounds", canvas::Rect(240,192,240,192) ) );
	ASSERT_TRUE ( _player->setProperty( "zIndex", 2 ) );
	ASSERT_TRUE ( _player->play() );
	ASSERT_TRUE ( util::compareImages( canvas(),  getExpectedPath("video_overlayed")) );

	destroyPlayer( imgPlayer1 );
	destroyPlayer( imgPlayer2 );
	destroyPlayer( imgPlayer3 );
}
Example #2
0
//Initialise le jeu aux valeurs de départs
void Bomberman::init()
{
	_window.draw(_map);

	//Crée deux joueurs
	createPlayer(Position(1,1,20), &_map, _playerTexture);
	createPlayer(Position(12, 12, 20), &_map, _playerTexture);


}
Example #3
0
void GameObjectLoader::loadLevel(string path)
{
	vector<glm::fvec2> wallsPos;
	glm::fvec2 playerPos;
	glm::fvec2 whiteHolePos;
	GLuint fieldSize;
	ifstream levelFile;
	levelFile.open(path);
	string buffer;
	getline(levelFile, buffer);
	try {
		fieldSize = stoi(buffer);
	}
	catch (invalid_argument e)
	{
		cerr << "Error on reading level";
		return;
	}
	GLint radius = fieldSize / 2;
	// Read and parse file
	for (unsigned int i = 0; i < fieldSize; i++)
	{
		getline(levelFile, buffer);
		const char * line = buffer.c_str();
		for (unsigned int j = 0; j < fieldSize; j++)
		{
			glm::fvec2 curPos = glm::fvec2(- radius + (int)j, - radius + (int)i);
			switch (line[j])
			{
				case '0':
					break;
				case '1':
				{
					wallsPos.push_back(curPos);
				}break;
				case '2':
				{
					whiteHolePos = curPos;
				}break;
				case '3':
				{
					playerPos = curPos;
				}break;
				default:
				{
					throw invalid_argument("Incorrect file format");
				}
			}
		}
	}
	
	generateField(glm::fvec2(0.0f, 0.0f), fieldSize);
	for (glm::fvec2 curPos : wallsPos)
		createWall(curPos);
	createPlayer(playerPos);
	creatWhiteHole(whiteHolePos);
	EnergyBar * bar = new EnergyBar(glm::fvec2(-1.0f + 0.255 + 0.01f, 1.0f - 0.128 - 0.01f), loader, font);
	this->manager->addObject(bar);
	this->manager->swapWalls();
}
Example #4
0
static AudioPlayer *loadAudioPlayer(const char *libdir)
{
	static const char *const so_names[] = {
		"emusound",
		"emusound2",
	};

	void *handle = NULL;
	for (int i = 0; i < NELEM(so_names); i++) {
		char path[1024];
		snprintf(path, sizeof(path), "%s/lib%s.so", libdir, so_names[i]);
		handle = dlopen(path, RTLD_NOW);
		if (handle != NULL)
			break;

		LOGD("Cannot load %s: %s", path, dlerror());
	}
	if (handle == NULL)
		return NULL;

	AudioPlayer *(*createPlayer)() = (AudioPlayer *(*)())
			dlsym(handle, "createPlayer");
	if (createPlayer == NULL) {
		dlclose(handle);
		return NULL;
	}
	return createPlayer();
}
Example #5
0
PlayerController::PlayerController()
    : QObject(), m_model(0), m_playlistModel(0), m_songsAvailable(false),
      m_currentSong(-1), m_shuffle(false), m_repeat(false), m_shuffleIndex(-1),
      m_mediaObject(0), m_audioOutput(0)
{
    createPlayer();
}
//GAME OVER RESTART THE WHOLE GAME
void restart(void){
	
	gameState = PLAY;
	createPlayer();
	createLevel();

}
Example #7
0
// Create a game in the inital state
Game newGame(int discipline[], int dice[]) {
    // Create a game
    Game g;
    g = malloc (sizeof (struct _game));
    assert(g != NULL);
    // Initialise each uni with the appropriate details
    int i = 0;
    while (i < NUM_UNIS) {
        createPlayer(g, i);
        i++;
    }

    createBoard(g, discipline, dice);

    // Initialise the mostARCs and mostPubs as no one
    g->mostARCs = malloc (sizeof (struct _uni));
    g->mostARCs->ARCGrants = 0;
    g->mostARCs->uniID = NO_ONE;
    g->mostPubs = malloc (sizeof (struct _uni));
    g->mostPubs->papers = 0;
    g->mostPubs->uniID = NO_ONE;

    // Initialise the current turn and roll
    g->currentTurn = -1;
    g->roll = 0;
    // put in initial campuses and retraining centres

    createStartCampuses(g);
    createRetrainingPoints(g);

    return g;
}
Example #8
0
/**
 * Get all Cards from HumanPlayer, with otherPlayerCardCount, with the topDepotCard and so on
 * @brief Playground::initPlayground
 * @param humanPlayerCards
 * @param otherPlayerCardCount
 * @param topDepotCard
 * @param _wishSuitCard
 * @param playerNames
 */
void Playground::initPlayground(const std::vector<Card> humanPlayerCards, std::map<PLAYER::Name, int> otherPlayerCardCount, const Card& topDepotCard, Card::cardValue _wishSuitCard, std::vector<std::string> playerNames)
{
    wishSuitCard = _wishSuitCard;
    createPlayer(humanPlayerCards, otherPlayerCardCount, playerNames);
    CardItem depotCard(topDepotCard);
    updateDepotCard(depotCard, depot);
}
Example #9
0
int opensles_player_alloc(struct auplay_st **stp, struct auplay *ap,
			  struct auplay_prm *prm, const char *device,
			  auplay_write_h *wh, void *arg)
{
	struct auplay_st *st;
	int err;

	(void)device;

	st = mem_zalloc(sizeof(*st), auplay_destructor);
	if (!st)
		return ENOMEM;

	st->ap  = mem_ref(ap);
	st->wh  = wh;
	st->arg = arg;

	err = createOutput(st);
	if (err)
		goto out;

	err = createPlayer(st, prm);
	if (err)
		goto out;

	bqPlayerCallback(st->BufferQueue, st);

 out:
	if (err)
		mem_deref(st);
	else
		*stp = st;

	return err;
}
void PlayerNetworking::PostObjectCreate()
{
    // complete setting up ghost ( remote client ) or server-side player
    if ( isRemoteClient() ) 
    {
        // create the player and its related entities
        createPlayer();

        // setup new connected client
        if ( yaf3d::GameState::get()->getMode() == yaf3d::GameState::Server )
        {
            // send intialization data
            static tInitializationData init;
            osg::Vec3f pos = _loadedPlayerEntity->getPlayerImplementation()->getPlayerPosition();
            _positionX = pos.x();
            _positionY = pos.y();
            _positionZ = pos.z();
            osg::Quat  rot = _loadedPlayerEntity->getPlayerImplementation()->getPlayerRotation();
            double angle;
            osg::Vec3d vec( 0.0, 0.0, 1.0 );
            rot.getRotate( angle, vec );
            _yaw = angle;
            init._posX = _positionX;
            init._posY = _positionY;
            init._posZ = _positionZ;
            init._rotZ = _yaw;

            ALL_REPLICAS_FUNCTION_CALL( RPC_Initialize( init ) );
        }
    }

    log_info << " player created: " << _p_playerName << std::endl;
}
Example #11
0
void Volley::init()
{
	isReset = true;
	EventManager::get()->addListener((IEventListener*)this, LAUNCH_BALL);
	EventManager::get()->addListener((IEventListener*)this, SCORE);
	field = ActorFactory::get()->createActor("Field.xml");

	createPlayer(1, p1Horiz, p1Vert);
	createPlayer(2, p2Horiz, p2Vert);
	paddles.push_back(p1Horiz);
	paddles.push_back(p2Horiz);
	paddles.push_back(p1Vert);
	paddles.push_back(p2Vert);

	makeBumpers();
	makeBall();
}
Example #12
0
static void initPlayer (void)
{
	player = createPlayer();
	setPosition (player, 50, 50);
	setSpeed (player, 2);
	player->jump_speed = 4;
	initPlayerTexture();
}
  Game() : board_(Board(FLAGS_cols, FLAGS_rows)), curr_player_(0) {
    // Parse AI type from arguments
    std::string player_types_str[2];
    splitStrIntoTwoStr(FLAGS_ai, player_types_str);
    player_type_[0] = getPlayerTypeFromString(player_types_str[0]);
    player_type_[1] = getPlayerTypeFromString(player_types_str[1]);
    // Parse Max-Depth from arguments
    splitStrIntoTwoSize_t(FLAGS_max_depth, player_max_depth_);
    // Parse weight heuristic options
    splitStrIntoTwoFloatLists(FLAGS_wh, player_wh_);
    CHECK_EQ(player_wh_[0].size(), 6);
    CHECK_EQ(player_wh_[1].size(), 6);
    // Parse Negamax random expansion
    splitStrIntoTwoBool(FLAGS_random, player_random_);

    players_[0] = createPlayer(0, 'O', 'X');
    players_[1] = createPlayer(1, 'X', 'O');
  }
Example #14
0
int main(void)
{
	int width = 4;
	int height = 16;

	// create two players...
	Player *player1 = createPlayer("Player1");
	Player *player2 = createPlayer("Player2");

	// game logic and the like
	Engine *engine = createEngine(consoleRenderer, eventHandler);

	// initialize renderer
	initConsoleRenderer(width + 2, height + 2);

	while (TRUE)
	{
		// create the game board
		SuPong *suPong = createGame(width, height, player1, player2);
		resetEngine(engine);
		
		// now run the game...
		while (engine->state == RUNNING)
		{
			engineTick(engine, suPong);
			usleep(100000);
		}

		// engine->state now contains the winner...
		// you could for example restart the game for a next match...
		// do this by calling run(engine, suPong) again
		//	engine->state

		renderGameEnd(engine);
		usleep(1000000);
	}

	// shutdown renderer
	shutdownConsoleRenderer();

	return 0;
}
Example #15
0
void World::initialize()
{
    rd::Renderer::getView().setSize(static_cast<sf::Vector2f>(ah::Application::instance().getSize()));

    mMap.load();

    mResources.loadTexture("male_walkcycle_body","Assets/Textures/male_walkcycle_body.png");
    mResources.loadTexture("male_walkcycle_legs","Assets/Textures/male_walkcycle_legs.png");
    mResources.loadTexture("male_walkcycle_rarm","Assets/Textures/male_walkcycle_rarm.png");
    mResources.loadTexture("male_walkcycle_larm","Assets/Textures/male_walkcycle_larm.png");
    mResources.loadTexture("male_spellcast_larm","Assets/Textures/male_spellcast_larm.png");
    mResources.loadTexture("weapons","Assets/Textures/weapons.png");
    mResources.loadTexture("projectiles","Assets/Textures/projectiles.png");
    mResources.loadTexture("spell","Assets/Textures/spell.png");

    mResources.getTexture("male_walkcycle_body").setSmooth(true);
    mResources.getTexture("male_walkcycle_legs").setSmooth(true);
    mResources.getTexture("male_walkcycle_rarm").setSmooth(true);
    mResources.getTexture("male_walkcycle_larm").setSmooth(true);
    mResources.getTexture("male_spellcast_larm").setSmooth(true);
    mResources.getTexture("weapons").setSmooth(true);
    mResources.getTexture("projectiles").setSmooth(true);
    mResources.getTexture("spell").setSmooth(true);

    mEntities.addSystem<PlayerControllerSystem>();
    mEntities.addSystem<MovementSystem>();
    mEntities.addSystem<LifeSystem>();
    mEntities.addSystem<HumanSystem>();
    mEntities.addSystem<CollisionSystem>(mMap);
    mEntities.addSystem<SpellSystem>();
    mEntities.addSystem<ProjectileSystem>();
    mEntities.addSystem<ItemSystem>();
    mEntities.addSystem<AIControllerSystem>();

    mFactions.create(1);
    mFactions.get(1).setName("LostEmpire");
    mFactions.get(1).addEnemy(2);

    mFactions.create(2);
    mFactions.get(2).setName("The Evil");
    mFactions.get(2).addEnemy(1);

    /*
    // Load Entities
    createPlayer(sf::Vector2f(0,0));
    createItem(sf::Vector2f(200,200), std::make_shared<Item>());
    createMonster(sf::Vector2f(400,300),MonsterComponent::Type::Bat);
    createMonster(sf::Vector2f(425,375),MonsterComponent::Type::Bee);
    createPacific(sf::Vector2f(50,50));
    createFighter(sf::Vector2f(50,200));
    */

    createPlayer(sf::Vector2f(100,100));
}
Example #16
0
int opensles_player_alloc(struct auplay_st **stp, const struct auplay *ap,
			  struct auplay_prm *prm, const char *device,
			  auplay_write_h *wh, void *arg)
{
	struct auplay_st *st;
	int err;
	(void)device;

	if (!stp || !ap || !prm || !wh)
		return EINVAL;

	debug("opensles: opening player %uHz, %uchannels\n",
			prm->srate, prm->ch);

	st = mem_zalloc(sizeof(*st), auplay_destructor);
	if (!st)
		return ENOMEM;

	st->ap  = ap;
	st->wh  = wh;
	st->arg = arg;

	st->sampc = prm->srate * prm->ch * PTIME / 1000;

	st->bufferId   = 0;
	for (int i=0; i<N_PLAY_QUEUE_BUFFERS; i++) {
		st->sampv[i] = mem_zalloc(2 * st->sampc, NULL);
		if (!st->sampv[i]) {
			err = ENOMEM;
			goto out;
		}
	}

	err = createOutput(st);
	if (err)
		goto out;

	err = createPlayer(st, prm);
	if (err)
		goto out;

	/* kick-start the buffer callback */
	bqPlayerCallback(st->BufferQueue, st);

 out:
	if (err)
		mem_deref(st);
	else
		*stp = st;

	return err;
}
Example #17
0
bool Player::init(Vec2 pos) {
	if (!Sprite::init()) {
		return false;
	}
	this->playerPos = pos;
	isRunAction = false;
	arrowArr = Array::create();
	arrowArr->retain();
	createPlayer();
	createPlayerHP();
	scheduleUpdate();
	return true;
}
Example #18
0
Player* PlayerManager::createHumanPlayer(const Ogre::String& name, Ogre::RenderWindow *window, GUI* gui)
{
    // TODO: Handle Human Multiplayer, also this code should be somewhere else
    Ogre::Camera *camera = mSceneMgr->createCamera("Player1");
    camera->setNearClipDistance(NEAR_CLIP_DISTANCE);
    Ogre::Viewport *vp = window->addViewport(camera);
    vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
    camera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));

    HumanController* hc = new HumanController(gui);
    Player* player = createPlayer(name + "Human", hc, false);
    player->attachCamera(camera);
    return player;
}
Example #19
0
void AGOSEngine::readGamePcFile(Common::SeekableReadStream *in) {
	int num_inited_objects;
	int i;

	num_inited_objects = allocGamePcVars(in);

	createPlayer();
	readGamePcText(in);

	for (i = 2; i < num_inited_objects; i++) {
		readItemFromGamePc(in, _itemArrayPtr[i]);
	}

	readSubroutineBlock(in);
}
Example #20
0
TEST_F( VideoPlayerLocation, move_and_resize) {
    ASSERT_TRUE( _player->setProperty( "src", util::getImageName("video.mp4") ));
    ASSERT_TRUE( _player->setProperty( "bounds", canvas::Rect(0,0,100,100) ));

    player::Player* imgPlayer = createPlayer( player::type::image );
    impl::setBackgroundImg(imgPlayer);

    ASSERT_TRUE( _player->play() );
    ASSERT_TRUE ( util::compareImages( canvas(),  getExpectedPath("before_moving")) );

    ASSERT_TRUE ( _player->setProperty( "bounds", canvas::Rect(520,376,200,200) ));
    ASSERT_TRUE ( util::compareImages( canvas(), getExpectedPath("after_moving_and_resizeing") ) );

    destroyPlayer(imgPlayer);
}
Example #21
0
TEST_F( VideoPlayerLocation, move_topleft_to_bottomright_out_of_bounds ) {
    ASSERT_TRUE( _player->setProperty( "src", util::getImageName("video.mp4") ));
    ASSERT_TRUE( _player->setProperty( "bounds", canvas::Rect(0,0,100,100) ));

    player::Player* imgPlayer = createPlayer( player::type::image );
    impl::setBackgroundImg(imgPlayer);

    ASSERT_TRUE( _player->play() );
    ASSERT_TRUE ( util::compareImages( canvas(),  getExpectedPath("before_moving")) );

    ASSERT_FALSE ( _player->setProperty( "bounds", canvas::Rect(700,500,100,100) ));
    ASSERT_TRUE ( util::compareImages( canvas(), getExpectedPath("before_moving") ) );

    destroyPlayer(imgPlayer);
}
Example #22
0
void rScene5::start()
{
	message = "";
	nenemies = 0;

	RM->loadTexture("potato", "res/img/potato.png");
	RM->loadTexture("enemy", "res/img/enemy.png");
	RM->loadTexture("bullet", "res/img/bullet.png");
	RM->loadTexture("door", "res/img/door.png");

	createWorld("res/scene/s4w_collisions.png", bWorldType::COLLISION);
	createWorld("res/scene/s4w_enemies.png", bWorldType::ENEMIES);
	createWorld("res/scene/s4w_door.png", bWorldType::DOOR);

	createSpotlight();
	createPlayer(64, 352);
}
Example #23
0
/* Load additional info */
void Test::loadAditionalData(void)
{

	createLevelManager();
	createPlayer();
	createBombs();
	createCivils();
	createZombies();
	createBillboardSet();
	createCollectable();

	Ogre::DotSceneLoader dsl;
//	dsl.parseDotScene("metros.scene", "Popular", GLOBAL_SCN_MNGR);
	dsl.parseDotScene("generic.scene", "Popular", GLOBAL_SCN_MNGR);


}
Example #24
0
void Editor::giveCursorPos(glm::vec2 pos)
{
	if (mode == 1 && clickTimer < FLT_EPSILON)
	{
		createObject(pos, currentColor);
		clickTimer = 0.3f;
	}
	if (mode == 2 && clickTimer < FLT_EPSILON)
	{
		createPlayer(pos);
		clickTimer = 0.3f;
	}
	if (mode == 3 && clickTimer < FLT_EPSILON)
	{
		createGoal(pos);
		clickTimer = 0.3f;
	}
}
Example #25
0
Level::Level(HGE* _hge, int xRes, int yRes)
{
	hge = _hge;
	this->xRes = xRes;
	this->yRes = yRes;
	//set up level
	gravity = new hgeVector(0,5);
	terrain = new Terrain(xRes,yRes,_hge);
	font = new hgeFont("font.fnt", true);
	//set up gfx
	particleManager = new hgeParticleManager();
	HTEXTURE texture = hge->Texture_Load("ships.png");
	hgeSprite* sprite = new hgeSprite(texture, 0,0,30,30);
	sprite->SetHotSpot(15, 15);
	collisionLarge = new hgeParticleSystem("particle9.psi", sprite);
	//create a player & enemy
	createPlayer(xRes/2, yRes/2);
	createEnemy(100, 100);
}
Example #26
0
status_t MediaPlayerService::Client::setDataSource(int fd, int64_t offset, int64_t length)
{
    LOGV("setDataSource fd=%d, offset=%lld, length=%lld", fd, offset, length);
    struct stat sb;
    int ret = fstat(fd, &sb);
    if (ret != 0) {
        LOGE("fstat(%d) failed: %d, %s", fd, ret, strerror(errno));
        return UNKNOWN_ERROR;
    }

    LOGV("st_dev  = %llu", sb.st_dev);
    LOGV("st_mode = %u", sb.st_mode);
    LOGV("st_uid  = %lu", sb.st_uid);
    LOGV("st_gid  = %lu", sb.st_gid);
    LOGV("st_size = %llu", sb.st_size);

    if (offset >= sb.st_size) {
        LOGE("offset error");
        ::close(fd);
        return UNKNOWN_ERROR;
    }
    if (offset + length > sb.st_size) {
        length = sb.st_size - offset;
        LOGV("calculated length = %lld", length);
    }

    player_type playerType = getPlayerType(fd, offset, length);
    LOGV("player type = %d", playerType);

    // create the right type of player
    sp<MediaPlayerBase> p = createPlayer(playerType);
    if (p == NULL) return NO_INIT;

    if (!p->hardwareOutput()) {
        mAudioOutput = new AudioOutput();
        static_cast<MediaPlayerInterface*>(p.get())->setAudioSink(mAudioOutput);
    }

    // now set data source
    mStatus = p->setDataSource(fd, offset, length);
    if (mStatus == NO_ERROR) mPlayer = p;
    return mStatus;
}
Example #27
0
status_t MediaPlayerService::Client::setDataSource(const char *url)
{
    LOGV("setDataSource(%s)", url);
    if (url == NULL)
        return UNKNOWN_ERROR;

    if (strncmp(url, "content://", 10) == 0) {
        // get a filedescriptor for the content Uri and
        // pass it to the setDataSource(fd) method

        String16 url16(url);
        int fd = android::openContentProviderFile(url16);
        if (fd < 0)
        {
            LOGE("Couldn't open fd for %s", url);
            return UNKNOWN_ERROR;
        }
        setDataSource(fd, 0, 0x7fffffffffLL); // this sets mStatus
        close(fd);
        return mStatus;
    } else {
        player_type playerType = getPlayerType(url);
        LOGV("player type = %d", playerType);

        // create the right type of player
        sp<MediaPlayerBase> p = createPlayer(playerType);
        if (p == NULL) return NO_INIT;

        if (!p->hardwareOutput()) {
            mAudioOutput = new AudioOutput();
            static_cast<MediaPlayerInterface*>(p.get())->setAudioSink(mAudioOutput);
        }

        // now set data source
        LOGV(" setDataSource");
        mStatus = p->setDataSource(url);
        if (mStatus == NO_ERROR) mPlayer = p;
        return mStatus;
    }
}
Example #28
0
void HexagonGame::newGame(string mId, bool mFirstPlay)
{
    clearMessages();

    setLevelData(getLevelData(mId), mFirstPlay);

    stopAllSounds();
    playSound("play");

    pm->resetAdj();

    stopLevelMusic();
    playLevelMusic();

    rotationDirection = getRnd(0, 100) > 50 ? true : false;

    scripts.clear();

    timeStop = 0;
    randomSideChangesEnabled = true;
    incrementEnabled = true;
    maxPulse = 85;
    minPulse = 75;
    pulseSpeedBackwards = 1;
    pulseSpeed = 1;

    hasDied = false;
    mustRestart = false;
    currentTime = 0;
    incrementTime = 0;
    setSides(levelData.getSides());
    radius = minPulse;

    manager.clear();
    createPlayer(manager, this, centerPos);

    scriptsTimeline = Timeline{};
    messagesTimeline = Timeline{};
    timeline = Timeline{};
}
Example #29
0
void GameCore::initializePlayers()
{
	teamDM=(gmc->getCurrentRoom()->getGameType()==0?false:true);
	unsigned char clientTeam=(teamDM?gmc->getLocalClient()->getTeam():(gmc->getLocalClient()->getColor()==0?0:1));

    std::map<unsigned int,GameClient*> clientMap=gmc->getCurrentRoom()->getClientMap();
    std::map<unsigned int,GameClient*>::iterator iter=clientMap.begin();
    GameClient* client;
    while(iter!=clientMap.end())
    {
        client=iter->second;
        if(client!=gmc->getLocalClient())
            createPlayer(client);
        iter++;
    }
    client=gmc->getLocalClient();
	localPlayer=new Player(client->getID(),client->getName(),true,true,clientTeam,sceneManager);
    localPlayer->createVisual("SpaceMarine.mesh", Quaternion::IDENTITY, Ogre::Vector3(2, 2, 2), Ogre::Vector3(-100, -100, -500));
    localPlayer->enablePhysics(dynamics);
	localPlayer->changePlayerColor(clientTeam);
    localPlayer->getAnimationController()->enableAnimation("Idle");
    localPlayer->getAnimationController()->addIdleAnimation("Run","Idle");
    localPlayer->getAnimationController()->enableAnimation("Run");

    cameraController->setTarget(localPlayer->getSceneNode());
    float cameraShift =-reader->getFieldValueAsDouble("CameraSettings", "camera-shift");
	cameraController->moveCamera(cameraShift,0);

    cameraController->rotateCamera(90, 0);
    cameraController->rotateCamera(0, 15);
    gmc->requestNextSpawnPoint();
    soundController->setListener(localPlayer->getSceneNode());

	//ingameGUI->setGameType(InGameGUIHandler::TEAM_MATCH);
	this->ingameGUI->showItem(ItemType::IMMORTALITY);
	this->ingameGUI->showItem(ItemType::EAGLE_EYE);
	this->ingameGUI->showItem(ItemType::ONE_SHOT);
}
//-------------------------------------------------------------------------
void pmWarpPiRendererVideoPlayer::setupVideoPlayer(string _name, bool active)
{
    pmWarpPiRendererDrawable::setupScreen();
    
    createPlayer();
    /// VIDEO PLAYER

    videoFileName = _name;
    isTesting=false;
    activePlayer = active;
    
    loadMovie();

    /// GUI
    if(!guiIsSetup)
    {
        gui->setup(); // most of the time you don't need a name but don't forget to call setup
        gui->add(screenOpacity.set( "opacity", 1.0, 0.0, 1.0));
        gui->add(maxScreenOpacity.set( "max opacity", 1.0, 0.0, 1.0));
        gui->setPosition(520, 20 + 75);
        guiIsSetup = true;
    }
}