1 #ifndef INPUTHELPER_GAME_H 2 #define INPUTHELPER_GAME_H 37 void handleKey(std::string JSONmessage) {
38 using namespace rapidjson;
40 rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> alloc;
42 msg.Parse(JSONmessage.c_str());
44 std::string type = msg[
"type"].GetString();
46 bool setto = (type.compare(
"keydown") == 0);
48 std::string key = msg[
"key"].GetString();
50 if (key.compare(
"ArrowUp") == 0)
52 else if (key.compare(
"ArrowDown") == 0)
54 else if (key.compare(
"ArrowLeft") == 0)
56 else if (key.compare(
"ArrowRight") == 0)
58 else if (key.compare(
"w") == 0)
60 else if (key.compare(
"a") == 0)
62 else if (key.compare(
"s") == 0)
64 else if (key.compare(
"d") == 0)
66 else if (key.compare(
"q") == 0)
68 else if (key.compare(
" ") == 0)
74 virtual void keyup(std::string JSONmessage)
override {
76 std::cerr <<
"InputHelper::keyup(\"" << JSONmessage <<
"\")\n";
77 handleKey(JSONmessage);
80 virtual void keydown(std::string JSONmessage)
override {
82 std::cerr <<
"InputHelper::keydown(\"" << JSONmessage <<
"\")\n";
83 handleKey(JSONmessage);
these methods convert byte arrays in to base64 codes and are used in BRIDGES to represent the color a...
Definition: alltypes.h:4
This is meant to be an internal class, not something that the library user will use. Provides support for input handling for the Game API.
Definition: SocketConnection.h:23