-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSocketInput.h
More file actions
44 lines (35 loc) · 1.15 KB
/
SocketInput.h
File metadata and controls
44 lines (35 loc) · 1.15 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
#pragma once
#include "DasherInput.h"
#include "DefaultFilter.h"
#ifdef _WIN32
#include <SDKDDKVer.h> //Selects version for ASIO on Windows
#endif
#include "asio.hpp"
class SocketInput : public Dasher::CScreenCoordInput, public Dasher::CDefaultFilter
{
public:
SocketInput(Dasher::CSettingsStore* pSettingsStore, Dasher::CDasherInterfaceBase* Controller, Dasher::CFrameRate* pFramerate);
virtual ~SocketInput();
bool GetScreenCoords(Dasher::screenint& iX, Dasher::screenint& iY, Dasher::CDasherView* pView) override;
void startListen();
void stopListen();
private:
bool relativeMode;
double lastRelativeX = 0.5;
double lastRelativeY = 0.5;
Dasher::screenint lastX = 0;
Dasher::screenint lastY = 0;
//Commands
std::string xLabel;
std::string yLabel;
std::string startStopLabel = "s";
// ASIO Stuff
asio::io_service io_service;
std::unique_ptr<asio::ip::tcp::acceptor> session_acceptor;
std::unique_ptr<asio::ip::tcp::socket> open_socket;
asio::streambuf stream_buffer;
// Async Thread
std::thread receiveThread;
bool keepReadThreadAlive = true;
bool keepListenServerAlive = true;
};