summaryrefslogtreecommitdiff
path: root/src/utils/files.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-11-07 16:32:18 +0300
committerAndrei Karas <akaras@inbox.ru>2013-11-07 18:56:07 +0300
commit64535f9763c432bbb46be2769560bfd6a2202d72 (patch)
tree08221a911005ad417cbdc339b02a416b757122a5 /src/utils/files.cpp
parentcf77bdc4baa273d8750175411cb59af3ca3c07ac (diff)
downloadmanaplus-64535f9763c432bbb46be2769560bfd6a2202d72.tar.gz
manaplus-64535f9763c432bbb46be2769560bfd6a2202d72.tar.bz2
manaplus-64535f9763c432bbb46be2769560bfd6a2202d72.tar.xz
manaplus-64535f9763c432bbb46be2769560bfd6a2202d72.zip
add progress bar while loading in SDL2 in Android.
Diffstat (limited to 'src/utils/files.cpp')
-rw-r--r--src/utils/files.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/utils/files.cpp b/src/utils/files.cpp
index 6f57d3062..bfaed472a 100644
--- a/src/utils/files.cpp
+++ b/src/utils/files.cpp
@@ -63,6 +63,18 @@ void Files::extractLocale()
#endif // ANDROID
#if defined(ANDROID) || defined(__native_client__)
+
+namespace
+{
+ int mFilesCount = 0;
+ Files::CopyFileCallbackPtr mCallbackPtr = nullptr;
+} // namespace
+
+void Files::setCopyCallBack(Files::CopyFileCallbackPtr callback)
+{
+ mCallbackPtr = callback;
+}
+
void Files::copyPhysFsFile(const std::string &inFile,
const std::string &outFile)
{
@@ -72,6 +84,13 @@ void Files::copyPhysFsFile(const std::string &inFile,
fwrite(buf, 1, size, file);
fclose(file);
free(buf);
+#ifdef ANDROID
+ if (mCallbackPtr)
+ {
+ mCallbackPtr(mFilesCount);
+ mFilesCount ++;
+ }
+#endif
}
void Files::copyPhysFsDir(const std::string &inDir, const std::string &outDir)