-
Notifications
You must be signed in to change notification settings - Fork 0
/
MessageProcessor.h
executable file
·56 lines (44 loc) · 1.13 KB
/
MessageProcessor.h
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
#pragma once
#ifndef MESSAGE_PROCESSOR_H
#define MESSAGE_PROCESSOR_H
#include <sstream>
#include <string>
class Renderer;
struct lua_State;
class MessageLogger {
public:
virtual void log(const WCHAR* line) = 0;
virtual void log(const WCHAR* line, FLOAT r, FLOAT g, FLOAT b) = 0;
void log(std::wstringstream* wss) {
log(wss->str().c_str());
}
void log(std::wstringstream* wss, FLOAT r, FLOAT g, FLOAT b) {
log(wss->str().c_str(),r,g,b);
}
};
class MessageProcessor {
public:
virtual void processMessage(WCHAR* pInput) = 0;
virtual ~MessageProcessor() {};
};
class RendererMessageProcessor : public MessageProcessor {
public:
RendererMessageProcessor(MessageLogger* logger, Renderer* renderer);
~RendererMessageProcessor();
void processMessage(WCHAR* pInput);
private:
void luaLog(std::string s);
void luaLog(float num);
void runScript(std::string s);
void luaError();
MessageLogger* mLogger;
Renderer* mRenderer;
lua_State* mLuaState;
FLOAT mLogColourR;
FLOAT mLogColourG;
FLOAT mLogColourB;
FLOAT mErrorColourR;
FLOAT mErrorColourG;
FLOAT mErrorColourB;
};
#endif