<commit_before>package com.mygdx.game;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.controllers.Controller;
import com.badlogic.gdx.controllers.ControllerListener;
import com.badlogic.gdx.controllers.Controllers;
import com.badlogic.gdx.controllers.PovDirection;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Pool;
import com.mygdx.character.Tengu;
import com.mygdx.environment.Plateform;
import com.mygdx.tools.Gravity;
import com.mygdx.tools.XBox360Pad;

import java.util.ArrayList;


public class MyGdxGame extends ApplicationAdapter implements ControllerListener, InputProcessor {

	private Controller controller;
	private OrthographicCamera camera;
    private Gravity gravity;
	private Tengu tengu;

	private Pool<Rectangle> rectanglePool = new Pool<Rectangle>() {
		@Override
		protected Rectangle newObject () {
			return new Rectangle();
		}
	};

	ArrayList<Plateform> plateformList;

	@Override
	public void create ()
	{
		// Listen to all controllers, not just one
		Controllers.addListener(this);
		Gdx.input.setInputProcessor(this);

		if(Controllers.getControllers().size > 0) {
			this.controller = Controllers.getControllers().first();
		}

		this.camera = new OrthographicCamera(1280, 720);
		this.camera.setToOrtho(false, 1280, 720);
		this.camera.position.set(0, 720f / 2f, 0);
		this.camera.update();

		this.gravity = new Gravity();

		this.tengu = new Tengu(new Vector2(0, 20), 0, 0);
        this.gravity.addGravityAffectedElement(this.tengu);

		this.plateformList = new ArrayList();
		plateformList.add(new Plateform(0, -100, Gdx.graphics.getWidth()*10, 110));
		for(int i=0; i<20; i++) {
			plateformList.add(new Plateform(i*800, (float)(Math.random() * ( 500 - 100 )), (float)(Math.random() * ( 500 - 100 )), (float)(Math.random() * ( 500 - 100 ))));
		}
	}

	public void update(float deltaTime)
	{
		Vector2 oldTenguPosition = new Vector2(this.tengu.getPosition().x, this.tengu.getPosition().y);

		//apply gravity
		this.gravity.applyGravity();

		//TODO Check if on keyboard or controller
		this.handleKeyboard();
		this.handleController();

		//this.tengu.handleKeys();
		this.tengu.update(deltaTime);

		this.handleCollisions(oldTenguPosition);

		//add delta time to position ?
		//System.out.println((oldTenguPosition.x - this.tengu.getPosition().x) * deltaTime * 10);
	}


	@Override
	public void render () {
		float deltaTime = Gdx.graphics.getDeltaTime() * 10;
		update(deltaTime);

		//this.camera.position.set(this.tengu.getPosition().x, this.tengu.getPosition().y, 0);<commit_msg>generate plateform after 800px min<commit_after>package com.mygdx.game;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.controllers.Controller;
import com.badlogic.gdx.controllers.ControllerListener;
import com.badlogic.gdx.controllers.Controllers;
import com.badlogic.gdx.controllers.PovDirection;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.utils.Pool;
import com.mygdx.character.Tengu;
import com.mygdx.environment.Plateform;
import com.mygdx.tools.Gravity;
import com.mygdx.tools.XBox360Pad;

import java.util.ArrayList;


public class MyGdxGame extends ApplicationAdapter implements ControllerListener, InputProcessor {

	private Controller controller;
	private OrthographicCamera camera;
    private Gravity gravity;
	private Tengu tengu;

	private Pool<Rectangle> rectanglePool = new Pool<Rectangle>() {
		@Override
		protected Rectangle newObject () {
			return new Rectangle();
		}
	};

	ArrayList<Plateform> plateformList;

	@Override
	public void create ()
	{
		// Listen to all controllers, not just one
		Controllers.addListener(this);
		Gdx.input.setInputProcessor(this);

		if(Controllers.getControllers().size > 0) {
			this.controller = Controllers.getControllers().first();
		}

		this.camera = new OrthographicCamera(1280, 720);
		this.camera.setToOrtho(false, 1280, 720);
		this.camera.position.set(0, 720f / 2f, 0);
		this.camera.update();

		this.gravity = new Gravity();

		this.tengu = new Tengu(new Vector2(0, 20), 0, 0);
        this.gravity.addGravityAffectedElement(this.tengu);

		this.plateformList = new ArrayList();
		plateformList.add(new Plateform(0, -100, Gdx.graphics.getWidth()*10, 110));
		for(int i=0; i<20; i++) {
			plateformList.add(new Plateform((i + 1)*800, (float)(Math.random() * ( 500 - 100 )), (float)(Math.random() * ( 500 - 100 )), (float)(Math.random() * ( 500 - 100 ))));
		}
	}

	public void update(float deltaTime)
	{
		Vector2 oldTenguPosition = new Vector2(this.tengu.getPosition().x, this.tengu.getPosition().y);

		//apply gravity
		this.gravity.applyGravity();

		//TODO Check if on keyboard or controller
		this.handleKeyboard();
		this.handleController();

		//this.tengu.handleKeys();
		this.tengu.update(deltaTime);

		this.handleCollisions(oldTenguPosition);

		//add delta time to position ?
		//System.out.println((oldTenguPosition.x - this.tengu.getPosition().x) * deltaTime * 10);
	}


	@Override
	public void render () {
		float deltaTime = Gdx.graphics.getDeltaTime() * 10;
		update(deltaTime);

		//this.camera.position.set(this.tengu.getPosition().x, this.tengu.getPosition().y, 0);
{'fraction_non_alphanumeric': 0.1342340761537112, 'fraction_numerical': 0.026671345850149148, 'mean_word_length': 4.694305694305695, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6872870', 'n_tokens_mistral': 2171, 'n_tokens_neox': 1938, 'n_words': 368}