<commit_before>package fr.utbm.lo43.entities;

import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.geom.Line;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.geom.Vector2f;
import org.newdawn.slick.state.StateBasedGame;

public class Slider extends EntityClickable implements EntityDrawable
{
	Line slider;
	Rectangle indicator;
	int indicator_size;
	
	boolean isSliding;
	
	public Slider(Vector2f _position) 
	{
		super(_position);
		indicator_size = 32;
		
		slider = new Line(_position, new Vector2f(_position.x + 200, _position.y));
		indicator = new Rectangle(
				_position.x - indicator_size / 4, 
				_position.y - indicator_size / 2, 
				indicator_size / 2, 
				indicator_size
		);
		
		isSliding = false;
	}

	@Override
	public void update(GameContainer gc, StateBasedGame sbg, int delta) 
	{
		Input input = gc.getInput();
		
		if(indicator.contains(input.getMouseX(), input.getMouseY()))
		{
			System.out.println("Dedans");
			if(input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON))
			{
				System.out.println("cliqu");
				if(indicator.getCenterX() >= position.x && indicator.getCenterX() <= slider.getMaxX())
				{
					isSliding = true;
					System.out.println("bouge");
				}
				else
				{
					isSliding = false;
				}
			}
		}
		
		if(isSliding)
		{
			indicator.setCenterX(input.getMouseX());
		}
	}

	@Override
	public void render(Graphics arg2) 
	{
		arg2.setColor(Color.black);
		arg2.setLineWidth(5);
		arg2.draw(slider);
		arg2.fill(indicator);
	}	
}
<commit_msg>mécanique de base du Slider fonctionnelle<commit_after>package fr.utbm.lo43.entities;

import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.geom.Line;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.geom.Vector2f;
import org.newdawn.slick.state.StateBasedGame;

public class Slider extends EntityClickable implements EntityDrawable
{
	Line slider;
	Rectangle indicator;
	int indicator_size;
	
	boolean isSliding;
	
	public Slider(Vector2f _position) 
	{
		super(_position);
		indicator_size = 32;
		
		slider = new Line(_position, new Vector2f(_position.x + 200, _position.y));
		indicator = new Rectangle(
				_position.x - indicator_size / 4, 
				_position.y - indicator_size / 2, 
				indicator_size / 2, 
				indicator_size
		);
		
		isSliding = false;
	}

	@Override
	public void update(GameContainer gc, StateBasedGame sbg, int delta) 
	{
		Input input = gc.getInput();
		
		if(input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON))
		{
			if(indicator.contains(input.getMouseX(), input.getMouseY()))
			{
				if(indicator.getCenterX() >= position.x && indicator.getCenterX() <= slider.getMaxX())
				{
					isSliding = true;
				}
				else
				{
					isSliding = false;
				}
			}
		}
		else
		{
			isSliding = false;
		}
		
		if(isSliding)
		{
			indicator.setCenterX(input.getMouseX());
		}
		
		if(indicator.getCenterX() < position.x)
		{
			indicator.setCenterX(position.x + indicator_size / 4);
		}
		if(indicator.getCenterX() > slider.getMaxX())
		{
			indicator.setCenterX(slider.getMaxX() - indicator_size / 4);
		}
	}

	@Override
	public void render(Graphics arg2) 
	{
		arg2.setColor(Color.black);
		arg2.setLineWidth(5);
		arg2.draw(slider);
		arg2.fill(indicator);
	}	
}

{'fraction_non_alphanumeric': 0.11615598885793872, 'fraction_numerical': 0.011142061281337047, 'mean_word_length': 2.99, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '2134202', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1300, 'n_words': 211}