From 40a56b72feaad057499e43807b88c7c7463c2938 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sun, 27 Feb 2022 17:02:21 +0100 Subject: Improve live engine dialog --- src/game_tab/editor/LiveEngineDialog.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'src/game_tab/editor/LiveEngineDialog.cpp') diff --git a/src/game_tab/editor/LiveEngineDialog.cpp b/src/game_tab/editor/LiveEngineDialog.cpp index 9c5c43c..cad3fdd 100644 --- a/src/game_tab/editor/LiveEngineDialog.cpp +++ b/src/game_tab/editor/LiveEngineDialog.cpp @@ -1,7 +1,27 @@ #include "LiveEngineDialog.hpp" -LiveEngineDialog::LiveEngineDialog(wxWindow *parent) - : LiveEngineDialogFB(parent) { - lines_list->InsertColumn(0, "#"); - lines_list->InsertColumn(1, "Moves",wxLIST_FORMAT_LEFT, 500); -} \ No newline at end of file +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!"); } \ No newline at end of file -- cgit v1.2.3