-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1881 from uqbar-project/dev
Releasing v1.9.2
- Loading branch information
Showing
267 changed files
with
1,720 additions
and
15,836 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
*/bin/ | ||
/eclipse/* | ||
**/target/ | ||
.metadata/* | ||
.DS_Store | ||
/target/ | ||
*/workspace/ | ||
org.eclipse.* | ||
pom.xml.versionsBackup | ||
*._trace | ||
CHANGELOG.txt | ||
changelog.txt | ||
CHANGELOG.md | ||
|
||
# Xtend generated files | ||
/target/ | ||
xtend-gen | ||
*/bin/ | ||
**/target/ | ||
|
||
# Eclipse files | ||
.metadata/* | ||
/eclipse/* | ||
eclipse | ||
.classpath | ||
.project | ||
.recommenders | ||
|
||
# VSC - Git Lens | ||
.history | ||
|
||
# Release scripts | ||
scripts/libs | ||
scripts/jars | ||
scripts/wollok-site | ||
scripts/wollok-cli | ||
scripts/wollok-cli | ||
|
||
# Ignoring wollok-language files | ||
org.uqbar.project.wollok.lib/src/wollok/*.wlk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "wollok-language"] | ||
path = wollok-language | ||
url = https://github.com/uqbar-project/wollok-language.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
org.uqbar.project.wollok.game/src/org/uqbar/project/wollok/game/gameboard/GameSound.xtend
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package org.uqbar.project.wollok.game.gameboard | ||
|
||
import com.badlogic.gdx.Gdx | ||
import com.badlogic.gdx.audio.Sound | ||
import org.eclipse.osgi.util.NLS | ||
import org.eclipse.xtend.lib.annotations.Accessors | ||
import org.uqbar.project.wollok.game.Messages | ||
|
||
@Accessors | ||
class GameSound { | ||
String file | ||
Long soundID | ||
Sound sound | ||
Boolean looped = false | ||
Float volume = 1.0f | ||
Boolean paused = false | ||
|
||
def play() { | ||
if (played) | ||
throw new RuntimeException(Messages.WollokGame_SoundAlreadyPlayed) | ||
if (!looped) | ||
soundID = fetchSound.play(volume) | ||
else | ||
soundID = fetchSound.loop(volume) | ||
} | ||
|
||
def played() { | ||
soundID !== null | ||
} | ||
|
||
def stop() { | ||
if(!played) | ||
throw new RuntimeException(Messages.WollokGame_SoundNotYetPlayed) | ||
fetchSound.stop() | ||
fetchSound.dispose() | ||
} | ||
|
||
def pause() { | ||
if (!played) | ||
throw new RuntimeException(Messages.WollokGame_PausedOrResumedANotPlayedSound) | ||
if (paused) | ||
throw new RuntimeException(Messages.WollokGame_SoundAlreadyPaused) | ||
fetchSound.pause() | ||
paused = true | ||
} | ||
|
||
def resume() { | ||
if (!played) | ||
throw new RuntimeException(Messages.WollokGame_PausedOrResumedANotPlayedSound) | ||
if (!paused) | ||
throw new RuntimeException(Messages.WollokGame_SoundAlreadyPlaying) | ||
fetchSound.resume() | ||
paused = false | ||
} | ||
|
||
def paused() { | ||
paused | ||
} | ||
|
||
def volume(Float newVolume) { | ||
if (newVolume < 0 || newVolume > 1) | ||
throw new RuntimeException(Messages.WollokGame_VolumeOutOfRange) | ||
volume = newVolume | ||
syncVolume() | ||
} | ||
|
||
def volume() { | ||
volume | ||
} | ||
|
||
def syncVolume() { | ||
if (played) { | ||
fetchSound.setVolume(soundID, volume) | ||
} | ||
} | ||
|
||
def shouldLoop(Boolean looping) { | ||
looped = looping | ||
syncLoop() | ||
} | ||
|
||
def shouldLoop() { | ||
looped | ||
} | ||
|
||
def syncLoop() { | ||
if (played) { | ||
fetchSound.setLooping(soundID, looped) | ||
} | ||
} | ||
|
||
def fetchSound() { | ||
if (Gdx.app === null) | ||
throw new RuntimeException(Messages.WollokGame_SoundGameNotStarted) | ||
|
||
if (sound === null) { | ||
try { | ||
val soundFile = Gdx.files.internal(file) | ||
sound = Gdx.audio.newSound(soundFile) | ||
} catch (Exception e) { | ||
println(NLS.bind(Messages.WollokGame_AudioNotFound, file)) | ||
} | ||
} | ||
sound | ||
} | ||
|
||
} |
Oops, something went wrong.