diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-02-27 17:02:21 +0100 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-02-27 17:02:21 +0100 |
| commit | 40a56b72feaad057499e43807b88c7c7463c2938 (patch) | |
| tree | e262edf786ce81b7e9d09f0c6ba3ed1daa2f40ca /src/game_tab/editor/LiveEngineDialog.cpp | |
| parent | 0e18d4ac8718414fd6192cc2983b7cd44f5fd28a (diff) | |
Improve live engine dialog
Diffstat (limited to 'src/game_tab/editor/LiveEngineDialog.cpp')
| -rw-r--r-- | src/game_tab/editor/LiveEngineDialog.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
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 |
