Skip to content

Commit

Permalink
replay control clicks in open dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios committed Jul 4, 2024
1 parent c2bffbe commit aa85865
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/dialogxml/dialogs/dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "tools/cursors.hpp"
#include "tools/prefs.hpp"
#include "tools/framerate_limiter.hpp"
#include "replay.hpp"

using namespace std;
using namespace ticpp;
Expand Down Expand Up @@ -560,7 +561,16 @@ void cDialog::handle_events() {
cFramerateLimiter fps_limiter;

while(dialogNotToast) {
while(win.pollEvent(currentEvent)) handle_one_event(currentEvent);
if(replaying){
if(next_action_type() == "control_click"){
Element* next_action = pop_next_action();
auto info = info_from_action(next_action);
eKeyMod mods = static_cast<eKeyMod>(atoi(info["mods"].c_str()));
controls[info["id"]]->triggerClickHandler(*this, info["id"], mods);
}
}else{
while(win.pollEvent(currentEvent)) handle_one_event(currentEvent);
}

// Ideally, this should be the only draw call that is done in a cycle.
draw();
Expand Down
1 change: 1 addition & 0 deletions src/dialogxml/widgets/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "mathutil.hpp"
#include "tools/prefs.hpp"
#include "tools/cursors.hpp"
#include "replay.hpp"

void cControl::setText(std::string l){
lbl = l;
Expand Down

0 comments on commit aa85865

Please sign in to comment.