X-Git-Url: http://gitweb.pgornicz.com/gitweb.cgi?a=blobdiff_plain;f=src%2Fconfig%2Freader.cpp;h=d29f8b0daa09de7513ff23760c53178b8423fc4f;hb=a3e0400dfe6b7bc43e43db787ff701da8be9c5cc;hp=c42e50d738b4c403bb8ed8ec6cbf7393a7e46142;hpb=338e728a60fc9135b534be4e8ad0bb43997a1ea4;p=physics.git diff --git a/src/config/reader.cpp b/src/config/reader.cpp index c42e50d..d29f8b0 100644 --- a/src/config/reader.cpp +++ b/src/config/reader.cpp @@ -27,7 +27,7 @@ using std::ifstream; using std::string; -typedef std::map kMap; +typedef std::map kMap; kMap keyMap; /// ***** Private Method Headers ***** @@ -39,7 +39,7 @@ void createKeyMap(); /// ***** Private Variables ***** const char* configDir = "configs/"; -const char* testFile = "test2.cfg"; +const char* testFile = "keys.cfg"; /// ***** Public Methods ***** @@ -201,17 +201,26 @@ bool extractLine(const string& str, string* name, string* value) void createKeyMap() { + char buf[2] = {0,0}; + // add all the letters for (int i = 'A'; i <= 'Z'; i++) // uppercase - keyMap["" + (char)i] = (SDLKey)i; + { + buf[0] = (char)i; + keyMap[buf] = (SDLKey)i; + } for (int i = 'a'; i <= 'z'; i++) // lowercase - keyMap["" + (char)i] = (SDLKey)i; + { + buf[0] = (char)i; + keyMap[buf] = (SDLKey)i; + } // add all the numbers for (int i = '0'; i <= '9'; i++) - keyMap["" + (char)i] = (SDLKey)i; - - keyMap["k"] = (SDLKey)'k'; + { + buf[0] = (char)i; + keyMap[buf] = (SDLKey)i; + } /* // add the function keys @@ -287,7 +296,4 @@ void createKeyMap() keyMap["Down"] = SDLK_DOWN; keyMap["Left"] = SDLK_LEFT; keyMap["Right"] = SDLK_RIGHT; - - cout << "done" << endl; - cout << keyMap["k"] << endl; }