//----------------------------------------------------------------------------- // describe variables. void TestCube::debugListVariables( mgStringArray& varNames, mgStringArray& helpText) { // add the superclass variables MovementApp::debugListVariables(varNames, helpText); // add a variable of our own varNames.add("animate"); helpText.add("set animation \"on\" or \"off\""); }
//----------------------------------------------------------------------------- // describe functions. void TestCube::debugListFunctions( mgStringArray& funcNames, mgStringArray& funcParms, mgStringArray& helpText) { // add the superclass functions MovementApp::debugListFunctions(funcNames, funcParms, helpText); // add a function of our own funcNames.add("reset"); funcParms.add(""); helpText.add("reset scene"); }
//-------------------------------------------------------------- // return list of system font directories void mgWinServices::getFontDirectories( mgStringArray& fontDirs) { WCHAR winDir[MAX_PATH]; GetWindowsDirectory(winDir, MAX_PATH); mgString fontPath; fontPath.format("%ls\\Fonts\\", winDir); fontDirs.add(fontPath); }
//-------------------------------------------------------------- // read the font list void readFontList() { char winDir[MAX_PATH]; GetWindowsDirectory(winDir, sizeof(winDir)); mgString fontPath; fontPath.format("%s\\Fonts\\", winDir); mgDebug("windows font dir is %s", (const char*) fontPath); m_fontDirs.add(fontPath); m_fontList = new mgFontList("docs\\fonts.xml"); }
//-------------------------------------------------------------- // scan directory for font files void mgScriptPlatform::scanFontDir( mgStringArray& fontDirs, const char* dirName) { // list contents of directory DIR* directory = opendir(dirName); if (directory == NULL) return; // for each item in directory BOOL foundFont = false; while (true) { struct dirent* entry = readdir(directory); if (entry == NULL) break; if (entry->d_type == DT_DIR) { mgString fileName; fileName.format("%s/%s", dirName, entry->d_name); // scan subdirectory if (entry->d_name[0] != '.') scanFontDir(fontDirs, fileName); } else if (!foundFont) { // if a font file found, add directory to list char* dot = strrchr(entry->d_name, '.'); if (dot != NULL && strcmp(dot, ".ttf") == 0) { mgString saveName(dirName); if (!saveName.endsWith("/")) saveName += "/"; fontDirs.add(saveName); foundFont = true; } } } closedir(directory); }
//-------------------------------------------------------------- // return list of system font directories void mgOSXServices::getFontDirectories( mgStringArray& fontDirs) { fontDirs.add("/Library/Fonts/"); }
//----------------------------------------------------------------------------- // describe variables. void SeaOfMemes::debugListVariables( mgStringArray& varNames, mgStringArray& helpText) { varNames.add("eyePt.x"); helpText.add("Eye x coordinate"); varNames.add("eyePt.y"); helpText.add("Eye y coordinate"); varNames.add("eyePt.z"); helpText.add("Eye z coordinate"); varNames.add("planetDayLen"); helpText.add("Planet rotation time (seconds)"); varNames.add("moonDayLen"); helpText.add("Moon rotation time (seconds)"); varNames.add("ringDayLen"); helpText.add("Ringworld rotation time (seconds)"); varNames.add("moonMonthLen"); helpText.add("Moon orbit time (seconds)"); varNames.add("beltMonthLen"); helpText.add("Belt orbit time (seconds)"); }