forked from PokemonAutomation/Arduino-Source
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPokemonFRLG_PartyMenuDetector.h
More file actions
114 lines (94 loc) · 2.99 KB
/
PokemonFRLG_PartyMenuDetector.h
File metadata and controls
114 lines (94 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* Party Menu Detector
*
* From: https://github.com/PokemonAutomation/
*
*/
#ifndef PokemonAutomation_PokemonFRLG_PartyMenuDetector_H
#define PokemonAutomation_PokemonFRLG_PartyMenuDetector_H
#include <chrono>
#include "Common/Cpp/Color.h"
#include "CommonFramework/ImageTools/ImageBoxes.h"
#include "CommonFramework/VideoPipeline/VideoOverlayScopes.h"
#include "CommonTools/VisualDetector.h"
#include "CommonTools/InferenceCallbacks/VisualInferenceCallback.h"
#include "PokemonFRLG/PokemonFRLG_Settings.h"
namespace PokemonAutomation{
class CancellableScope;
class VideoFeed;
namespace NintendoSwitch{
namespace PokemonFRLG{
enum class PartySlot{
ONE,
TWO,
THREE,
FOUR,
FIVE,
SIX
//CXL
};
// The Party menu has a white box on the bottom
// The background around the edges is dark teal/navy
class PartyMenuDetector : public StaticScreenDetector{
public:
PartyMenuDetector(Color color);
virtual void make_overlays(VideoOverlaySet& items) const override;
virtual bool detect(const ImageViewRGB32& screen) override;
private:
ImageFloatBox m_dialog_top_box;
ImageFloatBox m_page_background_box;
};
class PartyMenuWatcher : public DetectorToFinder<PartyMenuDetector>{
public:
PartyMenuWatcher(Color color)
: DetectorToFinder("PartyMenuWatcher", std::chrono::milliseconds(250), color)
{}
};
// The Party menu has a white box in the bottom right corner when a Pokemon is selected
// The background around the edges is dark teal/navy
class PartySelectionDetector : public StaticScreenDetector{
public:
PartySelectionDetector(Color color);
virtual void make_overlays(VideoOverlaySet& items) const override;
virtual bool detect(const ImageViewRGB32& screen) override;
private:
ImageFloatBox m_dialog_right_box;
ImageFloatBox m_page_background_box;
};
class PartySelectionWatcher : public DetectorToFinder<PartySelectionDetector>{
public:
PartySelectionWatcher(Color color)
: DetectorToFinder("PartySelectionWatcher", std::chrono::milliseconds(250), color)
{}
};
class PartySlotDetector : public StaticScreenDetector{
public:
PartySlotDetector(
Color color,
const ImageFloatBox& box
);
PartySlotDetector(
Color color,
PartySlot position
);
static ImageFloatBox party_slot_boxes(PartySlot position);
virtual void make_overlays(VideoOverlaySet& items) const override;
virtual bool detect(const ImageViewRGB32& screen) override;
private:
const Color m_color;
const ImageFloatBox m_party_box;
};
class PartySlotWatcher : public DetectorToFinder<PartySlotDetector>{
public:
PartySlotWatcher(
Color color,
PartySlot position,
std::chrono::milliseconds hold_duration = std::chrono::milliseconds(250)
)
: DetectorToFinder("PartySlotWatcher", hold_duration, color, party_slot_boxes(position))
{
}
};
}
}
}
#endif