Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/scrimmage/viewer/Updater.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ class Updater : public vtkCommand {

scrimmage_proto::SimInfo sim_info_;

vtkSmartPointer<vtkTextActor> playpause_actor_;
vtkSmartPointer<vtkTextActor> time_actor_;
vtkSmartPointer<vtkTextActor> warp_actor_;
vtkSmartPointer<vtkTextActor> heading_actor_;
Expand Down
1 change: 1 addition & 0 deletions src/proto/scrimmage/proto/Visual.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ message SimInfo {
double desired_warp = 2;
double actual_warp = 3;
bool shutting_down = 4;
bool sim_paused = 5;
}

message ContactVisual {
Expand Down
5 changes: 5 additions & 0 deletions src/simcontrol/SimControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,11 @@ bool SimControl::run_single_step(const int& loop_number) {
info.set_desired_warp(this->time_warp());
info.set_actual_warp(this->actual_time_warp());
info.set_shutting_down(false);
if(paused()){
info.set_sim_paused(true);
} else {
info.set_sim_paused(false);
}
outgoing_interface_->send_sim_info(info);
if (paused()) {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
Expand Down
18 changes: 18 additions & 0 deletions src/viewer/Updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,16 @@ bool Updater::update_text_display() {
ss << std::setprecision(num_digits) << std::fixed << frame_time_ << " s";
time_actor_->SetInput(ss.str().c_str());

// Update play and pause indicator text value and position based on window size
int *win_size = rwi_->GetRenderWindow()->GetSize();
playpause_actor_->SetPosition(win_size[0] - 100, 10);

if(sim_info_.sim_paused()){
playpause_actor_->SetInput("Paused");
} else {
playpause_actor_->SetInput("Playing");
}

// Update the time warp
std::stringstream stream_warp;
stream_warp << std::fixed << std::setprecision(2) << sim_info_.desired_warp();
Expand Down Expand Up @@ -1657,6 +1667,7 @@ void Updater::create_text_display() {
alt_actor_->GetTextProperty()->SetFontSize(24);
alt_actor_->GetTextProperty()->SetColor(1.0, 1.0, 1.0);
renderer_->AddActor2D(alt_actor_);
text_y += text_y_spacing;

// Add the help menu
// NOTE: this requires two vtkTextActor's because you can't
Expand Down Expand Up @@ -1694,6 +1705,13 @@ void Updater::create_text_display() {
fps_actor_->GetTextProperty()->SetFontSize(24);
fps_actor_->GetTextProperty()->SetColor(1.0, 1.0, 1.0);
renderer_->AddActor2D(fps_actor_);

// Add the play and pause display
playpause_actor_ = vtkSmartPointer<vtkTextActor>::New();
playpause_actor_->SetInput(" ");
playpause_actor_->GetTextProperty()->SetFontSize(24);
playpause_actor_->GetTextProperty()->SetColor(1.0, 1.0, 1.0);
renderer_->AddActor2D(playpause_actor_);
}

void Updater::enable_fps() {
Expand Down