77#include < optional>
88#include " Common/Cpp/Concurrency/Mutex.h"
99#include " CommonFramework/VideoPipeline/VideoOverlayScopes.h"
10- #include " Common/Cpp/Strings/StringTools.h"
1110#include " BoxDraw.h"
1211
1312// #include <iostream>
@@ -19,85 +18,6 @@ namespace NintendoSwitch{
1918
2019
2120
22- BoxDrawGroup::~BoxDrawGroup (){
23- BOX_COORDINATES.remove_listener (*this );
24- HEIGHT.remove_listener (*this );
25- WIDTH.remove_listener (*this );
26- Y.remove_listener (*this );
27- X.remove_listener (*this );
28- }
29- BoxDrawGroup::BoxDrawGroup (
30- std::string label,
31- LockMode lock_while_program_is_running,
32- EnableMode enable_mode,
33- bool show_restore_defaults_button,
34- ImageFloatBox box
35- )
36- : GroupOption(
37- std::move (label),
38- lock_while_program_is_running,
39- enable_mode,
40- show_restore_defaults_button
41- )
42- , X(" <b>X Coordinate:</b>" , LockMode::UNLOCK_WHILE_RUNNING, box.x, 0.0 , 1.0 )
43- , Y(" <b>Y Coordinate:</b>" , LockMode::UNLOCK_WHILE_RUNNING, box.y, 0.0 , 1.0 )
44- , WIDTH(" <b>Width:</b>" , LockMode::UNLOCK_WHILE_RUNNING, box.width, 0.0 , 1.0 )
45- , HEIGHT(" <b>Height:</b>" , LockMode::UNLOCK_WHILE_RUNNING, box.height, 0.0 , 1.0 )
46- , BOX_COORDINATES(
47- false ,
48- " ImageFloatBox coordinates" ,
49- LockMode::UNLOCK_WHILE_RUNNING,
50- make_full_str (),
51- "0.3, 0.3, 0.4, 0.4"
52- )
53- {
54- PA_ADD_OPTION (X);
55- PA_ADD_OPTION (Y);
56- PA_ADD_OPTION (WIDTH);
57- PA_ADD_OPTION (HEIGHT);
58- PA_ADD_OPTION (BOX_COORDINATES);
59-
60- BoxDrawGroup::on_config_value_changed (&X);
61- X.add_listener (*this );
62- Y.add_listener (*this );
63- WIDTH.add_listener (*this );
64- HEIGHT.add_listener (*this );
65- BOX_COORDINATES.add_listener (*this );
66- }
67-
68- void BoxDrawGroup::on_config_value_changed (void * object){
69- if (object == &X || object == &Y || object == &WIDTH || object == &HEIGHT){
70- BOX_COORDINATES.set (make_full_str ());
71- report_value_changed (this );
72- }else if (object == &BOX_COORDINATES){
73- std::string box_coord_string = BOX_COORDINATES;
74- std::vector<std::string> all_coords = StringTools::split (box_coord_string, " , " );
75-
76- std::string x_string = all_coords[0 ];
77- std::string y_string = all_coords[1 ];
78- std::string width_string = all_coords[2 ];
79- std::string height_string = all_coords[3 ];
80-
81- double x_coord = std::stod (x_string);
82- double y_coord = std::stod (y_string);
83- double width_coord = std::stod (width_string);
84- double height_coord = std::stod (height_string);
85-
86- // cout << box_coord_string << endl;
87- // cout << std::to_string(x_coord) << endl;
88- // cout << std::to_string(y_coord) << endl;
89- // cout << std::to_string(width_coord) << endl;
90- // cout << std::to_string(height_coord) << endl;
91-
92- X.set (x_coord);
93- Y.set (y_coord);
94- WIDTH.set (width_coord);
95- HEIGHT.set (height_coord);
96- }else {
97- report_value_changed (object);
98- }
99- }
100-
10121
10222
10323
0 commit comments