Skip to content

Commit d06ac70

Browse files
Implementation modifications.
1 parent ddc9b67 commit d06ac70

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

sample_template/application.cpp

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,29 +104,20 @@ void onButtonsOnOffClick(int eventId, int x, int y, int flags, void *userData)
104104
elems->state = Application::OnFilter;
105105
return;
106106
}
107-
if (offButtonClicked(elems->offButtonPlace, x, y))
107+
if (onButtonClicked(elems->offButtonPlace, x, y))
108108
{
109109
elems->state = Application::OffFilter;
110110
return;
111111
}
112112
}
113113

114-
bool onButtonClicked(cv::Rect onButtonPlace, int x, int y)
114+
bool onButtonClicked(cv::Rect buttonPlace, int x, int y)
115115
{
116-
if (x < onButtonPlace.x || x > onButtonPlace.x + onButtonPlace.width ||
117-
y < onButtonPlace.y || y > onButtonPlace.y + onButtonPlace.height)
116+
if (x < buttonPlace.x || x > buttonPlace.x + buttonPlace.width ||
117+
y < buttonPlace.y || y > buttonPlace.y + buttonPlace.height)
118118
{
119119
return false;
120120
}
121121
return true;
122122
}
123123

124-
bool offButtonClicked(cv::Rect offButtonPlace, int x, int y)
125-
{
126-
if (x < offButtonPlace.x || x > offButtonPlace.x + offButtonPlace.width ||
127-
y < offButtonPlace.y || y > offButtonPlace.y + offButtonPlace.height)
128-
{
129-
return false;
130-
}
131-
return true;
132-
}

sample_template/application.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
#include "processing.hpp"
88

9-
bool onButtonClicked(cv::Rect onButtonPlace, int x, int y);
10-
bool offButtonClicked(cv::Rect offButtonPlace, int x, int y);
9+
bool onButtonClicked(cv::Rect buttonPlace, int x, int y);
1110
void onButtonsOnOffClick(int eventId, int x, int y, int flags, void *userData);
1211

1312
class Application
@@ -46,6 +45,5 @@ class Application
4645

4746
int drawButtons(cv::Mat &display);
4847

49-
friend bool onButtonClicked(cv::Rect onButtonPlace, int x, int y);
50-
friend bool offButtonClicked(cv::Rect offButtonPlace, int x, int y);
48+
friend bool onButtonClicked(cv::Rect buttonPlace, int x, int y);
5149
};

0 commit comments

Comments
 (0)