record arrow button clicks (cosmetic)

This commit is contained in:
2024-08-23 20:47:56 -05:00
committed by Celtic Minstrel
parent e9b4aae524
commit 9d31dd3589
2 changed files with 15 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
#include <list> #include <list>
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>
#include <sstream>
#include <memory> #include <memory>
#include "boe.global.hpp" #include "boe.global.hpp"
@@ -38,6 +39,8 @@
#include "boe.menus.hpp" #include "boe.menus.hpp"
#include "tools/winutil.hpp" #include "tools/winutil.hpp"
#include "tools/prefs.hpp" #include "tools/prefs.hpp"
#include "replay.hpp"
#ifndef MSBUILD_GITREV #ifndef MSBUILD_GITREV
#include "tools/gitrev.hpp" #include "tools/gitrev.hpp"
#endif #endif
@@ -438,6 +441,13 @@ void draw_start_button(eStartButton which_position,short which_button) {
} }
void arrow_button_click(rectangle button_rect) { void arrow_button_click(rectangle button_rect) {
if(recording){
// This action is purely cosmetic, for playing the animation and sound accompanying a click on a button whose real action
// is recorded afterward
std::ostringstream sstr;
sstr << button_rect;
record_action("arrow_button_click", sstr.str());
}
mainPtr.setActive(); mainPtr.setActive();
clip_rect(mainPtr, button_rect); clip_rect(mainPtr, button_rect);
// TODO: Mini-event loop so that the click doesn't happen until releasing the mouse button // TODO: Mini-event loop so that the click doesn't happen until releasing the mouse button

View File

@@ -329,6 +329,11 @@ static void replay_next_action() {
handle_give_item(item_hit, did_something, need_redraw); handle_give_item(item_hit, did_something, need_redraw);
}else if(t == "close_window"){ }else if(t == "close_window"){
handle_quit_event(); handle_quit_event();
}else if(t == "arrow_button_click"){
rectangle button_rect;
std::istringstream sstr(next_action.GetText());
sstr >> button_rect;
arrow_button_click(button_rect);
} }
advance_time(did_something, need_redraw, need_reprint); advance_time(did_something, need_redraw, need_reprint);