Conserver la position de la caméra pdt le test
This commit is contained in:
parent
b14953215b
commit
dec8f56244
|
@ -19,7 +19,7 @@ private:
|
|||
WidgetTimer widget_timer;
|
||||
sf::Time next_frame_time;
|
||||
bool test_mode;
|
||||
std::shared_ptr<State> return_state;
|
||||
std::shared_ptr<Editor> return_state;
|
||||
Mode mode;
|
||||
|
||||
/**
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
* Mise en mode test : l'appui sur espace renvoie
|
||||
* vers l'éditeur donné
|
||||
*/
|
||||
void setTestMode(std::shared_ptr<State> set_return_state);
|
||||
void setTestMode(std::shared_ptr<Editor> set_return_state);
|
||||
|
||||
/**
|
||||
* Récupère le mode actuel de jeu
|
||||
|
|
|
@ -472,6 +472,6 @@ void Editor::test() {
|
|||
}
|
||||
|
||||
// mise en mode test
|
||||
game->setTestMode(getManager().getState());
|
||||
game->setTestMode(std::dynamic_pointer_cast<Editor>(getManager().getState()));
|
||||
getManager().setState(game);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@ void Game::processEvent(const sf::Event& event) {
|
|||
// appui sur espace en mode test : retour à l'éditeur
|
||||
if (event.key.code == sf::Keyboard::Space && test_mode) {
|
||||
test_mode = false;
|
||||
|
||||
// on s'assure que la position de la caméra reste la même
|
||||
return_state->setCamera(getCamera());
|
||||
|
||||
getManager().setState(return_state);
|
||||
return_state = nullptr;
|
||||
}
|
||||
|
@ -162,7 +166,7 @@ bool Game::getTestMode() {
|
|||
return test_mode;
|
||||
}
|
||||
|
||||
void Game::setTestMode(std::shared_ptr<State> set_return_state) {
|
||||
void Game::setTestMode(std::shared_ptr<Editor> set_return_state) {
|
||||
return_state = set_return_state;
|
||||
test_mode = true;
|
||||
}
|
||||
|
|
|
@ -202,7 +202,6 @@ void Level::save(std::string filename) {
|
|||
void Level::begin() {
|
||||
sf::Vector2u window_size = getWindow().getSize();
|
||||
camera.setSize(window_size.x, window_size.y);
|
||||
camera.setCenter(0, 0);
|
||||
camera_angle = 180.f;
|
||||
|
||||
gravity_direction = GravityDirection::SOUTH;
|
||||
|
|
Loading…
Reference in New Issue