projects
/
physics.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added using namespace pg to relavent files ... will remove at some point
[physics.git]
/
src
/
config
/
reader.cpp
diff --git
a/src/config/reader.cpp
b/src/config/reader.cpp
index
c42e50d
..
edba875
100644
(file)
--- a/
src/config/reader.cpp
+++ b/
src/config/reader.cpp
@@
-16,9
+16,15
@@
*/
#include "reader.h"
*/
#include "reader.h"
-#include "../debug.h"
+
+#include <pg/debug.h>
+using namespace pg;
#include <iostream>
#include <iostream>
+using std::cerr;
+using std::cout;
+using std::endl;
+
#include <fstream>
#include <string>
#include <fstream>
#include <string>
@@
-27,7
+33,7
@@
using std::ifstream;
using std::string;
using std::ifstream;
using std::string;
-typedef std::map<string, SDLKey
, comparestrings
> kMap;
+typedef std::map<string, SDLKey> kMap;
kMap keyMap;
/// ***** Private Method Headers *****
kMap keyMap;
/// ***** Private Method Headers *****
@@
-39,7
+45,7
@@
void createKeyMap();
/// ***** Private Variables *****
const char* configDir = "configs/";
/// ***** Private Variables *****
const char* configDir = "configs/";
-const char* testFile = "
test2
.cfg";
+const char* testFile = "
keys
.cfg";
/// ***** Public Methods *****
/// ***** Public Methods *****
@@
-93,9
+99,6
@@
void processLine(const string& str)
{
*(key::sdlMap[name]) = key;
}
{
*(key::sdlMap[name]) = key;
}
- cout << name << endl;
- cout << value << endl;
- cout << key << endl;
}
}
}
}
@@
-117,11
+120,11
@@
bool extractLine(const string& str, string* name, string* value)
int char_pos = 0;
int char_pos = 0;
- int name_start;
- int name_end;
+ int name_start
= 0
;
+ int name_end
= 0
;
- int value_start;
- int value_end;
+ int value_start
= 0
;
+ int value_end
= 0
;
const char* c_str = str.c_str();
const char* c_str = str.c_str();
@@
-201,17
+204,26
@@
bool extractLine(const string& str, string* name, string* value)
void createKeyMap()
{
void createKeyMap()
{
+ char buf[2] = {0,0};
+
// add all the letters
for (int i = 'A'; i <= 'Z'; i++) // uppercase
// 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 + 'a' - 'A');
+ }
for (int i = 'a'; i <= 'z'; i++) // lowercase
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++)
// 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
/*
// add the function keys
@@
-287,7
+299,4
@@
void createKeyMap()
keyMap["Down"] = SDLK_DOWN;
keyMap["Left"] = SDLK_LEFT;
keyMap["Right"] = SDLK_RIGHT;
keyMap["Down"] = SDLK_DOWN;
keyMap["Left"] = SDLK_LEFT;
keyMap["Right"] = SDLK_RIGHT;
-
- cout << "done" << endl;
- cout << keyMap["k"] << endl;
}
}