<commit_before>package net.mgsx.game.core.screen;

import com.badlogic.gdx.Screen;
import com.badlogic.gdx.math.MathUtils;

/**
 * Screen playing smooth transition between 2 screens.
 * 
 * Transition effect itself is handled by ScreenTransition
 * 
 * @author mgsx
 *
 */
public class TransitionScreen implements ScreenClip
{
	public Screen source;
	private TransitionDesc desc;
	private float time;
	private boolean complete;

	@Override
	public void show() {
		desc.destination.show();
	}
	
	public Screen getDestination(){
		return desc.destination;
	}
	
	public void setDesc(TransitionDesc desc) {
		this.desc = desc;
	}
	
	@Override
	public void render(float deltaTime) 
	{
		time += deltaTime;
		if(!complete && time > desc.duration){
			complete = true;
			if(desc.listener != null) desc.listener.end();
		}
		float t = desc.interpolation.apply(MathUtils.clamp(time / desc.duration, 0, 1));
		desc.transition.render(source, desc.destination, deltaTime, t);
	}

	@Override<commit_msg>fix transitions : hide source when over<commit_after>package net.mgsx.game.core.screen;

import com.badlogic.gdx.Screen;
import com.badlogic.gdx.math.MathUtils;

/**
 * Screen playing smooth transition between 2 screens.
 * 
 * Transition effect itself is handled by ScreenTransition
 * 
 * @author mgsx
 *
 */
public class TransitionScreen implements ScreenClip
{
	public Screen source;
	private TransitionDesc desc;
	private float time;
	private boolean complete;

	@Override
	public void show() {
		desc.destination.show();
	}
	
	public Screen getDestination(){
		return desc.destination;
	}
	
	public void setDesc(TransitionDesc desc) {
		this.desc = desc;
	}
	
	@Override
	public void render(float deltaTime) 
	{
		time += deltaTime;
		if(!complete && time > desc.duration){
			complete = true;
			source.hide();
			if(desc.listener != null) desc.listener.end();
		}
		float t = desc.interpolation.apply(MathUtils.clamp(time / desc.duration, 0, 1));
		desc.transition.render(source, desc.destination, deltaTime, t);
	}

	@Override
{'fraction_non_alphanumeric': 0.11105626850937808, 'fraction_numerical': 0.0029615004935834156, 'mean_word_length': 4.092964824120603, 'pattern_counts': {'":': 0, '<': 3, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3105128', 'n_tokens_mistral': 675, 'n_tokens_neox': 612, 'n_words': 167}