summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-08 13:57:15 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-08 14:42:50 +0300
commit0f500fab826a57f8aae8a3e2062a90ee9e80a199 (patch)
tree7b64795fb51efd026adf246eb1306c9da05c2892 /src/utils
parente05655679e7bd9488c31169ece3d404fd9160c8d (diff)
downloadplus-0f500fab826a57f8aae8a3e2062a90ee9e80a199.tar.gz
plus-0f500fab826a57f8aae8a3e2062a90ee9e80a199.tar.bz2
plus-0f500fab826a57f8aae8a3e2062a90ee9e80a199.tar.xz
plus-0f500fab826a57f8aae8a3e2062a90ee9e80a199.zip
Add ShaderManager and Shader class.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/files.cpp16
-rw-r--r--src/utils/files.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/src/utils/files.cpp b/src/utils/files.cpp
index d3a04d69f..e435249da 100644
--- a/src/utils/files.cpp
+++ b/src/utils/files.cpp
@@ -270,6 +270,22 @@ std::string Files::getPath(const std::string &file)
return path;
}
+std::string Files::loadTextFileString(const std::string &fileName)
+{
+ int contentsLength;
+ char *fileContents = static_cast<char*>(
+ PhysFs::loadFile(fileName, contentsLength));
+
+ if (!fileContents)
+ {
+ logger->log("Couldn't load text file: %s", fileName.c_str());
+ return std::string();
+ }
+ const std::string str = std::string(fileContents, contentsLength);
+ free(fileContents);
+ return str;
+}
+
bool Files::loadTextFile(const std::string &fileName,
StringVect &lines)
{
diff --git a/src/utils/files.h b/src/utils/files.h
index 1db9993a7..5e17f8f5a 100644
--- a/src/utils/files.h
+++ b/src/utils/files.h
@@ -69,6 +69,8 @@ namespace Files
bool loadTextFile(const std::string &fileName,
StringVect &lines);
+ std::string loadTextFileString(const std::string &fileName);
+
bool loadTextFileLocal(const std::string &fileName,
StringVect &lines);