Correction du code de Maëlle
This commit is contained in:
parent
9ef5b6683d
commit
84ffd44f17
|
@ -3,7 +3,7 @@
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
Engine::Engine() : window(
|
Engine::Engine() : window(
|
||||||
sf::VideoMode(800, 600), "Projet CMI",
|
sf::VideoMode(704, 480), "Projet CMI",
|
||||||
sf::Style::Default & ~sf::Style::Resize,
|
sf::Style::Default & ~sf::Style::Resize,
|
||||||
sf::ContextSettings(0, 0, 2)
|
sf::ContextSettings(0, 0, 2)
|
||||||
), view(sf::FloatRect(200, 200, 300, 200)){
|
), view(sf::FloatRect(200, 200, 300, 200)){
|
||||||
|
@ -12,8 +12,6 @@ Engine::Engine() : window(
|
||||||
// mise en place de la caméra
|
// mise en place de la caméra
|
||||||
view.setSize(800, 600);
|
view.setSize(800, 600);
|
||||||
window.setView(view);
|
window.setView(view);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::start() {
|
void Engine::start() {
|
||||||
|
@ -38,9 +36,16 @@ void Engine::start() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state.delta = clock.restart().asSeconds();
|
float frame = clock.restart().asSeconds();
|
||||||
|
accumulator += frame;
|
||||||
|
|
||||||
|
// tant qu'il reste du temps à passer,
|
||||||
|
// effectuer la simulation physique étape par étape
|
||||||
|
while (accumulator >= Constants::PHYSICS_TIME) {
|
||||||
|
accumulator -= Constants::PHYSICS_TIME;
|
||||||
update();
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue