Exemple #1
0
void Particles::initialize() {
  int displayxi = int(displayx); 
  int displayyi = int(displayy);
  int radiusi = int(radius);
  int wallwidthi = int(wallwidth);
  srand(time(NULL));
    
  for( int i = 0; i<Nparticles; i++ ) {
    float tempR = rand() % ((displayyi-24)/2);
    float tempAngle = rand() % 360;
    float tempX = -tempR*sin(tempAngle*conv);
    float tempY = tempR*cos(tempAngle*conv);
    sf::Vector2f temp(tempX, tempY);
    sf::Vector2f placeParticles = temp + centerofmap;
   
    particles.setPosition( placeParticles );
    
    sf::Vector2f currentParticle = particles.getPosition();
    sf::Vector2f tempPos(0,0);
    sf::Vector2f disVec(0,0);
    float distance = 0;

    // Need to check if particles overlap during initialization
    // if it does overlap, just move it by some amount
    // We do not need to check if there is just one particle
    if( i==0 ) {
      storeParticles.push_back( particles );
    }
    else { 
      for( it = storeParticles.begin(); it != storeParticles.end(); it++ ) {
	tempPos = (*it).getPosition();
	disVec = currentParticle - tempPos;
	
	distance = sqrt(pow(disVec.x,2) + pow(disVec.y,2) );

	if( distance < 2.2*radius ) deleted++;

	while( distance < 2.2*radius ){
	  (particles).setPosition( rand()%(displayxi-2*wallwidthi-3*radiusi)+(wallwidthi+1.5*radiusi), rand()%(displayyi-3*radiusi-2*wallwidthi)+(wallwidthi+1.5*radiusi) );
	  
	  currentParticle = particles.getPosition();
	  tempPos = (*it).getPosition();
	  disVec = currentParticle - tempPos;
	  distance = sqrt(pow(disVec.x,2) + pow(disVec.y,2) );
	  if( i>=2 ) {
	    for( bit=storeParticles.begin(); bit != it; bit++ ){
	      tempPos = (*bit).getPosition();
	      disVec = currentParticle - tempPos;
	      distance = sqrt( pow(disVec.x,2)+pow(disVec.y,2));
	      if( distance < 2.2*radius ){
		(particles).setPosition( rand()%(displayxi-2*wallwidthi-3*radiusi)+(wallwidthi+1.5*radiusi), rand()%(displayyi-3*radiusi-2*wallwidthi)+(wallwidthi+1.5*radiusi) );
	      }
	    }
	  }
	} 
      }
      storeParticles.push_back(particles);    
    }
  } 
}
Exemple #2
0
void Audio::setSpritePosition()
{
    sf::Vector2f tempPos(mWindow.getSize().x/2-mMainBackground.getSprite().getGlobalBounds().width/2, 0);
    sf::Vector2f tempPos2(mWindow.getSize().x/2-mInGameBackground.getSprite().getGlobalBounds().width/2, 0);
    mMainBackground.setPosition(tempPos);
    mInGameBackground.setPosition(tempPos2);
    mSoundVolume.setPosition(sf::Vector2f(tempPos.x + 300, tempPos.y + 150));

    mEffectLeftArrow.setPosition(sf::Vector2f(mSoundVolume.getSprite().getPosition().x + mSoundVolume.getSprite().getGlobalBounds().width + 12, tempPos.y + 150));
    mEffectNumbers100.setPosition(sf::Vector2f(mEffectLeftArrow.getSprite().getPosition().x + mEffectLeftArrow.getSprite().getGlobalBounds().width + 6, tempPos.y + 150));
    mEffectNumbers10.setPosition(sf::Vector2f(mEffectNumbers100.getSprite().getPosition().x + mEffectNumbers100.getSprite().getGlobalBounds().width + 6, tempPos.y + 150));
    mEffectNumbers1.setPosition(sf::Vector2f(mEffectNumbers10.getSprite().getPosition().x + mEffectNumbers10.getSprite().getGlobalBounds().width + 6, tempPos.y + 150));
    mEffectRightArrow.setPosition(sf::Vector2f(mEffectNumbers1.getSprite().getPosition().x + mEffectNumbers1.getSprite().getGlobalBounds().width + 6, tempPos.y + 150));

    mMusicVolume.setPosition(sf::Vector2f(tempPos.x + 300, tempPos.y + 250));

    mMusicLeftArrow.setPosition(sf::Vector2f(mMusicVolume.getSprite().getPosition().x + mMusicVolume.getSprite().getGlobalBounds().width + 12, tempPos.y + 250));
    mMusicNumbers100.setPosition(sf::Vector2f(mMusicLeftArrow.getSprite().getPosition().x + mMusicLeftArrow.getSprite().getGlobalBounds().width + 6, tempPos.y + 250));
    mMusicNumbers10.setPosition(sf::Vector2f(mMusicNumbers100.getSprite().getPosition().x + mMusicNumbers100.getSprite().getGlobalBounds().width + 6, tempPos.y + 250));
    mMusicNumbers1.setPosition(sf::Vector2f(mMusicNumbers10.getSprite().getPosition().x + mMusicNumbers10.getSprite().getGlobalBounds().width + 6, tempPos.y + 250));
    mMusicRightArrow.setPosition(sf::Vector2f(mMusicNumbers1.getSprite().getPosition().x + mMusicNumbers1.getSprite().getGlobalBounds().width + 6, tempPos.y + 250));

    mSoundMute.setPosition(sf::Vector2f(tempPos.x + 300, tempPos.y + 350));
    mMusicMute.setPosition(sf::Vector2f(tempPos.x + 300, tempPos.y + 450));
    mBack.setPosition(sf::Vector2f(tempPos.x + 300, tempPos.y + 550));
    mBlipPos +=tempPos;
    mBlip.setPosition(mBlipPos);
}
ofImage normalizeROI(vector<vector<pos>> i, ofImage inROI){
	//Output image
	ofImage outROI=inROI;

	//Loop through each position pair
	for(int j = 0; j < i.size(); j++){

		//Get the two positions
		pos upperleft = i[j][0], lowerright = i[j][1];
		
		//Get width and height of the current ROI
		int ROIwidth = lowerright.getX() - upperleft.getX();
		int ROIheight = lowerright.getY() - upperleft.getY();

		//Loop through each pixel in the ROI and convert pixels to chromatic rg
		for(int p = 0;p < ROIheight;p++){
			for(int q = 0; q < ROIwidth;q++){
				pos tempPos(upperleft.getX()+q,upperleft.getY()+p,0);
				outROI.setColor(tempPos.getX(), tempPos.getY(), RGB2rgb(tempPos, inROI));
			}
		}
	}
	//Return output
	return outROI;
}
/**
 * Finds the ideal position for the map to be in and moves it towards that location
 *
 *
 */
