Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Plays a sound when SPACE is pressed.
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.audio.Sound;
public class PlaySound extends ApplicationAdapter {
private Sound beep;
@Override
public void create() {
beep = Gdx.audio.newSound(Gdx.files.internal("beep.wav"));
}
@Override
public void render() {
if (Gdx.input.isKeyJustPressed(Input.Keys.SPACE)) beep.play();
}
@Override
public void dispose() {
beep.dispose();
}
}LibGDX is a powerful, open-source Java game framework for building high-performance 2D and 3D games that run on desktop, Android, iOS, and web through a single shared codebase.
Origin & Creator
LibGDX was created by Mario Zechner and maintained by a global open-source community focused on flexible, high-performance Java game development.
Industrial Note
LibGDX thrives in Android game development, indie 2D/3D engines, simulation-heavy games, and education-especially for teams needing full control without being locked into heavy engines.