feat: fast forward

This commit is contained in:
2025-07-30 17:52:54 +02:00
parent 56a43d7a60
commit 2e556e0d45
12 changed files with 164 additions and 31 deletions

View File

@@ -103,7 +103,17 @@ int main(int argc, char** argv) {
cam.SetCamPos({77, 5, 13});
cam.UpdatePerspective(display.GetAspectRatio());
td::sim::RealTimeSimulation simulation(w, std::move(gh), 500);
td::sim::RealTimeSimulation simulation(w, 500);
display.OnKeyDown.Connect([&simulation](SDL_Keycode key){
if (key == SDLK_A) {
auto spawn = std::make_shared<td::protocol::commands::SpawnTroopCommand>(0, 0, td::Vec2fp{td::FpFloat(77), td::FpFloat(13)}, 0);
std::array<td::protocol::LockStep, LOCKSTEP_BUFFER_SIZE> steps{};
steps[0].push_back(spawn);
td::protocol::packets::LockStepsPacket packet{0, steps};
simulation.HandlePacket(packet);
}
});
while (!display.IsCloseRequested()) {
display.PollEvents();