Repassage à C++11 pour compatibilité
This commit is contained in:
		
							parent
							
								
									bc858a05d2
								
							
						
					
					
						commit
						81434c9b7a
					
				|  | @ -18,15 +18,15 @@ endif() | |||
| 
 | ||||
| # Standard C++14 | ||||
| include(CheckCXXCompilerFlag) | ||||
| CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) | ||||
| CHECK_CXX_COMPILER_FLAG("-std=c++1y" COMPILER_SUPPORTS_CXX1Y) | ||||
| CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) | ||||
| CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) | ||||
| 
 | ||||
| if(COMPILER_SUPPORTS_CXX14) | ||||
|     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") | ||||
| elseif(COMPILER_SUPPORTS_CXX1Y) | ||||
|     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y") | ||||
| if(COMPILER_SUPPORTS_CXX11) | ||||
|     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | ||||
| elseif(COMPILER_SUPPORTS_CXX0X) | ||||
|     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") | ||||
| else() | ||||
|     message(STATUS "Le compilateur actuel (${CMAKE_CXX_COMPILER}) ne supporte pas C++14. Merci d'utiliser un autre compilateur.") | ||||
|     message(STATUS "Le compilateur actuel (${CMAKE_CXX_COMPILER}) ne supporte pas C++11. Merci d'utiliser un autre compilateur.") | ||||
| endif() | ||||
| 
 | ||||
| # Recherche des librairies | ||||
|  |  | |||
|  | @ -36,11 +36,11 @@ void Block::draw(Manager& manager) { | |||
| } | ||||
| 
 | ||||
| std::unique_ptr<sf::FloatRect> Block::getAABB() const { | ||||
|     return std::make_unique<sf::FloatRect>( | ||||
|     return std::unique_ptr<sf::FloatRect>(new sf::FloatRect( | ||||
|         getPosition().x - Constants::GRID / 2, | ||||
|         getPosition().y - Constants::GRID / 2, | ||||
|         Constants::GRID, Constants::GRID | ||||
|     ); | ||||
|     )); | ||||
| } | ||||
| 
 | ||||
| const unsigned int Block::TYPE_ID = 1; | ||||
|  |  | |||
|  | @ -53,7 +53,8 @@ void Game::load(std::ifstream& file) { | |||
|         pos_x *= Constants::GRID; | ||||
|         pos_y *= Constants::GRID; | ||||
| 
 | ||||
|         std::shared_ptr<Player> player = std::make_shared<Player>(pos_x, pos_y); | ||||
|         std::shared_ptr<Player> player = | ||||
|             std::shared_ptr<Player>(new Player(pos_x, pos_y)); | ||||
|         player->setPlayerNumber(i); | ||||
| 
 | ||||
|         objects.push_back(std::dynamic_pointer_cast<Object>(player)); | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ | |||
| 
 | ||||
| int main() { | ||||
|     Manager manager; | ||||
|     std::shared_ptr<Game> game = std::make_shared<Game>(manager); | ||||
|     std::shared_ptr<Game> game = std::shared_ptr<Game>(new Game(manager)); | ||||
| 
 | ||||
|     // ouverture du niveau
 | ||||
|     std::ifstream file; | ||||
|  |  | |||
|  | @ -53,11 +53,11 @@ void Player::draw(Manager& manager) { | |||
| } | ||||
| 
 | ||||
| std::unique_ptr<sf::FloatRect> Player::getAABB() const { | ||||
|     return std::make_unique<sf::FloatRect>( | ||||
|     return std::unique_ptr<sf::FloatRect>(new sf::FloatRect( | ||||
|         getPosition().x - getRadius(), | ||||
|         getPosition().y - getRadius(), | ||||
|         2 * getRadius(), 2 * getRadius() | ||||
|     ); | ||||
|     )); | ||||
| } | ||||
| 
 | ||||
| const unsigned int Player::TYPE_ID = 0; | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ ResourceManager::~ResourceManager() { | |||
|  */ | ||||
| std::string getCurrentDirectory() { | ||||
|     int length = wai_getExecutablePath(NULL, 0, NULL), dirname_length; | ||||
|     std::unique_ptr<char[]> buffer = std::make_unique<char[]>(length + 1); | ||||
|     std::unique_ptr<char[]> buffer = std::unique_ptr<char[]>(new char[length + 1]); | ||||
|     wai_getExecutablePath(buffer.get(), length, &dirname_length); | ||||
| 
 | ||||
|     if (dirname_length == 0) { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue