Permalink
Browse files

test audio

  • Loading branch information...
1 parent c48d9aa commit 710087a2d7f229d906f794bf9cbb2eb8fcb64803 @Luraguse Luraguse committed May 22, 2013
View
BIN lumpundform-html/war/WEB-INF/lib/gwt-servlet.jar
Binary file not shown.
View
1 lumpundform/src/com/lumpundform/escenario/EscenarioBase.java
@@ -25,6 +25,7 @@
import com.lumpundform.actores.Personaje;
import com.lumpundform.audio.ManejadorDeMusica;
import com.lumpundform.audio.ManejadorDeSonido;
+import com.lumpundform.audio.MusicaDisponible;
import com.lumpundform.colision.Linea;
import com.lumpundform.colision.Poligono;
import com.lumpundform.eventos.Escena;
View
12 lumpundform/src/com/lumpundform/escenario/EscenarioHelper.java
@@ -1,5 +1,8 @@
package com.lumpundform.escenario;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.scenes.scene2d.Actor;
@@ -11,6 +14,7 @@
import com.lumpundform.interfaz.InterfazHelper;
import com.lumpundform.lumpundform.CamaraJuego;
import com.lumpundform.utilerias.D;
+import com.lumpundform.utilerias.U;
/**
* Clase que ayuda con las funciones de los escenarios, como cargar el mapa, los
@@ -25,6 +29,8 @@
private InterfazHelper interfazHelper;
private EscenarioBase escenario;
private boolean dibujarColision;
+ private long timeStamp;
+ private long soundStamp;
/**
* Inicializa el escenario, el mapa, las colisiones y el {@link Heroe} para
@@ -203,5 +209,11 @@ public void siguienteCancion() {
public void sonidoAtacar() {
escenario.ms.play(SonidosDisponibles.ATAQUE);
+ soundStamp = System.currentTimeMillis();
+ U.l("dif", soundStamp - timeStamp);
+ }
+
+ public void setTimeStamp(long timeStamp) {
+ this.timeStamp = timeStamp;
}
}
View
5 lumpundform/src/com/lumpundform/input/ProcesadorEntradaJuego.java
@@ -1,5 +1,8 @@
package com.lumpundform.input;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.input.GestureDetector.GestureListener;
@@ -78,6 +81,8 @@ public boolean keyDown(int keycode) {
Heroe heroe = escenario.getHeroe();
/* Disparar */
if (keycode == Keys.SPACE) {
+ long timeStamp = System.currentTimeMillis();
+ escenario.setTimeStamp(timeStamp);
heroe.habilidad("disparar");
escenario.sonidoAtacar();
return true;
View
92 lumpundform/src/com/lumpundform/utilerias/LRUCache.java
@@ -1,46 +1,46 @@
-package com.lumpundform.utilerias;
-
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class LRUCache<K, V> {
- public interface CacheEntryRemovedListener<K, V> {
- void notifyEntryRemoved(K key, V value);
- }
-
- private Map<K, V> cache;
- private CacheEntryRemovedListener<K, V> entryRemovedListener;
-
- public LRUCache(final int maxEntries) {
- cache = new LinkedHashMap<K, V>(maxEntries + 1, .75f, true) {
- public boolean removeEldestEntry(Map.Entry<K, V> eldest) {
- if (size() > maxEntries) {
- if (entryRemovedListener != null) {
- entryRemovedListener.notifyEntryRemoved(
- eldest.getKey(), eldest.getValue());
- }
- return true;
- }
- return false;
- }
- };
- }
-
- public void add(K key, V value) {
- cache.put(key, value);
- }
-
- public V get(K key) {
- return cache.get(key);
- }
-
- public Collection<V> retrieaveAll() {
- return cache.values();
- }
-
- public void setEntryRemovedListener(
- CacheEntryRemovedListener<K, V> entryRemovedListener) {
- this.entryRemovedListener = entryRemovedListener;
- }
-}
+package com.lumpundform.utilerias;
+
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+public class LRUCache<K, V> {
+ public interface CacheEntryRemovedListener<K, V> {
+ void notifyEntryRemoved(K key, V value);
+ }
+
+ private Map<K, V> cache;
+ private CacheEntryRemovedListener<K, V> entryRemovedListener;
+
+ public LRUCache(final int maxEntries) {
+ cache = new LinkedHashMap<K, V>(maxEntries + 1, .75f, true) {
+ public boolean removeEldestEntry(Map.Entry<K, V> eldest) {
+ if (size() > maxEntries) {
+ if (entryRemovedListener != null) {
+ entryRemovedListener.notifyEntryRemoved(
+ eldest.getKey(), eldest.getValue());
+ }
+ return true;
+ }
+ return false;
+ }
+ };
+ }
+
+ public void add(K key, V value) {
+ cache.put(key, value);
+ }
+
+ public V get(K key) {
+ return cache.get(key);
+ }
+
+ public Collection<V> retrieaveAll() {
+ return cache.values();
+ }
+
+ public void setEntryRemovedListener(
+ CacheEntryRemovedListener<K, V> entryRemovedListener) {
+ this.entryRemovedListener = entryRemovedListener;
+ }
+}

0 comments on commit 710087a

Please sign in to comment.