void MapArea::moveMap()
{
    //mapPos = middle;

    QPoint middle(this->middle.x(),this->middle.y()+70);
    MapVectors* selectedArea = 0;
    for(int i=0;i<vecs.size();i++)
    {
        if(vecs[i]->isSelected())
        {
            selectedArea = vecs[i];
        }
    }
    if(selectedArea == 0)
    {
        if((middle-mapPos).manhattanLength() > MOVESPEED + 1)
        {
            float angle = atan2(middle.y()-mapPos.y(),middle.x() - mapPos.x());
            mapPos.setX(mapPos.x()+cos(angle)*MOVESPEED);
            mapPos.setY(mapPos.y()+sin(angle)*MOVESPEED);
            lastMousePos.rx() += cos(angle)*MOVESPEED;
            lastMousePos.ry() += sin(angle)*MOVESPEED;
        }
    }
    else
    {
        QPointF tempPos(selectedArea->getRealPosition().x(),selectedArea->getRealPosition().y());
       // tempPos *= selectedArea->getScale();
       tempPos += mapPos;

        if((tempPos-middle).manhattanLength() > MOVESPEED +1)
        {
            float angle = atan2(tempPos.y()-middle.y(),tempPos.x() - middle.x());
            mapPos.setX(mapPos.x()-cos(angle)*MOVESPEED);
            mapPos.setY(mapPos.y()-sin(angle)*MOVESPEED);
            lastMousePos.rx() -= cos(angle)*MOVESPEED;
            lastMousePos.ry() -= sin(angle)*MOVESPEED;
        }
    }
    QVector<MapVectors*>::iterator iter = vecs.begin();
    while(iter != vecs.end())
    {
        QPolygonF& p = (*iter)->getPoly();
        p.translate(mapPos);
        iter++;
    }
    QVector<FacilityIcon*>::iterator fiter = icons.begin();
    while(fiter != icons.end())
    {
        (*fiter)->move(mapPos);
        fiter++;
    }
    mapX->move(mapPos);
}
void MapItem::update(QPoint )
{
   if(scale != idealScale)
   {
       float scalediff = (idealScale - scale)/7 + 1;
       scale *= scalediff;

       QPointF tempPos(position.x(),position.y());
       tempPos *= scale;
       realPosition = QPoint(tempPos.x(),tempPos.y());
    }
}
Exemple #6
0
/**
* Builds a Jacobian Matrix J[]
*/
Matd Solver::computeJ(Markers handles, int cID){
	Matd J;
	J.SetSize(mModel->GetDofCount(), 4);
	J.MakeZero();

	//Get the current Node
	Marker *h = handles[cID];
	Vec4d tempPos(h->mOffset, 1.0);
	TransformNode *node = mModel->mLimbs[h->mNodeIndex];

	// Utility identity matrix
	Mat4d identity;
	identity.MakeDiag(1.0);

	// Recursively create Jacobian
	computeJ(J, node, tempPos, identity);

	return J;
}
Exemple #7
0
///=====================================================
/// 
///=====================================================
void WaveEmitter::Update(double deltaSeconds){
	double currentTime = GetCurrentSeconds();

	//update existing particles
	for (Particles::iterator particleIter = m_particles.begin(); particleIter != m_particles.end();){
		Particle* particle = *particleIter;

		//delete expired particles
		if (particle->m_expirationTime < currentTime){
			delete particle;
			particleIter = m_particles.erase(particleIter);
			continue;
		}


		//COLORFUL SPIRAL LOL
		Vec2 tempVel(particle->m_velocity.x, particle->m_velocity.z);
		tempVel.RotateDegrees(32.0f * (float)deltaSeconds * 90.0f / (float)m_duration);
		particle->m_velocity = Vec3(tempVel.x, 0.0f, tempVel.y);

		Vec2 tempPos(particle->m_position.x, particle->m_position.z);
		tempPos.RotateDegrees(32.0f * (float)deltaSeconds * 90.0f / (float)m_duration);
		particle->m_position = Vec3(tempPos.x, particle->m_position.y, tempPos.y);

		if (GetRandomFloatInRange(0.0f, 1.0f) > cos(currentTime)){
			particle->m_color.r -= (unsigned char)GetRandomIntInRange(0, 3);
			particle->m_color.g -= (unsigned char)GetRandomIntInRange(2, 6);
			particle->m_color.b += (unsigned char)GetRandomIntInRange(1, 9);
		}

		particle->m_position.y = m_position.y + m_waveHeight * cos((CalcDistance(Vec2(m_position.x, m_position.z), Vec2(particle->m_position.x, particle->m_position.z)) - (float)currentTime) * m_waveSpeed);
		particle->Update(deltaSeconds);
		++particleIter;
	}

	//add new particles
	m_timeSinceParticleEmission += deltaSeconds;
	if (m_timeSinceParticleEmission >= m_timeBetweenParticleEmissions){
		AddParticles();
		m_timeSinceParticleEmission -= m_timeBetweenParticleEmissions;
	}
}
void Mainframe::spawnTurret() {
	// find position (in range, not colliding with self)

	int tx = (std::rand()%400);
	int ty = (std::rand()%400) - 200;

	vec::Vector2 tempPos(this->getPosition().getX()-tx, this->getPosition().getY() + ty);

	// make weapon

	Weapon* tempWeapon = new Weapon("TURRET_GUN", 1, 15, 250);

	// make turret (with callback)

	Turret* tempTurret = new Turret(tempPos, tempWeapon, 0, 0, std::bind(&Mainframe::turretHasDied, this));

	tempTurret->changeState(Turret::ACTIVE);
	 
	// increment, and add turret

	numSpawnedTurrets++;

	addObjectStatic(tempTurret);
}
Exemple #9
0
Controls::Controls():
	mWindow(Window::getWindow()),
	mStateInput(StateInput::getInstance()),
	mBackground("Main", 1, 1),
	mInGameBackground("Ingame", 1, 1),
	mBlip("Blip", 1, 1),
	mBack("Back", 1, 2),
	mControlSchedule("ControlSchedule", 1, 1),
	currentSelection(&mBack),
	currentBackground(&mBackground)
{
	mBack.setAnimate(false);

	sf::Vector2f tempPos(mWindow.getSize().x/2-mBackground.getSprite().getGlobalBounds().width/2, 0);
	sf::Vector2f tempPos2(mWindow.getSize().x/2-mInGameBackground.getSprite().getGlobalBounds().width/2, 0);
	mBackground.setPosition(tempPos);
	mInGameBackground.setPosition(tempPos2);

	mControlSchedule.setPosition(sf::Vector2f(tempPos.x + 230, tempPos.y + 150 ));
	mBack.setPosition(sf::Vector2f(tempPos.x + 300, tempPos.y + 550));
	mBlip.setPosition(sf::Vector2f(tempPos.x + 240, tempPos.y +550));
	mBack.setCurrentFrame(1);

}
// It is used to get a value. '"' characters are stripped and if there are many
// parts then they are merged.
std::string  getCMLCommentValue( const std::string &  comment,
                                 ssize_t &  pos,
                                 std::string &  warning )
{
    skipSpaces( comment, pos );

    ssize_t         lastPos( comment.size() - 1 );
    if ( pos > lastPos )
    {
        warning = "Could not find a property value";
        return "";
    }

    if ( comment[ pos ] != '"' )
    {
        std::string     token = getCMLCommentToken( comment, pos );
        if ( token.empty() )
        {
            warning = "Could not find a property value";
            return "";
        }
        return token;
    }

    // Here: the value is in double quotes
    std::string     value;

    ++pos;
    while ( pos <= lastPos )
    {
        char    symbol( comment[ pos ] );
        if ( symbol == '\\' )
        {
            if ( pos < lastPos )
            {
                if ( comment[ pos + 1 ] == '"' )
                {
                    pos += 2;
                    value += std::string( "\"" );
                    continue;
                }
            }
        }
        else if ( symbol == '"' )
        {
            ++pos;

            // That's the end of the value or of a part.
            // It might be that the value continues in the next part so we need
            // to look ahead.
            ssize_t     tempPos( pos );
            skipSpaces( comment, tempPos );
            if ( tempPos <= lastPos )
            {
                if ( comment[ tempPos ] == '"' )
                {
                    // This is a value continue
                    pos = tempPos + 1;
                    continue;
                }
            }

            return value;
        }
        value += symbol;
        ++pos;
    }

    // Unfinished double quote
    warning = "Unfinished double quote for a property value";
    return "";
}
void PrimaSimpleDGPP::convert_to_str()
{
	ig.clear(); 
	gg.clear();
	jg.clear();
	ig.push_back(0);
	ig.push_back(count(p.begin(), p.end(), 0));


	for (int i = 1; i < p.size(); i++)
	{
		ig.push_back(ig[i] + count(p.begin(), p.end(), i) + 1 );
	}

	gg = vector<int>(ig[ig.size()  - 1]);
	jg = vector<size_t>(ig[ig.size() - 1]);
	vector<size_t>  tempPos (p.size(), 0);
	for (int i = 1; i < p.size(); i++)
	{
		if (p[i] != -1)
		{
			gg[ig[p[i]] + tempPos[p[i]]] = d[i]; 
			jg[ig[p[i]] + tempPos[p[i]]] = i;
			tempPos[p[i]]++;

			gg[ig[i] + tempPos[i]] = d[i];
			jg[ig[i] + tempPos[i]] = p[i];
			tempPos[i]++;

		}

	}

	for (int i = 1; i < p.size(); i++)
	{
		size_t begin = ig[i - 1];
		size_t end = ig[i];
		size_t min = begin;
		for (int j = begin; j < end; j++)
		{
			for (int l = j + 1; l < end; l++)
			{
				if (jg[l] < jg[min])
				{
					
					int tempIndJ = jg[l];
					int tempIndG = gg[l];
					jg[l] = jg[min];
					gg[l] = gg[min];
					jg[min] = tempIndJ;
					gg[min] = tempIndG;
					min = l;
				}
			}


			
		}
	}

}
Exemple #12
0
Formattable*
MessageFormat::parse(const UnicodeString& source, 
                     ParsePosition& pos,
                     int32_t& count) const
{
    // Allocate at least one element.  Allocating an array of length
    // zero causes problems on some platforms (e.g. Win32).
    Formattable *resultArray = new Formattable[argTypeCount ? argTypeCount : 1];
    int32_t patternOffset = 0;
    int32_t sourceOffset = pos.getIndex();
    ParsePosition tempPos(0);
    count = 0; // {sfb} reset to zero
    int32_t len;
    for (int32_t i = 0; i < subformatCount; ++i) {
        // match up to format
        len = subformats[i].offset - patternOffset;
        if (len == 0 || 
            fPattern.compare(patternOffset, len, source, sourceOffset, len) == 0) {
            sourceOffset += len;
            patternOffset += len;
        } 
        else {
            goto PARSE_ERROR;
        }
        
        // now use format
        Format* fmt = subformats[i].format;
        int32_t arg = subformats[i].arg;
        if (fmt == NULL) {   // string format
            // if at end, use longest possible match
            // otherwise uses first match to intervening string
            // does NOT recursively try all possibilities
            int32_t tempLength = (i+1<subformatCount) ?
                subformats[i+1].offset : fPattern.length();
            
            int32_t next;
            if (patternOffset >= tempLength) {
                next = source.length();
            }
            else {
                UnicodeString buffer;
                fPattern.extract(patternOffset,tempLength - patternOffset, buffer);
                next = source.indexOf(buffer, sourceOffset);
            }
            
            if (next < 0) {
                goto PARSE_ERROR;
            } 
            else {
                UnicodeString buffer;
                source.extract(sourceOffset,next - sourceOffset, buffer);
                UnicodeString strValue = buffer;
                UnicodeString temp(LEFT_CURLY_BRACE);
                // {sfb} check this later
                itos(arg, temp);
                temp += RIGHT_CURLY_BRACE;
                if (strValue != temp) {
                    source.extract(sourceOffset,next - sourceOffset, buffer);
                    resultArray[arg].setString(buffer);
                    // {sfb} not sure about this
                    if ((arg + 1) > count) {
                        count = arg + 1;
                    }
                }
                sourceOffset = next;
            }
        } 
        else {
            tempPos.setIndex(sourceOffset);
            fmt->parseObject(source, resultArray[arg], tempPos);
            if (tempPos.getIndex() == sourceOffset) {
                goto PARSE_ERROR;
            }
            
            if ((arg + 1) > count) {
                count = arg + 1;
            }
            sourceOffset = tempPos.getIndex(); // update
        }
    }
    len = fPattern.length() - patternOffset;
    if (len == 0 || 
        fPattern.compare(patternOffset, len, source, sourceOffset, len) == 0) {
        pos.setIndex(sourceOffset + len);
        return resultArray;
    }
    // else fall through...

 PARSE_ERROR:
    pos.setErrorIndex(sourceOffset);
    delete [] resultArray;
    count = 0;
    return NULL; // leave index as is to signal error
}
bool
BasicTerminalBuffer::Find(const char* _pattern, const TermPos& start,
	bool forward, bool caseSensitive, bool matchWord, TermPos& _matchStart,
	TermPos& _matchEnd) const
{
//debug_printf("BasicTerminalBuffer::Find(\"%s\", (%ld, %ld), forward: %d, case: %d, "
//"word: %d)\n", _pattern, start.x, start.y, forward, caseSensitive, matchWord);
	// normalize pos, so that _NextChar() and _PreviousChar() are happy
	TermPos pos(start);
	TerminalLine* lineBuffer = ALLOC_LINE_ON_STACK(fWidth);
	TerminalLine* line = _HistoryLineAt(pos.y, lineBuffer);
	if (line != NULL) {
		if (forward) {
			while (line != NULL && pos.x >= line->length && line->softBreak) {
				pos.x = 0;
				pos.y++;
				line = _HistoryLineAt(pos.y, lineBuffer);
			}
		} else {
			if (pos.x > line->length)
				pos.x = line->length;
		}
	}

	int32 patternByteLen = strlen(_pattern);

	// convert pattern to UTF8Char array
	BStackOrHeapArray<UTF8Char, 64> pattern(patternByteLen);
	int32 patternLen = 0;
	while (*_pattern != '\0') {
		int32 charLen = UTF8Char::ByteCount(*_pattern);
		if (charLen > 0) {
			pattern[patternLen].SetTo(_pattern, charLen);

			// if not case sensitive, convert to lower case
			if (!caseSensitive && charLen == 1)
				pattern[patternLen] = pattern[patternLen].ToLower();

			patternLen++;
			_pattern += charLen;
		} else
			_pattern++;
	}
//debug_printf("  pattern byte len: %ld, pattern len: %ld\n", patternByteLen, patternLen);

	if (patternLen == 0)
		return false;

	// reverse pattern, if searching backward
	if (!forward) {
		for (int32 i = 0; i < patternLen / 2; i++)
			std::swap(pattern[i], pattern[patternLen - i - 1]);
	}

	// search loop
	int32 matchIndex = 0;
	TermPos matchStart;
	while (true) {
//debug_printf("    (%ld, %ld): matchIndex: %ld\n", pos.x, pos.y, matchIndex);
		TermPos previousPos(pos);
		UTF8Char c;
		if (!(forward ? _NextChar(pos, c) : _PreviousChar(pos, c)))
			return false;

		if (caseSensitive ? (c == pattern[matchIndex])
				: (c.ToLower() == pattern[matchIndex])) {
			if (matchIndex == 0)
				matchStart = previousPos;

			matchIndex++;

			if (matchIndex == patternLen) {
//debug_printf("      match!\n");
				// compute the match range
				TermPos matchEnd(pos);
				if (!forward)
					std::swap(matchStart, matchEnd);

				// check word match
				if (matchWord) {
					TermPos tempPos(matchStart);
					if ((_PreviousChar(tempPos, c) && !c.IsSpace())
						|| (_NextChar(tempPos = matchEnd, c) && !c.IsSpace())) {
//debug_printf("      but no word match!\n");
						continue;
					}
				}

				_matchStart = matchStart;
				_matchEnd = matchEnd;
//debug_printf("  -> (%ld, %ld) - (%ld, %ld)\n", matchStart.x, matchStart.y,
//matchEnd.x, matchEnd.y);
				return true;
			}
		} else if (matchIndex > 0) {
			// continue after the position where we started matching
			pos = matchStart;
			if (forward)
				_NextChar(pos, c);
			else
				_PreviousChar(pos, c);
			matchIndex = 0;
		}
	}
}
Exemple #14
0
void Level::initialize(ValeGame *gamePtr)
{
	gamePointer = gamePtr;
	graphics = gamePtr->getGraphics();
	input = gamePtr->getInput();

	srand(time(NULL));

	//fonts
    quickCD.initialize(graphics, hudNS::COOLDOWN_SIZE, false, false, hudNS::FONT);
    quickCD.setFontColor(hudNS::FONT_COLOR);
	focusCD.initialize(graphics, hudNS::COOLDOWN_SIZE, false, false, hudNS::FONT);
	focusCD.setFontColor(hudNS::FONT_COLOR);
	fleetfeetCD.initialize(graphics, hudNS::COOLDOWN_SIZE, false, false, hudNS::FONT);
	fleetfeetCD.setFontColor(hudNS::FONT_COLOR);
	scoreText.initialize(graphics, 64, false, false, hudNS::FONT);
	scoreText.setFontColor(SETCOLOR_ARGB(255, 78, 162, 241));

	//textures
	wardenTexture.initialize(graphics, WARDEN_IMAGE);
	projectileTextures.initialize(graphics, PROJECTILE_IMAGE);
	focusBarFillTexture.initialize(graphics, FOCUS_BAR_FILL); 
	focusBarBGTexture.initialize(graphics, FOCUS_BAR_BG); 
	focusBarBGMuseTexture.initialize(graphics, FOCUS_BAR_BG_MUSE); 
	heartHUDTexture.initialize(graphics, HEART_HUD);
	heartTexture.initialize(graphics, HEART_ICON);
	spawnPointTexture.initialize(graphics,SPAWNER_IMAGE);

	//ability textures
	for(int i = 0; i < wardenNS::NUM_BOWS; i++)
	{
		bowTexture[i].initialize(graphics, BOW_ICON[i]);
		quickShotAbilityTexture[i].initialize(graphics, QUICKSHOT_ICON[i]);
		focusShotAbilityTexture[i].initialize(graphics, FOCUSSHOT_ICON[i]);
	}
	fleetFeetAbilityTexture.initialize(graphics, FLEETFEET_ICON);


	// Collision detection
	// Compute grid dimensions from the map size divided by grid dimension size
	float dX = (float)((width * tileSize)/GRID_CELL_DIMENSIONS);
	gridW = (int)ceil(dX);
	float dY = (float)((height * tileSize)/GRID_CELL_DIMENSIONS);
	gridH = (int)ceil(dY);

	// Instantiate the grid
	collision = cGrid(gridW, gridH, GRID_CELL_DIMENSIONS, &score);

	//particle system bs
	ps.initialize(graphics, L"..\\..\\Textures\\Particles\\smoke_hardedge.tga");
	ps.setEmitterShape(EMITTER_SHAPE_NONE);
	ps.setEmitterType(EMITTER_TYPE_DEFAULT);
	D3DXVECTOR2 tempPos(-100.0f, -100.0f);
	ps.setPosition(tempPos);
	
	particleSystems.resize(5);
	for(int i = 0; i < 5; i++)
	{
		particleSystems[i].initialize(graphics, L"..\\..\\Textures\\Particles\\smoke_hardedge.tga");
		particleSystems[i].setEmitterShape(EMITTER_SHAPE_NONE);
		particleSystems[i].setEmitterType(EMITTER_TYPE_DEFAULT);
		D3DXVECTOR2 tempPos(-100.0f, -100.0f);
		particleSystems[i].setPosition(tempPos);
	}
	lastUsedParticleSystem = 4;

	//warden
	warden.initialize(gamePtr, 32, 32, 1, &wardenTexture, &projectileTextures, &projectileTextures);
	D3DXVECTOR2 tmp(hudNS::SPAWN_X, hudNS::SPAWN_Y);
	warden.setPosition(tmp);
	score = 0;

	//Enemies
	risenManager.init(&score);
	risenSpawner.initialize(gamePtr,32,32,1,&spawnPointTexture,&risenManager.risen,&warden,tiles);
	risenSpawner.setPosition(tmp);

	addTimedSpawn(gamePtr,Risen::WAR,30.0,D3DXVECTOR2(2000.0f,1500.0f),400000);

	std::vector<Risen::types> hello1;
	std::vector<int> hello2;
	hello1.push_back(Risen::WARLOCK);
	hello1.push_back(Risen::ARCHER);
	hello1.push_back(Risen::HOUND);
	hello2.push_back(2);
	hello2.push_back(3);
	hello2.push_back(1);
	addStaticSpawn(gamePtr,hello1,hello2,D3DXVECTOR2(750.0f,3200.0f),400000);
	
	hello1.clear();
	hello2.clear();
	hello1.push_back(Risen::HOUND);
	hello2.push_back(1);
	addStaticSpawn(gamePtr,hello1,hello2,D3DXVECTOR2(1500.0f,2750.0f),400000);

	hello1.clear();
	hello2.clear();

	hello1.push_back(Risen::WAR);
	hello1.push_back(Risen::ARCHER);
	hello2.push_back(1);
	hello2.push_back(1);
	addStaticSpawn(gamePtr,hello1,hello2,D3DXVECTOR2(3300.0f,1000.0f),300000);

	hello1.clear();
	hello2.clear();

	hello1.push_back(Risen::WAR);
	hello2.push_back(1);
	addStaticSpawn(gamePtr,hello1,hello2,D3DXVECTOR2(2350.0f,785.0f),320000);

	hello2[0] = 2;
	addStaticSpawn(gamePtr,hello1,hello2,D3DXVECTOR2(2430.0f,175.0f),120000);

	hello1.push_back(Risen::WARLOCK);
	hello2.push_back(1);
	hello2[0] = 1;
	addStaticSpawn(gamePtr,hello1,hello2,D3DXVECTOR2(3650.0f,1900.0f),250000);
	addStaticSpawn(gamePtr,hello1,hello2,D3DXVECTOR2(3700.0f,2000.0f),200000);
	hello1[1] = Risen::WAR;
	addStaticSpawn(gamePtr,hello1,hello2,D3DXVECTOR2(3700.0f,1800.0f),250000);

	//equipment
	addBow(20, 2, SPLIT);
	addBow(19, 21, MUSE);

	//Hud
	scoreRect.left = 50.0f; scoreRect.top = 50.0f; scoreRect.bottom = 150.0f; scoreRect.right = 250.0f;
	//focus bar
	focusBarFill.initialize(graphics, &focusBarFillTexture, 128, 128, 0, 0, 1.0f, graphicsNS::WHITE);
	focusBarBG.initialize(graphics,128, 128, 1, &focusBarBGTexture);
	focusBarBGMuse.initialize(graphics, 128, 128, 1, &focusBarBGMuseTexture);

	for(int i = 0; i < 4; i++)
	{
		heartHUD[i].initialize(graphics, 32, 32, 1, &heartHUDTexture);
		heartHUD[i].setX(hudNS::HEART_X + i*32);
		heartHUD[i].setY(hudNS::HEART_Y);
	}

	//abilities 
	for(int i = 0; i < wardenNS::NUM_BOWS; i++)
	{
		quickShotAbility[i].initialize(graphics, hudNS::ABILITY_ICON_SIZE, hudNS::ABILITY_ICON_SIZE, 1, &quickShotAbilityTexture[i]);

		quickShotAbility[i].setX(hudNS::QUICK_ICON_X);
		quickShotAbility[i].setY(hudNS::ABILITY_ICON_Y);

		focusShotAbility[i].initialize(graphics, hudNS::ABILITY_ICON_SIZE, hudNS::ABILITY_ICON_SIZE, 1, &focusShotAbilityTexture[i]);		

		focusShotAbility[i].setX(hudNS::FOCUS_ICON_X);
		focusShotAbility[i].setY(hudNS::ABILITY_ICON_Y);
	}


	fleetFeetAbility.initialize(graphics, hudNS::ABILITY_ICON_SIZE, hudNS::ABILITY_ICON_SIZE, 1, &fleetFeetAbilityTexture);
	fleetFeetAbility.setX(hudNS::FLEET_ICON_X);
	fleetFeetAbility.setY(hudNS::ABILITY_ICON_Y);
}