void VPiano::applyPreferences() { ui.pianokeybd->allKeysOff(); if (ui.pianokeybd->baseOctave() != dlgPreferences.getBaseOctave()) { ui.pianokeybd->setBaseOctave(dlgPreferences.getBaseOctave()); } if (ui.pianokeybd->numOctaves() != dlgPreferences.getNumOctaves()) { ui.pianokeybd->setNumOctaves(dlgPreferences.getNumOctaves()); } ui.pianokeybd->setKeyPressedColor(dlgPreferences.getKeyPressedColor()); m_sboxChannel->setValue(dlgPreferences.getOutChannel() + 1); m_sboxOctave->setValue(dlgPreferences.getBaseOctave()); m_Velocity->setValue(dlgPreferences.getVelocity()); m_ins = NULL; m_comboBank->clear(); m_comboProg->clear(); if (!dlgPreferences.getInstrumentsFileName().isEmpty() && ((m_ins = dlgPreferences.getInstrument()) != NULL)) { //qDebug() << "Instrument Name:" << m_ins->instrumentName(); //qDebug() << "Bank Selection method: " << m_ins->bankSelMethod(); m_ctlState.clear(); initControllers(); InstrumentPatches patches = m_ins->patches(); InstrumentPatches::ConstIterator j; for( j=patches.begin(); j!=patches.end(); ++j ) { //if (j.key() < 0) continue; InstrumentData patch = j.value(); m_comboBank->addItem(patch.name(), j.key()); //qDebug() << "---- Bank[" << j.key() << "]=" << patch.name(); } } }
void VPiano::resetAllControllers() { sendController(CTL_RESET_ALL_CTL, 0); int index = m_comboControl->currentIndex(); int ctl = m_comboControl->itemData(index).toInt(); initControllers(); m_comboControl->setCurrentIndex(index); m_Control->setValue(m_ctlState[ctl]); }
Scene* GameScene::createScene() { // 'scene' is an autorelease object auto scene = Scene::create(); // 'layer' is an autorelease object auto layer = GameScene::create(); // add layer as a child to scene scene->addChild(layer); // Add controller layer scene->addChild(layer->initControllers(), 1); // return the scene return scene; }
/* * This is the main routine of the app. */ static void mainproc(void *arg) { /* * Setup the message queues */ osCreateMesgQueue(&dmaMessageQ, &dmaMessageBuf, 1); osCreateMesgQueue(&rspMessageQ, &rspMessageBuf, 1); osSetEventMesg(OS_EVENT_SP, &rspMessageQ, NULL); osCreateMesgQueue(&rdpMessageQ, &rdpMessageBuf, 1); osSetEventMesg(OS_EVENT_DP, &rdpMessageQ, NULL); osCreateMesgQueue(&retraceMessageQ, &retraceMessageBuf, 1); osViSetEvent(&retraceMessageQ, NULL, 1); /* * Stick the static segment right after the code/data segment */ staticSegment = _zbufferSegmentEnd; osPiStartDma(&dmaIOMessageBuf, OS_MESG_PRI_NORMAL, OS_READ, (u32) _staticSegmentRomStart, staticSegment, (u32) _staticSegmentRomEnd - (u32) _staticSegmentRomStart, &dmaMessageQ); /* * Wait for DMA to finish */ (void) osRecvMesg(&dmaMessageQ, NULL, OS_MESG_BLOCK); freeSegment = staticSegment + (u32) _staticSegmentRomEnd - (u32) _staticSegmentRomStart; initControllers(MAXCONTROLLERS); game(); }
PuyoCommander::PuyoCommander(bool fs, bool snd, bool audio) { int init_flags = SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_JOYSTICK; SDL_Delay(500); corona = NULL; fullscreen = GetBoolPreference(kFullScreen,fs); #ifdef HAVE_OPENGL useGL = GetBoolPreference(kOpenGL,false); #endif sound = GetBoolPreference(kMusic,snd); fx = GetBoolPreference(kAudioFX,audio); music_volume = GetIntPreference(kMusicVolume, 100); int audio_volume = GetIntPreference(kAudioVolume, 80); initGameControls(); #ifdef USE_DGA /* This Hack Allows Hardware Surface on Linux */ if (fullscreen) setenv("SDL_VIDEODRIVER","dga",0); if (SDL_Init(init_flags) < 0) { setenv("SDL_VIDEODRIVER","x11",1); if (SDL_Init(init_flags) < 0) { fprintf(stderr, "SDL initialisation error: %s\n", SDL_GetError()); exit(1); } } else { if (fullscreen) SDL_WM_GrabInput(SDL_GRAB_ON); } #else #ifdef WIN32 _putenv("SDL_VIDEODRIVER=windib"); #endif if ( SDL_Init(init_flags) < 0 ) { fprintf(stderr, "SDL initialisation error: %s\n", SDL_GetError()); exit(1); } #endif initControllers(); initHiScores(AI_NAMES); #ifdef USE_AUDIO audio_init(); audio_music_start(0); if (sound==false) Mix_PauseMusic(); audio_set_music_on_off(sound); audio_set_sound_on_off(fx); audio_set_volume(audio_volume); audio_music_set_volume(music_volume); #endif display = SDL_SetVideoMode( 320, 240, 0, SDL_SWSURFACE|(fullscreen?SDL_FULLSCREEN:0)); if ( display == NULL ) { fprintf(stderr, "SDL_SetVideoMode error: %s\n", SDL_GetError()); exit(1); } atexit(SDL_Quit); SDL_ShowCursor(SDL_DISABLE); smallFont = SoFont_new(); SoFont_load (smallFont, IIM_Load_DisplayFormatAlpha ("font4b.png")); menuFont = SoFont_new(); SoFont_load (menuFont, IIM_Load_DisplayFormatAlpha ("font3b.png")); darkFont = SoFont_new(); SoFont_load (darkFont, IIM_Load_DisplayFormatAlpha ("fontdark.png")); IIM_Surface * menuselector = IIM_Load_DisplayFormatAlpha("menusel.png"); mainMenu = menu_new(main_menu_load(menuFont),menuselector); gameOver1PMenu = menu_new(gameover_1p_menu_load(menuFont, smallFont),menuselector); gameOver2PMenu = menu_new(gameover_2p_menu_load(menuFont, smallFont),menuselector); nextLevelMenu = menu_new(nextlevel_1p_menu_load(menuFont, smallFont),menuselector); looserMenu = menu_new(looser_1p_menu_load(menuFont, smallFont),menuselector); finishedMenu = menu_new(finished_1p_menu_load(menuFont, smallFont),menuselector); gameOverMenu = gameOver2PMenu; optionMenu = menu_new(options_menu_load(menuFont, smallFont),menuselector); controlsMenu = menu_new(controls_menu_load(menuFont, smallFont),menuselector); rulesMenu = menu_new(rules_menu_load(menuFont),menuselector); highScoresMenu = menu_new(high_scores_menu_load(menuFont),menuselector); aboutMenu = menu_new(about_menu_load(menuFont),menuselector); singleGameMenu = menu_new(single_game_menu_load(menuFont,smallFont),menuselector); twoPlayerGameMenu = menu_new(two_player_game_menu_load(menuFont,smallFont),menuselector); mustRestartMenu = menu_new(must_restart_menu_load(menuFont),menuselector); if (menu_pause == NULL) menu_pause = menu_new(pause_menu_load(menuFont),menuselector); menu_set_sounds (optionMenu, sound_pop, sound_slide); menu_set_sounds (controlsMenu, sound_pop, sound_slide); menu_set_sounds (mainMenu, sound_pop, sound_slide); menu_set_sounds (rulesMenu, sound_pop, sound_slide); menu_set_sounds (highScoresMenu, sound_pop, sound_slide); menu_set_sounds (aboutMenu, sound_pop, sound_slide); menu_set_sounds (singleGameMenu, sound_pop, sound_slide); menu_set_sounds (twoPlayerGameMenu, sound_pop, sound_slide); menu_set_sounds (menu_pause , sound_pop, sound_slide); melt = doom_melt_new(); scrollingText = scrolling_text_new( "Welcome to the wonderful world of FloboPuyo !!! Enjoy its nice graphics, " "happy music and entertaining gameplay... " "Will you be able to defeat all of the mighty players ? " "Will you beat the Puyo Gods ??? Have a try ! " "We wish you good luck. " " Hello from PuyoLand !", smallFont); theCommander = this; }
EMenuScreen ControllersConfigMenu::run(MainWindow& window, EMenuScreen previous) { initControllers(); return IMenuScreen::run(window, previous); }
void PGE_QuestionBox::setParentScene(Scene *_parentScene) { PGE_BoxBase::setParentScene(_parentScene); initControllers(); }
/* * This is the main routine of the app. */ static void mainproc(void *arg) { #ifdef DEBUG int i; char *ap; u32 *argp; /* * get arguments (options) */ argp = (u32 *) RAMROM_APP_WRITE_ADDR; for (i = 0; i < sizeof(argbuf) / 4; i++, argp++) { osEPiReadIo(handler, (u32) argp, &argbuf[i]); /* Assume no DMA */ } ((char *) argbuf)[sizeof(argbuf)-1] = '\0'; /* * Parse the options */ ap = (char *) argbuf; position_str = (char *) 0; while (*ap != '\0') { while (*ap == ' ') ap++; if (*ap == '-' && *(ap + 1) == 'r') { rdp_flag = 1; ap += 2; } else if (*ap == '-' && *(ap + 1) == 'i') { ap += 2; position_str = ap; break; /* -i must be last argument */ } else ap++; } #endif /* * Setup the message queues */ osCreateMesgQueue(&dmaMessageQ, &dmaMessageBuf, 1); osCreateMesgQueue(&rdpMessageQ, &rdpMessageBuf, 1); osSetEventMesg(OS_EVENT_DP, &rdpMessageQ, NULL); osCreateMesgQueue(&retraceMessageQ, &retraceMessageBuf, 1); osViSetEvent(&retraceMessageQ, NULL, 1); /* * Stick the static segment right after the code/data segment */ staticSegment = _zbufferSegmentEnd; dmaIOMessageBuf.hdr.pri = OS_MESG_PRI_NORMAL; dmaIOMessageBuf.hdr.retQueue = &dmaMessageQ; dmaIOMessageBuf.dramAddr = staticSegment; dmaIOMessageBuf.devAddr = (u32)_staticSegmentRomStart; dmaIOMessageBuf.size = (u32)_staticSegmentRomEnd-(u32)_staticSegmentRomStart; osEPiStartDma(handler, &dmaIOMessageBuf, OS_READ); /* * Wait for DMA to finish */ (void) osRecvMesg(&dmaMessageQ, NULL, OS_MESG_BLOCK); /* * Stick the texture segment right after the static segment */ textureSegment = staticSegment + (u32) _staticSegmentRomEnd - (u32) _staticSegmentRomStart; dmaIOMessageBuf.hdr.pri = OS_MESG_PRI_NORMAL; dmaIOMessageBuf.hdr.retQueue = &dmaMessageQ; dmaIOMessageBuf.dramAddr = textureSegment; dmaIOMessageBuf.devAddr = (u32)_textureSegmentRomStart; dmaIOMessageBuf.size = (u32)_textureSegmentRomEnd-(u32)_textureSegmentRomStart; osEPiStartDma(handler, &dmaIOMessageBuf, OS_READ); /* * Wait for DMA to finish */ (void) osRecvMesg(&dmaMessageQ, NULL, OS_MESG_BLOCK); initControllers(MAXCONTROLLERS); game(); }
FileManagerDaemon::FileManagerDaemon(QObject *parent) : QObject(parent) { initControllers(); initConnect(); }