New listener system for different components
This commit is contained in:
parent
ccb95d43a5
commit
310b3edfcc
@ -19,6 +19,11 @@ void UI::render() {
|
||||
|
||||
if (*lastKey == 100) {
|
||||
debug = !debug;
|
||||
if (debug == true) {
|
||||
for (unsigned i = 0; i < UIListeners.size(); i++) {
|
||||
UIListeners[i]->componentSetup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
|
3
src/UI.h
3
src/UI.h
@ -8,6 +8,7 @@
|
||||
#ifndef UI_H_
|
||||
#define UI_H_
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include "UIListener.hpp"
|
||||
|
||||
class UI {
|
||||
bool debug = false, showSlider = false;
|
||||
@ -15,8 +16,8 @@ class UI {
|
||||
int *lastKey;
|
||||
unsigned state = 0;
|
||||
std::vector<cv::Mat> frames = {cv::Mat()};
|
||||
std::vector<void(*)()> debugAddonStarter;
|
||||
public:
|
||||
std::vector<UIListener *> UIListeners;
|
||||
UI(int *lastKey);
|
||||
void render();
|
||||
void nextDebugFrame();
|
||||
|
12
src/UIListener.hpp
Executable file
12
src/UIListener.hpp
Executable file
@ -0,0 +1,12 @@
|
||||
#ifndef UILISTENER_HPP_
|
||||
#define UILISTENER_HPP_
|
||||
|
||||
|
||||
class UIListener {
|
||||
public:
|
||||
virtual void componentSetup() = 0;
|
||||
virtual ~UIListener();
|
||||
};
|
||||
|
||||
|
||||
#endif /* UILISTENER_HPP_ */
|
Loading…
Reference in New Issue
Block a user