Basic Audio 2014-06-25 ProgrammingLibGDX Android, Java, LibGDX, Programming 튜토리얼 보면서 따라한 코드이다.배경음악은 주구장창 흘러나오고, 마우스나 손가락으로 터치할때마다 효과음이 발생한다. 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354package com.awesome;import com.badlogic.gdx.ApplicationListener;import com.badlogic.gdx.Gdx;import com.badlogic.gdx.audio.Music;import com.badlogic.gdx.audio.Sound;import com.badlogic.gdx.files.FileHandle;public class SuperAwesomeExample implements ApplicationListener { Music music; Sound sound; @Override public void create() { FileHandle musicFile = Gdx.files.internal("data/Kalimba.mp3"); music = Gdx.audio.newMusic(musicFile); FileHandle soundFile = Gdx.files.internal("data/MediumExplosion8-Bit.ogg"); sound = Gdx.audio.newSound(soundFile); music.setLooping(true); music.setVolume(0.5f); music.play(); } @Override public void render() { if(Gdx.input.justTouched()) { sound.play(); } } @Override public void resize(int arg0, int arg1) { // TODO Auto-generated method stub } @Override public void pause() { // TODO Auto-generated method stub } @Override public void resume() { // TODO Auto-generated method stub } @Override public void dispose() { music.dispose(); sound.dispose(); }} Newer Basic File I/O Older Coffeescript Game Tutorial Introduction