//
// Created by martin on 12.11.21.
//

#include "SpeedScaleNode.h"

#include <imgui.h>

void SpeedScaleNode::DrawDebugUi() {
  bool is_negative = m_time_scale < 0.f;
  if (ImGui::Checkbox("Reverse Time", &is_negative)) {
    m_time_scale = m_time_scale * -1.f;
  }

  // ensure m_time_scale is positive
  m_time_scale = m_time_scale * (is_negative ? -1.f : 1.f);
  ImGui::SliderFloat("Time Scale", &m_time_scale, 0.01f, 5.f);
  // and back to the original negative or positive sign
  m_time_scale = m_time_scale * (is_negative ? -1.f : 1.f);
}