<commit_before>package io.github.deathsbreedgames.spacerun;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;

import io.github.deathsbreedgames.spacerun.GlobalVars;
import io.github.deathsbreedgames.spacerun.screens.*;

/**
 * @author <NAME>
 * @copyright DeathsbreedGames
 * @license GNU Affero GPLv3
 * @year 2014
 * 
 * Description: This is the starting game class.
 * 
 */
public class SpaceRun extends Game {
	private Music music;
	
	// Create:
	@Override
	public void create () {
		setScreen(new SplashScreen());
		Preferences prefs = Gdx.app.getPreferences("SpaceRun");
		GlobalVars.highScore = prefs.getInteger("HighScore");
		GlobalVars.soundOn = !prefs.getBoolean("SoundOff");
		GlobalVars.musicOn = !prefs.getBoolean("MusicOff");
		
		music = Gdx.audio.newMusic(Gdx.files.internal("sfx/Android128_-_Dreamtest.mp3"));
		music.setLooping(true);
	}
	
	// Update:
	@Override
	public void render () {
		BaseScreen currentScreen = (BaseScreen)super.getScreen();
		
		currentScreen.render(Gdx.graphics.getDeltaTime());
		
		if(currentScreen.isDone()) {
			currentScreen.dispose();
			if(currentScreen.getNextScreen().equals("Splash")) {
				setScreen(new SplashScreen());
			} else if(currentScreen.getNextScreen().equals("MainMenu")) {
				setScreen(new MainMenuScreen());
			} else if(currentScreen.getNextScreen().equals("Help")) {
				setScreen(new HelpScreen());
			} else if(currentScreen.getNextScreen().equals("Options")) {
				setScreen(new OptionsScreen());
			} else if(currentScreen.getNextScreen().equals("CreditsMenu")) {
				setScreen(new CreditsMenuScreen());
			} else if(currentScreen.getNextScreen().equals("ShipSelect")) {
				setScreen(new ShipSelectScreen());
			} else if(currentScreen.getNextScreen().equals("Game")) {
				setScreen(new GameScreen());
			} else if(currentScreen.getNextScreen().equals("GameOver")) {
				setScreen(new GameOverScreen());
			} else {
				setScreen(new SplashScreen());
			}
		}
		
		if(currentScreen instanceof SplashScreen && music.isPlaying()) {
			music.stop();
		} else {
			if(!music.isPlaying() && GlobalVars.musicOn) music.play();
			else if(music.isPlaying() && !GlobalVars.musicOn) music.stop();
		}
	}
	
	// Dispose:
	@Override
	public void dispose() {
		super.getScreen().dispose();
		super.dispose();
	}
}
<commit_msg>Fixed a little problem with sound.<commit_after>package io.github.deathsbreedgames.spacerun;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;

import io.github.deathsbreedgames.spacerun.GlobalVars;
import io.github.deathsbreedgames.spacerun.screens.*;

/**
 * @author <NAME>
 * @copyright DeathsbreedGames
 * @license GNU Affero GPLv3
 * @year 2014
 * 
 * Description: This is the starting game class.
 * 
 */
public class SpaceRun extends Game {
	private Music music;
	
	// Create:
	@Override
	public void create () {
		setScreen(new SplashScreen());
		Preferences prefs = Gdx.app.getPreferences("SpaceRun");
		GlobalVars.highScore = prefs.getInteger("HighScore");
		GlobalVars.soundOn = !prefs.getBoolean("SoundOff");
		GlobalVars.musicOn = !prefs.getBoolean("MusicOff");
		
		music = Gdx.audio.newMusic(Gdx.files.internal("sfx/Android128_-_Dreamtest.mp3"));
		music.setLooping(true);
	}
	
	// Update:
	@Override
	public void render () {
		BaseScreen currentScreen = (BaseScreen)super.getScreen();
		
		currentScreen.render(Gdx.graphics.getDeltaTime());
		
		if(currentScreen.isDone()) {
			currentScreen.dispose();
			if(currentScreen.getNextScreen().equals("Splash")) {
				setScreen(new SplashScreen());
			} else if(currentScreen.getNextScreen().equals("MainMenu")) {
				setScreen(new MainMenuScreen());
			} else if(currentScreen.getNextScreen().equals("Help")) {
				setScreen(new HelpScreen());
			} else if(currentScreen.getNextScreen().equals("Options")) {
				setScreen(new OptionsScreen());
			} else if(currentScreen.getNextScreen().equals("CreditsMenu")) {
				setScreen(new CreditsMenuScreen());
			} else if(currentScreen.getNextScreen().equals("ShipSelect")) {
				setScreen(new ShipSelectScreen());
			} else if(currentScreen.getNextScreen().equals("Game")) {
				setScreen(new GameScreen());
			} else if(currentScreen.getNextScreen().equals("GameOver")) {
				setScreen(new GameOverScreen());
			} else {
				setScreen(new SplashScreen());
			}
		}
		
		if(currentScreen instanceof SplashScreen) {
			if(music.isPlaying()) music.stop();
		} else {
			if(!music.isPlaying() && GlobalVars.musicOn) music.play();
			else if(music.isPlaying() && !GlobalVars.musicOn) music.stop();
		}
	}
	
	// Dispose:
	@Override
	public void dispose() {
		super.getScreen().dispose();
		super.dispose();
	}
}

{'fraction_non_alphanumeric': 0.15169701986754966, 'fraction_numerical': 0.0037251655629139072, 'mean_word_length': 4.699292452830188, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1084892', 'n_tokens_mistral': 1794, 'n_tokens_neox': 1553, 'n_words': 255}