Пример #1
0
 // Metodo que devuelve una textura de un Arraylist cada X tiempo (intervalTime).
 private Texture SwapTextureFromArray(
     ArrayList<Texture> list, int startIndex, long startTime, float intervalTime) {
   Texture img = null;
   if (startIndex < list.size()) {
     Music sound = soundsList.get(startIndex);
     if (TimeUtils.timeSinceMillis(startTime) < intervalTime * 1000) {
       img = list.get(startIndex);
       if (startIndex < titlesList.size()) {
         imageTitle.ChangeFontText(titlesList.get(startIndex));
       }
       if (!soundPlayed) {
         System.out.println("Playing music");
         sound.play();
         soundPlayed = true;
       }
     } else {
       if (!sound.isPlaying()) {
         actualImgIndex++;
         beginTime = TimeUtils.millis();
         img = list.get(startIndex);
         imageTitle.ChangeFontText(titlesList.get(startIndex));
         System.out.println("Music finished");
         soundPlayed = false;
       }
     }
   } else {
     img = list.get(texturesList.size() - 1);
   }
   return img;
 }
Пример #2
0
 // Metodo que acomoda el texto al centro y arriba de la pantalla
 private void SetFontTextCenter(TitleActor fontActor, String text) {
   imageTitle.ChangeFontText(titlesList.get(0));
   GlyphLayout layout = new GlyphLayout();
   layout.setText(fontActor.GetFont(), text);
   float textX = (Gdx.graphics.getWidth() / 2) - (layout.width / 2);
   float textY = layout.height + (Gdx.graphics.getHeight() - 50f);
   fontActor.setPosition(textX, textY);
 }