Repository navigation
Expand file tree
/
Copy pathGameConsole_SnapshotDumper.h
More file actions
82 lines (60 loc) · 1.82 KB
/
Copy pathGameConsole_SnapshotDumper.h
File metadata and controls
82 lines (60 loc) · 1.82 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
/* Snapshot Dumper
*
* From: https://github.com/PokemonAutomation/
*
*/
#ifndef PokemonAutomation_GameConsole_SnapshotDumper_H
#define PokemonAutomation_GameConsole_SnapshotDumper_H
#include "Common/Cpp/Options/SimpleIntegerOption.h"
#include "Common/Cpp/Options/EnumDropdownOption.h"
#include "ControllerInput/ControllerInput.h"
#include "GameConsole/ConsoleProgram.h"
namespace PokemonAutomation{
namespace GameConsole{
class SnapshotDumper_Descriptor : public ConsoleProgramDescriptor{
public:
SnapshotDumper_Descriptor();
};
enum class Format{
PNG,
JPG,
};
class SnapshotDumper : public ConsoleProgramInstance, public ConfigOption::Listener{
public:
using Descriptor = SnapshotDumper_Descriptor;
~SnapshotDumper();
SnapshotDumper();
virtual void program(ConsoleProgramEnvironment& env, CancellableScope& scope) override;
private:
virtual void on_config_value_changed(void* object) override;
private:
SimpleIntegerOption<uint32_t> PERIOD_MILLISECONDS;
enum class SnapshotMode{
KEYPRESS,
MOUSE_CLICK,
PERIODIC,
};
EnumDropdownOption<SnapshotMode> SNAPSHOT_MODE;
EnumDropdownOption<Format> FORMAT;
};
class SnapshotKeyTrigger : public ControllerInputListener{
public:
~SnapshotKeyTrigger();
SnapshotKeyTrigger(VideoStream& stream, Format format);
private:
void detach();
virtual void run_controller_input(ControllerInputState& state) override;
private:
VideoStream& m_stream;
Format m_format;
};
std::string to_format_string(Format format);
// takes a snapshot of the screen and saves it to the given folder_name
void dump_snapshot(
VideoStream& stream,
std::string folder_name = "ScreenshotDumper",
std::string format = ".png"
);
}
}
#endif