App.setView(View1);
App.clear();
//Background
renderList.add(Background);
//draw icons in the world
for(int i=0; i < itemSystem.item.size(); i++){
if (itemSystem.item[i].getStatus() == 1)
renderList.add(itemSystem.item[i].sprite);
}
for (int i = 0; i < character.back().bullet.size(); i++){
renderList.add(character.back().bullet[i].Sprite);
}
for (int i = 0; i < enemy.size(); i++){
for (int j = 0; j < enemy[i].bullet.size(); j++){
renderList.add(enemy[i].bullet[j].Sprite);
}
}
//Enemy
for (int i = 0; i < enemy.size(); i++){
renderList.add(enemy[i].Sprite);
}
//Character
renderList.add(character.back().Sprite);
for (int i = 0; i < box.size(); i++){
renderList.add(box[i].Rect, 3);
}
renderList.draw(&App);
//Lights
ls.SetView(lightView);
ls.RenderLights();
ls.RenderLightTexture();
//Change view
App.setView(App.getDefaultView());
//UI
renderList.add(HealthOrbBack);
renderList.add(HealthOrbFront);
renderList.add(Health);
renderList.add(HealthOrb);
renderList.add(ManaOrbBack);
renderList.add(ManaOrbFront);
renderList.add(Mana);
renderList.add(ManaOrb);
if (character.back().isInventoryOpen() == true){
//Inventory
renderList.add(InventoryBag);
//Icons in slots
for(int i=0; i < itemSystem.item.size(); i++){
if (itemSystem.item[i].getStatus() == 2)
renderList.add(itemSystem.item[i].sprite);
}
if (character.back().mouseOnItem() != -1 && itemSystem.item[character.back().mouseOnItem()].getStatus() == 2){
//draw text background
renderList.add(character.back().textBackground, 7);
//draw Icon Text
App.draw(itemSystem.item[character.back().mouseOnItem()].nameText);
for (int i = 0; i < itemSystem.item[character.back().mouseOnItem()].statText.size(); i++){
App.draw(itemSystem.item[character.back().mouseOnItem()].statText[i]);
}
}
}
//Icons on mouse
if (character.back().itemOnMouse != -1)
renderList.add(itemSystem.item[character.back().itemOnMouse].sprite);
App.draw(coordinates);
//End GAME code
break;
}
//GAMEOVER code
case GAMEOVER:{
sf::Text gameOverMessage("GAME OVER", Font);
gameOverMessage.setColor(sf::Color(255,0,0,255));
gameOverMessage.setScale(5,5);
gameOverMessage.setOrigin(gameOverMessage.getLocalBounds().width/2, gameOverMessage.getLocalBounds().height*0.9);
gameOverMessage.setPosition(screenSize.x/2, screenSize.y/2);
std::stringstream ss;
ss << "Enemies Killed: " << character.back().enemiesKilled;
sf::Text scoreMessage(ss.str(), Font);
scoreMessage.setColor(sf::Color(255,0,0,255));
scoreMessage.setScale(2,2);
scoreMessage.setOrigin(scoreMessage.getLocalBounds().width/2, scoreMessage.getLocalBounds().height*0.9);
scoreMessage.setPosition(screenSize.x/2, screenSize.y/2 + 140);
App.clear();
App.draw(gameOverMessage);
App.draw(scoreMessage);
}
break;
}
if (character.back().mouseOnItem() == -1)
renderList.add(Cursor[0]);
else
renderList.add(Cursor[1]);
renderList.draw(&App);
App.display();