- Added missing projects "VFS" & "export" to SVN

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4447 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2011-05-26 11:25:04 +00:00
parent 6e2bdd557c
commit be95a2a7b1
203 changed files with 44525 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
#include <progress_bar.h>
ja2xp::ProgressBar::ProgressBar(int size, int numElements)
: iSIZE(size), num_elements(numElements), count(0)
{
empty_str.resize(iSIZE);
for(int i=0; i<iSIZE; ++i)
{
empty_str[i] = L' ';
}
};
void ja2xp::ProgressBar::Next(vfs::String const& message)
{
count++;
float percent = (float)count/float(num_elements);
wchar_t bar[21] = L" ";
int bar_end = (int)(20*percent);
bar_end = std::min<int>(20,bar_end);
for(int i=0; i < bar_end; ++i)
{
bar[i] = L'=';
}
std::vector<wchar_t> infoZ(iSIZE+1);
std::wstring str = message.c_wcs();
int start = std::min<int>(iSIZE,(int)str.length());
wcsncpy(&infoZ[0],str.c_str(),start);
memcpy(&infoZ[start],&empty_str[0],(iSIZE-start)*sizeof(wchar_t));
infoZ[iSIZE] = 0;
wprintf(L"\r[%.20s] - %.54s", bar, &infoZ[0]);
}