void Kludget::setupContextMenu() { contextMenu.clear(); #if defined(WIN32) loadMenuFile(":resources/xml/widgetContextMenu.xml"); #else loadMenuFile(":resources/xml/widgetContextMenu_linux.xml"); #endif }
int main( int argc, char *argv[] ) { char *path; #ifdef __FreeBSD__ fpsetmask(0); #endif SystemInit(&argc, argv); path = getFullPath("settings.txt"); if(path != 0) initMainGameSettings(path); /* reads defaults from ~/.gltronrc */ else { printf("fatal: could not settings.txt, exiting...\n"); exit(1); } parse_args(argc, argv); /* sound */ #ifdef SOUND printf("initializing sound\n"); initSound(); path = getFullPath("gltron.it"); if(path == 0 || loadSound(path)) printf("error trying to load sound\n"); else { if(game->settings->playMusic) playSound(); free(path); } #endif printf("loading menu\n"); path = getFullPath("menu.txt"); if(path != 0) pMenuList = loadMenuFile(path); else { printf("fatal: could not load menu.txt, exiting...\n"); exit(1); } printf("menu loaded\n"); free(path); initGameStructures(); resetScores(); initData(); setupDisplay(game->screen); switchCallbacks(&guiCallbacks); switchCallbacks(&guiCallbacks); SystemMainLoop(); return 0; }
void Kludget::loadMenuFile(const QString &path) { QFile fmenu(path); if (fmenu.exists()) { fmenu.open(QIODevice::ReadOnly); QString content = fmenu.readAll(); fmenu.close(); QDomDocument dom; dom.setContent(content); QDomNodeList menuList = dom.elementsByTagName("menu"); if (menuList.length() > 0) { QDomNodeList menuItemList = menuList.item(0).childNodes(); for (int i = 0; i < menuItemList.length(); i++) { QDomElement menuItem = menuItemList.item(i).toElement(); QString name = menuItem.firstChild().nodeValue(); QString script = menuItem.attributes().namedItem("action").nodeValue(); if (menuItem.nodeName().toLower() == "custom_menu") { loadMenuFile(info.configFile); loadMenuFile(info.path + "/" + MENU_FILE); continue; } if (menuItem.nodeName().toLower() == "separator") { contextMenu.insertSeparator(0); continue; } if (script == "") continue; QAction *action = contextMenu.addAction(name); connect(action, SIGNAL(triggered()), &customMenuMapper, SLOT(map())); customMenuMapper.setMapping(action, script); } } } }
Common::Error AGOSEngine::go() { #ifdef ENABLE_AGOS2 loadArchives(); #endif loadGamePcFile(); addTimeEvent(0, 1); if (getFileName(GAME_GMEFILE) != NULL) { openGameFile(); } if (getGameType() == GType_FF) { loadIconData(); } else if (getFileName(GAME_ICONFILE) != NULL) { loadIconFile(); } if (getFileName(GAME_MENUFILE) != NULL) { loadMenuFile(); } vc34_setMouseOff(); if (getGameType() != GType_PP && getGameType() != GType_FF) { uint16 count = (getGameType() == GType_SIMON2) ? 5 : _frameCount; addVgaEvent(count, ANIMATE_INT, NULL, 0, 0); } if (getGameType() == GType_ELVIRA1 && getPlatform() == Common::kPlatformAtariST && (getFeatures() & GF_DEMO)) { setWindowImage(3, 9900); while (!shouldQuit()) delay(0); } if (getGameType() == GType_ELVIRA1 && getPlatform() == Common::kPlatformAmiga && (getFeatures() & GF_DEMO)) { playMusic(0, 0); } runSubroutine101(); permitInput(); while (!shouldQuit()) { waitForInput(); handleVerbClicked(_verbHitArea); delay(100); } return Common::kNoError; }
int main( int argc, char *argv[] ) { char *path; list *l; #ifdef SOUND int c; #endif #ifdef __FreeBSD__ fpsetmask(0); #endif #ifdef macintosh setupHomeEnvironment (); #endif SystemInit(&argc, argv); #ifndef CURRENT_EQ_DATA_DIR goto_installpath(argv[0]); #endif /* initialize artpack list before loading settigns! */ initArtpacks(); path = getFullPath("settings.txt"); if(path != NULL) initMainGameSettings(path); /* reads defaults from ~/.gltronrc */ else { printf("fatal: could not settings.txt, exiting...\n"); exit(1); } parse_args(argc, argv); consoleInit(); initGameStructures(); resetScores(); /* sound */ path = getMusicPath(MUSIC_DIR); game->settings->soundList = readDirectoryContents(path, SONG_PREFIX); game->settings->soundIndex = -1; l = game->settings->soundList; #ifdef SOUND printf("initializing sound\n"); initSound(); setFxVolume(game->settings->fxVolume); if(l->next != NULL) { char *tmp; tmp = malloc(strlen(path) + 1 + /* seperator */ strlen((char*) l->data) + 1); sprintf(tmp, "%s%c%s", path, SEPERATOR, (char*) l->data); fprintf(stderr, "loading song %s\n", tmp); loadSound(tmp); free(tmp); game->settings->soundIndex = 0; } c = 0; while(l->next != NULL) { l = l->next; c++; } game->settings->soundSongCount = c; if(game->settings->playMusic) playSound(); fprintf(stderr, "setting music volume to %.3f\n", game->settings->musicVolume); setMusicVolume(game->settings->musicVolume); free(path); #endif printf("loading menu\n"); path = getFullPath("menu.txt"); if(path != NULL) pMenuList = loadMenuFile(path); else { printf("fatal: could not load menu.txt, exiting...\n"); exit(1); } printf("menu loaded\n"); free(path); setupDisplay(game->screen); switchCallbacks(&guiCallbacks); switchCallbacks(&guiCallbacks); SystemMainLoop(); return 0; }