bool SoundManager::initialize(std::string fn) { if(file == fn) { std::cerr<<"Error already initialized this file"<<std::endl; return false; } if(initialized) { killALData(); } file = fn; // Initialize OpenAL and clear the error bit. alutInit(NULL, 0); alGetError(); // Load the wav data. if(loadALData() == AL_FALSE) { return false; } setListenerValues(); initialized = true; return true; }
int main(int argc,char **argv) { initRandNum("scripts/mines.lua"); //call for Lua to do the random number generator int *pScreen; pScreen = configScreen(); //pScreen now becomes the array returned by configScreen player one; //creates a player struct configPlayer(one); //fills player struct startX = one.StartPosX; //takes variables from player struct for OpenGL to use startY = one.StartPosY; int number; cout << "\nHow many mines do you want in the game " << endl; cin >> number; mineGenerator(number); //Calls function to randomly generate mines initOpenAL(); alGetError(); if (loadALData() == AL_FALSE) return 0; setListenerValues(); atexit(killALData); alSourcePlay(Sources[LOOP]); glutInit(&argc,argv); glutInitWindowPosition(100,100); glutInitWindowSize(pScreen[0],pScreen[1]); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); init(); win = glutCreateWindow("Mine Sweeper"); createMenu(); glutDisplayFunc(drawScene); glutKeyboardFunc(handleKeypress); glutIdleFunc(handleIdle); glutSpecialFunc(handleSpecialKeys); glOrtho(-1,16,-1,16,0,-1); //gluLookAt (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); glutMainLoop(); }