<commit_before>/*
 * Copyright 2013 <NAME> (<EMAIL>)
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

package com.bsencan.openchess.view;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.bsencan.openchess.OpenChess;
import com.bsencan.openchess.model.Board;
import com.bsencan.openchess.screens.GameScreen;

/**
 * A {@link Renderer} for {@link GameScreen}.
 * 
 * @author <NAME>
 */
public class GameRenderer implements Renderer {

	private final Stage stage = new Stage();
	private final OrthographicCamera camera = new OrthographicCamera();

	public GameRenderer(Board board) {
		this.stage.setCamera(this.camera);
		this.stage.addActor(board);
		Gdx.input.setInputProcessor(this.stage);
		// TODO: Initialize UI.
	}

	@Override
	public void render(float delta) {
		Gdx.gl.glClearColor(.3f, .3f, .4f, 1);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
		this.stage.act(delta);
		this.stage.draw();
		// TODO: Draw UI.
	}

	@Override
	public void setSize(int width, int height) {
		// TODO: Position UI.
		this.camera.viewportWidth = OpenChess.UWIDTH;
		this.camera.viewportHeight = this.camera.viewportWidth
				* ((float) height / width);
		this.camera.position.set(OpenChess.UWIDTH / 2,
				this.camera.viewportHeight / 2, 0);
		this.camera.update();
	}

	@Override
	public void dispose() {
		// TODO: Dispose UI.
		this.stage.dispose();
	}

}<commit_msg>Cleaner rendering code.<commit_after>/*
 * Copyright 2013 <NAME> (<EMAIL>)
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

package com.bsencan.openchess.view;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.bsencan.openchess.OpenChess;
import com.bsencan.openchess.model.Board;
import com.bsencan.openchess.screens.GameScreen;

/**
 * A {@link Renderer} for {@link GameScreen}.
 * 
 * @author <NAME>
 */
public class GameRenderer implements Renderer {

	private final Stage stage = new Stage();

	public GameRenderer(Board board) {
		this.stage.addActor(board);
		Gdx.input.setInputProcessor(this.stage);
		// TODO: Initialize UI.
	}

	@Override
	public void render(float delta) {
		Gdx.gl.glClearColor(.3f, .3f, .4f, 1);
		Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
		this.stage.act(delta);
		this.stage.draw();
		// TODO: Draw UI.
	}

	@Override
	public void setSize(int width, int height) {
		float vW = OpenChess.UWIDTH; // Viewport width.
		float vH = vW * ((float) height / width); // Viewport height.

		// TODO: Position UI.

		this.stage.setViewport(vW, vH, true, vW / 2, vH / 2, vW, vH);
	}

	@Override
	public void dispose() {
		// TODO: Dispose UI.
		this.stage.dispose();
	}

}
{'fraction_non_alphanumeric': 0.11897790790524354, 'fraction_numerical': 0.010380622837370242, 'mean_word_length': 3.8996088657105608, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6612296', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1214, 'n_words': 360}