aboutsummaryrefslogtreecommitdiff
path: root/src/game_tab/editor/LiveEngineDialog.cpp
blob: cad3fdd167f32c980400ba56e3837d565e72dcf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include "LiveEngineDialog.hpp"

LiveEngineDialog::LiveEngineDialog(wxWindow *parent, std::string engine_name)
    : LiveEngineDialogFB(parent), engine_name(engine_name) {
  lines_list->InsertColumn(0, "#", wxLIST_FORMAT_LEFT, 50);
  lines_list->InsertColumn(1, "Moves", wxLIST_FORMAT_LEFT, 300);
  current_engine->SetLabel(engine_name);
  StartEngine();
  Bind(wxEVT_BUTTON, &LiveEngineDialog::TogglePauseEngine, this, LIVE_ENGINE_PAUSE_BUTTON);
}

void LiveEngineDialog::StartEngine() {
  timer.Start(1000);
  timer.Bind(wxEVT_TIMER, &LiveEngineDialog::OnTimerTick, this);
}

void LiveEngineDialog::TogglePauseEngine(wxCommandEvent &event) {
  if (timer.IsRunning()) {
    timer.Stop();
    engine_pause_button->SetLabel("Continue");
  } else {
    timer.Start(1000);
    engine_pause_button->SetLabel("Pause");
  }
}

void LiveEngineDialog::OnTimerTick(wxTimerEvent &event) { wxLogDebug("Tick!"); }