void SetUseArrowMode(TwBar* bar, const char* varName, bool32 useArrowMode, Float3 initialDirection) { if(useArrowMode) { std::string dirString = "'" + ToAnsiString(initialDirection.x) + " " + ToAnsiString(initialDirection.y) + " " + ToAnsiString(initialDirection.z) + "'"; TwCall(TwSetParam(bar, varName, "arrow", TW_PARAM_CSTRING, 1, dirString.c_str())); } else TwCall(TwSetParam(bar, varName, "arrow", TW_PARAM_CSTRING, 1, "0")); }
void CompileOptions::Add(const std::string& name, uint32 value) { Assert_(numDefines < MaxDefines); nameOffsets[numDefines] = bufferIdx; for(uint32 i = 0; i < name.length(); ++i) buffer[bufferIdx++] = name[i]; ++bufferIdx; std::string stringVal = ToAnsiString(value); defineOffsets[numDefines] = bufferIdx; for(uint32 i = 0; i < stringVal.length(); ++i) buffer[bufferIdx++] = stringVal[i]; ++bufferIdx; ++numDefines; }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { //correct current directory SetCurrentDirectory(GetModuleFullDirectory().c_str()); //std::wstring monoRuntimeFullPath = GetModuleFullDirectory() + _T("\\MonoRuntime"); std::wstring monoRuntimeLocalPath = _T("NativeDlls\\Windows_x86\\MonoRuntime"); HMODULE hMonoDllModule = NULL; //load mono dll { //std::wstring dllFullPath = monoRuntimeFullPath + std::wstring(_T("\\bin\\mono.dll")); std::wstring dllPath = monoRuntimeLocalPath + std::wstring(_T("\\bin\\mono.dll")); hMonoDllModule = LoadLibrary( dllPath.c_str() ); if(!hMonoDllModule) { TCHAR error[4096]; wsprintf(error, _T("Loading \"%s\" failed."), dllPath.c_str()); MessageBox(0, error, _T("Mono launcher error"), MB_OK | MB_ICONEXCLAMATION); return -1; } } mono_main* monoMainFunction = (mono_main*)GetProcAddress( hMonoDllModule, "mono_main" ); if(!monoMainFunction) { MessageBox(0, _T("No \"mono_main\" procedure."), _T("Mono launcher error"), MB_OK | MB_ICONEXCLAMATION); return -1; } mono_set_dirs* monoSetDirsFunction = (mono_set_dirs*)GetProcAddress( hMonoDllModule, "mono_set_dirs" ); if(!monoSetDirsFunction) { MessageBox(0, _T("No \"mono_set_dirs\" procedure."), _T("Mono launcher error"), MB_OK | MB_ICONEXCLAMATION); return -1; } std::wstring destinationFileName = GetDestinationFileName(); if(destinationFileName.empty()) return -1; std::string destinationFileNameAnsi = ToAnsiString(destinationFileName); //it's will be modified char* lpCmdLineTemp = new char[wcslen(lpCmdLine) + 1]; memset(lpCmdLineTemp, 0, wcslen(lpCmdLine) + 1); wcstombs(lpCmdLineTemp, lpCmdLine, wcslen(lpCmdLine)); int argc = 0; char* argv[256]; { argv[argc] = "none"; argc++; argv[argc] = (char*)destinationFileNameAnsi.c_str(); argc++; //parse windows command line char* cmdPointer = lpCmdLineTemp; while(*cmdPointer && argc < 256) { while(*cmdPointer && *cmdPointer <= ' ') cmdPointer++; if(*cmdPointer) { argv[argc++] = cmdPointer; while(*cmdPointer && *cmdPointer > ' ') cmdPointer++; if(*cmdPointer) *(cmdPointer++) = 0; } } } //run mono //std::string monoLibPathAnsi = ToAnsiString(monoRuntimeFullPath + _T("\\lib")); //std::string monoEtcPathAnsi = ToAnsiString(monoRuntimeFullPath + _T("\\etc")); std::string monoLibPathAnsi = ToAnsiString(monoRuntimeLocalPath + _T("\\lib")); std::string monoEtcPathAnsi = ToAnsiString(monoRuntimeLocalPath + _T("\\etc")); //1 - path to "lib" directory //2 - config file path (by default in the mono path to "etc" directory) monoSetDirsFunction(monoLibPathAnsi.c_str(), monoEtcPathAnsi.c_str()); int result = monoMainFunction(argc, argv); delete[] lpCmdLineTemp; return result; }
std::string Float4x4::Print() const { std::string result = "{ { " + ToAnsiString(_11) + ToAnsiString(_12) + ToAnsiString(_13) + ToAnsiString(_14) + "}"; result += " { " + ToAnsiString(_21) + ToAnsiString(_22) + ToAnsiString(_23) + ToAnsiString(_24) + "}"; result += " { " + ToAnsiString(_31) + ToAnsiString(_32) + ToAnsiString(_33) + ToAnsiString(_34) + "}"; result += " { " + ToAnsiString(_41) + ToAnsiString(_42) + ToAnsiString(_43) + ToAnsiString(_44) + "} }"; return result; }