/*
 * BOUCLE D'AFFICHAGE
 */
bool SceneManager::execute(SDL_Window* window, unsigned int w, unsigned int h)
{
  init3D(w,h);
  init2D();
  initSounds();
  unsigned int debut ,fin;							  	/* VARIABLES DE GESTION DU TEMPS */
  float period = 1.0 / FPS_LIMIT,fps,time;
  while(!m_input.terminer())								/* BOUCLE D'EXECUTION */
  {
    debut = SDL_GetTicks();								/* ON RELEVE LE TEMPS DE DEBUT DE BOUCLE */
    onPreRender();									/* ON MET À JOUR LES MODELES DYNAMIQUES */
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);					/* NETTOYAGE DE LA FENETRE */
    m_input.update();									/* MISE A JOUR DES EVENEMENTS */
    updateCameras();									/* MISE À JOUR DES CAMERAS */
    if(m_input.getKey(SDL_SCANCODE_ESCAPE))  break;					/* QUITTER EN APPUYANT SUR ESPACE */
    if(m_input.getKeyRelease(SDL_SCANCODE_V)) changeCamera();					/* CHANGER DE CAMERA EN APPUYANT SUR ESPACE */
    if(m_input.getKeyRelease(SDL_SCANCODE_SPACE)) m_soundMgr.playEffect("laser",127/2);
    drawAll();										/* AFFICHAGE DE TOUS LES MODELES DU MONDE 3D */
    SDL_GL_SwapWindow(window);								/* RAFRAICHISSEMENT DE LA FENETRE */    
    fin = SDL_GetTicks();								/* ON RELEVE LE TEMPS DE FIN DE BOUCLE */
    time = (float)(fin - debut);							/* ON CALCULE LE TEMPS D'EXECUTION DE LA BOUCLE */
    fps = 1000.0/time;									/* ON CALCULE LA FREQUENCE MAXIMALE */
    std::ostringstream streamTitle;
    streamTitle << "fps: " << fps;							
    SDL_SetWindowTitle(window,streamTitle.str().c_str());				/* ON AFFICHE LA FREQUENCE COMME TITRE DE LA FENETRE */
    if(time < period)
      SDL_Delay((unsigned int)(period - time));  					/* ON LIMITE LA FREQUENCE A 60 FPS */
  }
  printf("toto\n");
  return true;
}
示例#2
0
EnemyView::EnemyView(Int2 pos, TypeEnemy t, bool AI)
:Enemy(pos,t,AI)
{
	/* REBEL */
	if(type == REBEL)
	{
		loadRessources(REBEL);
		initSounds();
		setTexture(textures[REBEL]);
		addAnimations(animations_list[REBEL]);
		changeAnimation(REBEL_WATCH);
		updateIntRect();
	}

	/* BOWSER */
	else if(type == BOWSER)
	{
		loadRessources(BOWSER);
		initSounds();
		setTexture(textures[BOWSER]);
		addAnimations(animations_list[BOWSER]);
		changeAnimation(BOWSER_STAND);
		updateIntRect();
	} 

	/* FLYING */
	else if(type == FLYING)
	{
		loadRessources(FLYING);
		initSounds();
		setTexture(textures[FLYING]);
		addAnimations(animations_list[FLYING]);
		changeAnimation(FLYING_FLY);
		updateIntRect();
	}

	body.setSize(Vector2f(size.x,size.y));
}
//Usings
USING_NS_GAMEKABOOM


////////////////////////////////////////////////////////////////////////////////
// CTOR / DTOR                                                                //
////////////////////////////////////////////////////////////////////////////////
SplashScene::SplashScene()
{
    Lore::WindowManager::instance()->setClearColor(Lore::Color::White());

    initSprites();
    initTimers ();
    initSounds ();
}
示例#4
0
    void Configuration::initialize()
    {
        initTextures();
        initFonts();
        initSounds();
        initMusics();

        initPlayerInputs();
        initGuiInputs();

        rand_init();

        musics.get(Musics::Theme).setLoop(true);
        musics.get(Musics::Theme).play();

    }