fastforward test in main
This commit is contained in:
@@ -111,19 +111,21 @@ int main(int argc, char** argv) {
|
|||||||
renderer.AddRenderer<td::render::EntityRenderer>(cam, w);
|
renderer.AddRenderer<td::render::EntityRenderer>(cam, w);
|
||||||
renderer.AddRenderer<td::render::TowerRenderer>(cam, w);
|
renderer.AddRenderer<td::render::TowerRenderer>(cam, w);
|
||||||
|
|
||||||
cam.SetCamPos({77, 5, 13});
|
cam.SetCamPos({77, 10, 13});
|
||||||
cam.UpdatePerspective(display.GetAspectRatio());
|
cam.UpdatePerspective(display.GetAspectRatio());
|
||||||
|
|
||||||
td::sim::RealTimeSimulation simulation(w, 500);
|
td::sim::RealTimeSimulation simulation(w, 50);
|
||||||
|
|
||||||
display.OnKeyDown.Connect([&simulation](SDL_Keycode key) {
|
display.OnKeyDown.Connect([&simulation](SDL_Keycode key) {
|
||||||
|
static int counter = 0;
|
||||||
if (key == SDLK_A) {
|
if (key == SDLK_A) {
|
||||||
auto spawn = td::protocol::CommandPtr(
|
auto spawn = td::protocol::CommandPtr(
|
||||||
std::make_shared<td::protocol::commands::SpawnTroopCommand>(0, 0, td::Vec2fp{td::FpFloat(77), td::FpFloat(13)}, 0));
|
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{};
|
std::array<td::protocol::LockStep, LOCKSTEP_BUFFER_SIZE> steps{};
|
||||||
steps[0].push_back(spawn);
|
steps[0].push_back(spawn);
|
||||||
td::protocol::packets::LockStepsPacket packet{0, steps};
|
td::protocol::packets::LockStepsPacket packet{counter * LOCKSTEP_BUFFER_SIZE * 3, steps};
|
||||||
simulation.HandlePacket(packet);
|
simulation.HandlePacket(packet);
|
||||||
|
counter++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user