bool Ball::checkCollision(float xres, float yres) { float ballspeed = 10.0f; float ballXVel = ballspeed * cos(0) + 10; float ballYVel = ballspeed * -sin(35); bool hitTopOfScreen = yPos >= yres && yVel > 0; bool hitBottomOfScreen = yPos <= 0 && yVel < 0; bool hitRightSide = xPos >= xres && xVel > 0; bool hitLeftSide = xPos <= 0 && xVel < 0; //check collision with screen edges if(hitTopOfScreen){ createSound(2); yVel = -ballYVel; } else if(hitBottomOfScreen){ createSound(2); yVel = ballYVel; } else if(hitRightSide){ this->xVel = -ballXVel; player1Score++; createSound(3); return true; } else if(hitLeftSide){ xVel = ballXVel; player2Score++; createSound(4); return true; } return false; }
void EnPlayerSound::setupSounds() { // check if the player has already set its association assert( _p_playerImpl && "player implementation has to set its association in initialize phase!" ); unsigned int soundID = 0; soundID = createSound( _walkGround ); if ( soundID > 0 ) _mapSounds.insert( std::make_pair( SND_GROUND, soundID ) ); soundID = createSound( _walkWood ); if ( soundID > 0 ) _mapSounds.insert( std::make_pair( SND_WOOD, soundID ) ); soundID = createSound( _walkStone ); if ( soundID > 0 ) _mapSounds.insert( std::make_pair( SND_STONE, soundID ) ); soundID = createSound( _walkMetal ); if ( soundID > 0 ) _mapSounds.insert( std::make_pair( SND_METAL, soundID ) ); soundID = createSound( _walkGrass ); if ( soundID > 0 ) _mapSounds.insert( std::make_pair( SND_GRASS, soundID ) ); }
void CControlWidget::slot_reply_Finished() { if (m_reply->error() == QNetworkReply::NoError) { createSound(m_reply); ui->progressBar->setValue(100); } else if (m_reply->error() == QNetworkReply::ContentNotFoundError) { m_lastTraceItem->setDataFound(false); ui->progressBar->setValue(0); QMessageBox::warning(this, tr("Not found"), tr("The trace are not avaible on the server-side")); } else if (m_reply->error() != QNetworkReply::OperationCanceledError) { ui->progressBar->setValue(0); QMessageBox::warning(this, tr("Something happend..."), m_reply->errorString()); } else { ui->progressBar->setValue(0); } m_reply->deleteLater(); m_reply = 0; slot_update_OpenOrCancel_button(); }
void AudioWorld::createSounds() { std::string datPath = "/_work/data/Scripts/_compiled/SFX.DAT"; std::string datFile = Utils::getCaseSensitivePath(datPath, m_Engine.getEngineArgs().gameBaseDirectory); if (!Utils::fileExists(datFile)) { LogError() << "Failed to find SFX.DAT at: " << datFile; return; } m_SoundVM = new Daedalus::DaedalusVM(datFile); Daedalus::registerGothicEngineClasses(*m_SoundVM); size_t count = 0; m_SoundVM->getDATFile().iterateSymbolsOfClass("C_SFX", [&](size_t i, Daedalus::PARSymbol& s) { Daedalus::GameState::SfxHandle h = m_SoundVM->getGameState().createSfx(); Daedalus::GEngineClasses::C_SFX& sfx = m_SoundVM->getGameState().getSfx(h); m_SoundVM->initializeInstance(ZMemory::toBigHandle(h), i, Daedalus::IC_Sfx); createSound(s.name, sfx); count++; }); LogInfo() << "created " << count << " sounds"; }
// Implementation of player utils GuiUtils::GuiUtils() : _p_mainWindow( NULL ), _p_rootWindow( NULL ), _p_vrcImageSet( NULL ) { // take care, this is a phoenix singleton! if ( yaf3d::GameState::get()->getState() != yaf3d::GameState::Shutdown ) { // register this instance for getting game state changes, needed for shutdown yaf3d::GameState::get()->registerCallbackStateChange( this ); // setup standard gui sounds createSound( GUI_SND_NAME_CLICK, GUI_SND_FILE_CLICK, GUI_SND_VOL_CLICK ); createSound( GUI_SND_NAME_HOVER, GUI_SND_FILE_HOVER, GUI_SND_VOL_HOVER ); createSound( GUI_SND_NAME_SCROLLBAR, GUI_SND_FILE_SCROLLBAR, GUI_SND_VOL_SCROLLBAR ); createSound( GUI_SND_NAME_ATTENTION, GUI_SND_FILE_ATTENTION, GUI_SND_VOL_ATTENTION ); } }
void GameAudioImpl::playBGS(const StringRef& filePath, float volume, float pitch, double fadeTime) { auto sound = createSound(filePath); playBGSFromSound(sound, volume, pitch, fadeTime); // ファイル名記憶 mBGSName = filePath; }
SoundHandle AudioDevice::playSound(const std::string &name) { SoundHandle handle = createSound(name); if(handle) handle->play(); else JL_WARNING_LOG("Attempted to play non-existant sound!"); return handle; }
int FSM::Node::GetSound( unsigned char sex, unsigned int multiple ) { unsigned int index = multiple+( (unsigned int) sex )*messages.size(); if ( index < sounds.size() ) { if (sounds[index] < 0) { sounds[index] = createSound(soundfiles[index], false); return sounds[index]; } else { return sounds[index]; } } else { return -1; } }
void GameAudioImpl::playSE(const StringRef& filePath, float volume, float pitch) { auto sound = createSound(filePath); // ボリューム・ピッチ設定 sound->setVolume(volume); sound->setPitch(pitch); // 再生途中で解放されようとしても再生終了までは解放されない & SE として再生する sound->setGameAudioFlags(GameAudioFlags_SE); pushReleaseAtPlayEndList(sound); // 再生 sound->setLoopEnabled(false); sound->play(); }
int getTimer(){ int time = startTime - timer.getTicks(); string str; stringstream ss; stringstream ss2; ss << time; timeStr = ss.str(); int ret = atoi(timeStr.c_str()) / 10000; if (ret < 0){ createSound(5); ret = 0; is_gameover = true; ball.setXVel(0.0f); ball.setYVel(0.0f); stopGame(); //createSound(5); } return ret; }
void GameAudioImpl::playSE3D(const StringRef& filePath, const Vector3& position, float distance, float volume, float pitch) { // サウンド作成 auto sound = createSound(filePath); sound->set3DEnabled(true); // 位置・ピッチ設定 sound->setEmitterPosition(position); sound->setEmitterMaxDistance(distance); sound->setVolume(volume); sound->setPitch(pitch); // 再生途中で解放されようとしても再生終了までは解放されない & SE として再生する sound->setGameAudioFlags(GameAudioFlags_SE); pushReleaseAtPlayEndList(sound); // 再生 sound->setLoopEnabled(false); sound->play(); }
void GameController::receiveResources(Network::TcpPacket* packet) { uint32 nb; *packet >> nb; for (uint32 i = 0; i < nb; ++i) { Resource* resource = createResource(*packet); if (resource) _resources.push_back(resource); } *packet >> nb; for (uint32 i = 0; i < nb; ++i) { Graphic::Texture* texture = createTexture(*packet); if (texture) _textures.push_back(texture); } *packet >> nb; for (uint32 i = 0; i < nb; ++i) { Graphic::Sprite* sprite = createSprite(*packet); if (sprite) _sprites.push_back(sprite); } *packet >> nb; for (uint32 i = 0; i < nb; ++i) { Graphic::Element* element = createGraphicElement(*packet); if (element) _elements.push_back(element); } *packet >> nb; for (uint32 i = 0; i < nb; ++i) { Graphic::Scenery* scenery = createScenery(*packet); if (scenery) { _sceneries.push_back(scenery); } } *packet >> nb; for (uint32 i = 0; i < nb; ++i) { Sound::Sound* sound = createSound(*packet); if (sound) _sounds.push_back(sound); } }
void GameAudioImpl::playME(const StringRef& filePath, float volume, float pitch) { auto sound = createSound(filePath); playMEFromSound(sound, volume, pitch); }
void Engine::Sound::load() { //Temporary storage to load to storage vector Storage temp_Storage; //Temporary variables to hold data std::string temp_handle; std::string temp_file_name; //Temporary struct to hold data struct temp_Data { std::string temp_handle; std::string temp_file_name; }; //Temporary vector to transfer data std::vector<temp_Data> tempStorageData; std::ifstream file("SoundEffects.txt"); while(!file.eof()) { //store file name and handle to temp variables file >> temp_file_name >> temp_handle; //create a temporary struct to hold data temp_Data some_data; some_data.temp_handle = temp_handle; some_data.temp_file_name = temp_file_name; //push back the data tempStorageData.push_back(some_data); } //end of file, close file file.close(); //iterate through temp data storage to create sound effects for(unsigned int i = 0; i < tempStorageData.size(); i++) { //Transfer temp_data to storage temp_Storage.handle = tempStorageData[i].temp_handle; temp_Storage.playing = false; //Create Sound Effect createSound(temp_Storage, tempStorageData[i].temp_file_name); //Push temp_storage into sound effect storage container sound_effects.push_back(temp_Storage); //Clear memory for next file temp_Storage.sound = nullptr; } //Repeat for Streams std::ifstream file2("BGM.txt"); while(!file2.eof()) { //store file name and handle to temp variables file2 >> temp_file_name >> temp_handle; //create a temporary struct to hold data temp_Data some_data; some_data.temp_handle = temp_handle; some_data.temp_file_name = temp_file_name; //push back the data tempStorageData.push_back(some_data); } //end of file, close file file2.close(); //iterate through temp data storage to create songs for(unsigned int i = 0; i < tempStorageData.size(); i++) { //Transfer temp_data to storage temp_Storage.handle = tempStorageData[i].temp_handle; temp_Storage.playing = false; //Create Sound Effect createSound(temp_Storage, tempStorageData[i].temp_file_name); //Push temp_storage into song storage container songs.push_back(temp_Storage); //Clear memory for next file temp_Storage.sound = nullptr; } }
void Level::createSound(Configuration::Sounds sound_id,const sf::Vector2i& coord) { sf::Vector2f pos = _map->mapCoordsToPixel(coord); createSound(sound_id,pos); }
int main( int argc, char **argv ) { osg::notify(osg::WARN) << "\n\n" << osgAudio::getLibraryName() << " demo" << std::endl; osg::notify(osg::WARN) << "Version: " << osgAudio::getVersion() << "\n\n" << std::endl; osg::notify(osg::WARN) << "Demonstrates occluders" << std::endl; try { // use an ArgumentParser object to manage the program arguments. osg::ArgumentParser arguments(&argc,argv); // set up the usage document, in case we need to print out how to use this program. arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" demonstrates the use of the osgAudio toolkit for spatial sound."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); // initialize the viewer. osgViewer::Viewer viewer(arguments); osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() ); viewer.setCameraManipulator( keyswitchManipulator.get() ); // add the window size toggle handler viewer.addEventHandler(new osgViewer::WindowSizeHandler); // add the stats handler viewer.addEventHandler(new osgViewer::StatsHandler); // add the help handler viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage())); // get details on keyboard and mouse bindings used by the viewer. viewer.getUsage(*arguments.getApplicationUsage()); // if user request help write it out to cout. if (arguments.read("-h") || arguments.read("--help")) { arguments.getApplicationUsage()->write(std::cout); return 1; } // any option left unread are converted into errors to write out later. arguments.reportRemainingOptionsAsUnrecognized(); arguments.getApplicationUsage()->addKeyboardMouseBinding("RETURN", "Play a sound"); // report any errors if they have occured when parsing the program aguments. if (arguments.errors()) { arguments.writeErrorMessages(std::cout); return 1; } // initialize the SoundManager before loading any files osgAudio::SoundManager::instance()->init(16); osgAudio::SoundManager::instance()->getEnvironment()->setDistanceModel(osgAudio::InverseDistance); osgAudio::SoundManager::instance()->getEnvironment()->setDopplerFactor(1); osg::ref_ptr<osg::Group> rootnode = new osg::Group; // load the nodes from the commandline arguments. osg::Node* model = osgDB::readNodeFiles(arguments); //createModel(); if (!model) { osg::notify(osg::FATAL) << "Error loading models from commandline" << std::endl; return 1; } osg::ref_ptr<osg::PositionAttitudeTransform> loaded_transform = new osg::PositionAttitudeTransform; loaded_transform->addChild(model); rootnode->addChild(loaded_transform.get()); // Create ONE (only one, otherwise the transformation of the listener and update for SoundManager will be // called several times, which is not catastrophic, but unnecessary) // SoundRoot that will make sure the listener is updated and // to keep the internal state of the SoundManager updated // This could also be done manually, this is just a handy way of doing it. osg::ref_ptr<osgAudio::SoundRoot> sound_root = new osgAudio::SoundRoot; sound_root->setCamera( viewer.getCamera() ); // The position in the scenegraph of this node is not important. // Just as long as the cull traversal should be called after any changes to the SoundManager are made. rootnode->addChild(sound_root.get()); bool occlude = true; osg::ref_ptr<osg::PositionAttitudeTransform> sound_transform = createSound("a.wav", occlude, rootnode.get(), false); rootnode->addChild(sound_transform.get()); // run optimization over the scene graph //osgUtil::Optimizer optimizer; //optimizer.optimize(rootnode.get()); // set the scene to render viewer.setSceneData(rootnode.get()); // create the windows and run the threads. viewer.realize(); osg::Timer_t start = osg::Timer::instance()->tick(); float rate=10; // degrees per second while( !viewer.done() ) { osg::Timer_t now = osg::Timer::instance()->tick(); double dt = osg::Timer::instance()->delta_s(start, now); double angle = rate*dt; osg::Quat quat; quat.makeRotate(osg::inDegrees(angle), osg::Vec3(0,0,1)); loaded_transform->setAttitude(quat); // update the scene by traversing it with the the update visitor which will // call all node update callbacks and animations. // fire off the cull and draw traversals of the scene. viewer.frame(); } } catch (std::exception& e) { osg::notify(osg::WARN) << "Caught: " << e.what() << std::endl; } // Very important to call this before end of main. // Otherwise OpenAL will do all sorts of strange things after end of main // in the destructor of soundmanager. if (osg::Referenced::getDeleteHandler()) { osg::Referenced::getDeleteHandler()->setNumFramesToRetainObjects(0); osg::Referenced::getDeleteHandler()->flushAll(); } osgAudio::SoundManager::instance()->shutdown(); return 0; }
void physics(Game *g) { g->mouseThrustOn=false; //ball collision if(gameStarted){ ball.setYVel(ball.getYVel()); ball.setXVel(ball.getXVel()); obstacle->setYVel(obstacle->getYVel()); bool is_ball_hit_edge = ball.checkCollision(xres, yres); if (is_ball_hit_edge){ lastPaddleHit = 'N'; } } //paddle collision bool isLeftHit = paddle1.checkCollision(yres, ball); if (isLeftHit){ lastPaddleHit = 'L'; } bool isRightHit = paddle2.checkCollision(yres, ball); if (isRightHit){ lastPaddleHit = 'R'; } if(level == 2){ obstacle->checkCollision(xres, yres, ball, p1); } //paddle1 movement paddle1.setYVel(paddle1YVel); //paddle2 movement paddle2.setYVel(paddle2YVel); if (level == 1 && hud->isPaused()==false){ //SET BOMBS POSITION: bomb_theta = bomb_theta + speed_theta; if (fabs(bomb_theta) >= 2*PI){ bomb_theta=0; speed_theta *= -1; } bomb_posx=(int)(xres/2 + bomb_radius*cos(bomb_theta - PI/2) - bomb_width/2); bomb_posy=(int)(yres/2 + bomb_radius*sin(bomb_theta - PI/2) - bomb_height/2); //CHECK LEFT COLLISION WITH BOMB: if ((beginSmallLeftPaddle + smallLeftPaddleTime) < time(NULL)){ paddle1.setHeight(100.0f); bool isBallBetweenX = (ball.getXPos() > bomb_posx) && (ball.getXPos() < (bomb_posx + bomb_width)); bool isBallBetweenY = (ball.getYPos() > bomb_posy) && (ball.getYPos() < (bomb_posy + bomb_height)); if (lastPaddleHit == 'L' && (isBallBetweenX && isBallBetweenY)){ bombBegin = time(NULL); createSound(8); createSound(9); //set to half normal height: paddle1.setHeight(60.0f); if (hud->getPlayer1Health()>0){ hud->setPlayer1Health(hud->getPlayer1Health()-10*(1+random(8))); //GAMEOVER: if (hud->getPlayer1Health() <= 0){ createSound(5); is_gameover = true; ball.setXVel(0.0f); ball.setYVel(0.0f); stopGame(); } } beginSmallLeftPaddle = time(NULL); } } //CHECK RIGHT COLLISION WITH BOMB: if ((beginSmallRightPaddle + smallRightPaddleTime) < time(NULL)){ paddle2.setHeight(100.0f); //is_bomb_visible = true; bool isBallBetweenX = (ball.getXPos() > bomb_posx) && (ball.getXPos() < (bomb_posx + bomb_width)); bool isBallBetweenY = (ball.getYPos() > bomb_posy) && (ball.getYPos() < (bomb_posy + bomb_height)); if (lastPaddleHit == 'R' && (isBallBetweenX && isBallBetweenY)){ bombBegin = time(NULL); createSound(8); createSound(9); //is_bomb_visible = false; //set to half normal height: paddle2.setHeight(60.0f); if (hud->getPlayer2Health()>0){ hud->setPlayer2Health(hud->getPlayer2Health()- 10*(1+random(8))); //GAMEOVER: if (hud->getPlayer2Health() <= 0){ createSound(5); is_gameover = true; ball.setXVel(0.0f); ball.setYVel(0.0f); stopGame(); } } beginSmallRightPaddle = time(NULL); } } if(ball.getXPos() >= (xres/2)){ portal1.checkCollision(ball, portal0); } else { portal0.checkCollision(ball, portal1); } }//end if level 1 and not paused }
bool Paddle::checkCollision(int yres, Ball &ball) { float ballspeed = 15.0f; float ballXVel = ballspeed * cos(0)+10; float ballYVel = ballspeed * -sin(35); //ball collision with paddles bool onLeftSide = ball.getXPos() < 150 && xPos < 150; bool onRightSide = ball.getXPos() > 150 && xPos > 150; bool hitLeftPaddle = (ball.getXPos()-ball.getRadius() <= xPos) && ball.getYPos() >= yPos && ball.getYPos() <= yPos + height; bool hitRightPaddle = (ball.getXPos() >= xPos) && ball.getYPos() >= yPos && ball.getYPos() <= yPos + height; //check if paddle is moving up or down bool paddleMovingUp = yVel > 0; bool paddleMovingDown = yVel < 0; checkAI(yres, ball); checkScreenCollision(yres); float angle = PI/2; //collision with ball //left paddle if(onLeftSide && hitLeftPaddle){ ball.setXVel(ballXVel); createSound(1); if(paddleMovingUp){ ballYVel = ballspeed * -sin(-angle); ball.setYVel(ballYVel); ball.setXVel(ballXVel); } else if(paddleMovingDown){ ballYVel = ballspeed * -sin(-angle); ball.setYVel(-ballYVel); ball.setXVel(ballXVel); } return true; } //right paddle else if(onRightSide && hitRightPaddle){ ball.setXVel(-ballXVel); createSound(1); if(paddleMovingUp){ ballYVel = ballspeed * -sin(angle); ball.setYVel(ballYVel); ball.setXVel(-ballXVel); } else if(paddleMovingDown){ ballYVel = ballspeed * -sin(-angle); ball.setYVel(-ballYVel); ball.setXVel(-ballXVel); } return true; } return false; }
TilePiece* Pony48Engine::loadTile(string sFilename) { TilePiece* ret = new TilePiece(); XMLDocument* doc = new XMLDocument(); int iErr = doc->LoadFile(sFilename.c_str()); if(iErr != XML_NO_ERROR) { errlog << "Error parsing XML file " << sFilename << ": Error " << iErr << endl; delete doc; return NULL; } XMLElement* root = doc->FirstChildElement("tile"); if(root == NULL) { errlog << "Error: No toplevel \"tile\" item in XML file " << sFilename << endl; delete doc; return NULL; } root->QueryIntAttribute("value", &ret->value); vector<Image*> vImages; for(XMLElement* img = root->FirstChildElement("img"); img != NULL; img = img->NextSiblingElement("img")) { const char* cPath = img->Attribute("path"); if(cPath != NULL) vImages.push_back(getImage(cPath)); } for(XMLElement* sound = root->FirstChildElement("sound"); sound != NULL; sound = sound->NextSiblingElement("sound")) { bool bPlaySoundImmediately = true; const char* cType = sound->Attribute("type"); if(cType) { string sType = cType; if(sType == "newhigh") //I have no idea how this happens, but apparently the highest tile can be this before it even returns. Wat bPlaySoundImmediately = ((m_highestTile == NULL) || (m_highestTile->value < ret->value)); } //Save all sfx if there's multiple vector<string> vSounds; for(XMLElement* fx = sound->FirstChildElement("fx"); fx != NULL; fx = fx->NextSiblingElement("fx")) { const char* cPath = fx->Attribute("path"); const char* cName = fx->Attribute("name"); if(cPath && cName) { createSound(cPath, cName); vSounds.push_back(cName); } } //Play one of these randomly if(vSounds.size() && bPlaySoundImmediately) playSound(vSounds[randInt(0, vSounds.size() - 1)], m_fVoxVolume); } physSegment* tmpseg = new physSegment(); int which = randInt(0, vImages.size()-1); tmpseg->img = vImages[which]; tmpseg->size = Point(TILE_WIDTH,TILE_HEIGHT); ret->seg = tmpseg; tmpseg = new physSegment(); tmpseg->img = getImage("res/tiles/tilebg.png"); tmpseg->size = Point(TILE_WIDTH,TILE_HEIGHT); const char* cBgColor = root->Attribute("bgcolor"); if(cBgColor != NULL) tmpseg->col = colorFromString(cBgColor); ret->bg = tmpseg; ret->origCol = tmpseg->col; delete doc; return ret; }
/** *\fn int main(int argc, char *argv[]) * Main *\param[in,out] argc argc *\param[in,out] argv argv */ int main(int argc, char *argv[]) { SDL_Surface *screen = NULL; int go = 1; int ret,ret1, ret2 = 0, ret3, ret4; char level_name[MAX_SIZE_FILE_NAME]; char player_name[MAX_SIZE_FILE_NAME]; int nb_lvl; /*sound*/ Sound *sound_system; sound_system = createSound(); /*keyboard config*/ SDLKey kc[NB_KEY-1]; /*input*/ Input in; SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_JOYSTICK); Player *current_player; current_player = (Player *)malloc(sizeof(Player)); /*screen initialization*/ screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32, SDL_HWSURFACE | SDL_DOUBLEBUF); initInput(&in); /*configurations loading */ loadSoundOptions("configuration/sound.conf",sound_system); SDL_WM_SetCaption("Super Martin", NULL); //window name SDL_ShowCursor(SDL_DISABLE); //delete the mouse while (go) //main loop { if(titleMenu(screen,&go,sound_system, &in)) { while( (ret3 = menuPlayers(screen, player_name, &go, sound_system, &in)) != -1 && go) { switch(ret3) { case -1: break; case 2 : ret2 = newPlayer(screen, player_name, sound_system, &go); if(ret2 == 1) { current_player->levelMax = 1; current_player->nbCoins = 0; current_player->nbLifes = 3; current_player->nbProjectile = 5; savePlayer("save/.save", player_name, current_player); loadInputOptions("default",kc,&in); saveInputOptions(player_name, kc, &in); } else break; case 1 : loadPlayer("save/.save", player_name, current_player); loadInputOptions(player_name,kc,&in); while(go && (ret1 = mainMenu(screen,&go,sound_system, player_name, &in)) != -1) { switch(ret1) { case -1: break; case 0: while( (ret4 = menuLevel(screen,level_name,sound_system, player_name, current_player, &go, &nb_lvl, &in)) != -1 && go) { while(play(screen,level_name,sound_system,&go,kc, &in, current_player, player_name, ret4+1, nb_lvl) && go); } break; case 1 : save(screen, "save/.save", player_name, current_player, &go); loadPlayer("save/.save", player_name, current_player); break; case 2 : while((ret = optionMenu(screen,&go,sound_system,kc, &in)) != -1 && go) { switch(ret) { case -1: break; case 0: soundOptions(screen,&go,sound_system, &in); break; case 1: keyBoardOptions(screen,&go,kc,&in,player_name); break; default:; } } break; case 3 : deletePlayer(screen, "save/players", player_name); go = 0; break; default: ; } } go = 1; break; default : ; } } } SDL_FillRect(screen,NULL,SDL_MapRGB(screen->format,255,255,255)); //clear screen SDL_Flip(screen); } freeSound(sound_system); free((void*)current_player); freeInput(&in); SDL_Quit(); return EXIT_SUCCESS; }