<commit_before>package bwyap.familyfeud.render.state.play;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.util.ArrayList;
import java.util.List;

import bwyap.familyfeud.game.Family;
import bwyap.familyfeud.game.FamilyFeudGame;
import bwyap.familyfeud.gui.window.GameWindow;
import bwyap.familyfeud.render.RenderableInterface;
import bwyap.familyfeud.render.RenderingPanel;
import bwyap.familyfeud.render.component.RenderableString;
import bwyap.gridgame.res.ResourceLoader;

/**
 * A renderable component that renders the name and score of each family on the screen.
 * @author bwyap
 *
 */
public class RenderFamilyScores implements RenderableInterface {
		
	private FamilyFeudGame game;
	private RenderableString title;
	private List<RenderableString> familyNames;
	private List<RenderableString> familyScores;
	
	public RenderFamilyScores(FamilyFeudGame game) {
		this.game = game;
		this.title = new RenderableString("Scoreboard", 0, 250, "Bebas Neue", Font.PLAIN, 160, Color.ORANGE, true);
		this.familyNames = new ArrayList<RenderableString>();
		this.familyScores = new ArrayList<RenderableString>();
	}
	
	@Override
	public void update(float timeElapsed) {
		// Create family labels if not created
		boolean updated = false;
		if (familyNames.size() == 0) {
			familyScores.clear();
			updated = true;
			for(int i = 0; i < game.getFamilies().size(); i++) {
				Family f = game.getFamilies().get(i);
				int y = 400 + (i * 150);
				RenderableString name = new RenderableString(
						f.getName(), 
						0, y, 
						ResourceLoader.getFontName("Bebas Neue"), 120);
				name.setColor(Color.WHITE);
				
				RenderableString score = new RenderableString(
						" " + f.getPoints(), 0, y, 
						ResourceLoader.getFontName("Bebas Neue"), 120);
				score.setColor(Color.WHITE);
				
				familyNames.add(name);
				familyScores.add(score);
			}
		}
		
		// Update scores
		if (!updated) {
			for(int i = 0; i < game.getFamilies().size(); i++) {
				Family f = game.getFamilies().get(i);
				familyScores.get(i).setText(" " + f.getPoints());
			}
		}
	}
	
	@Override
	public void render(RenderingPanel panel, Graphics g) {
		title.render(panel, g);
		
		int center = GameWindow.WIDTH / 2;//+ panel.scaleX(120);<commit_msg>Reduce size of text on scoreboard<commit_after>package bwyap.familyfeud.render.state.play;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.util.ArrayList;
import java.util.List;

import bwyap.familyfeud.game.Family;
import bwyap.familyfeud.game.FamilyFeudGame;
import bwyap.familyfeud.gui.window.GameWindow;
import bwyap.familyfeud.render.RenderableInterface;
import bwyap.familyfeud.render.RenderingPanel;
import bwyap.familyfeud.render.component.RenderableString;
import bwyap.gridgame.res.ResourceLoader;

/**
 * A renderable component that renders the name and score of each family on the screen.
 * @author bwyap
 *
 */
public class RenderFamilyScores implements RenderableInterface {
		
	private FamilyFeudGame game;
	private RenderableString title;
	private List<RenderableString> familyNames;
	private List<RenderableString> familyScores;
	
	public RenderFamilyScores(FamilyFeudGame game) {
		this.game = game;
		this.title = new RenderableString("Scoreboard", 0, 250, "Bebas Neue", Font.PLAIN, 160, Color.ORANGE, true);
		this.familyNames = new ArrayList<RenderableString>();
		this.familyScores = new ArrayList<RenderableString>();
	}
	
	@Override
	public void update(float timeElapsed) {
		// Create family labels if not created
		boolean updated = false;
		if (familyNames.size() == 0) {
			familyScores.clear();
			updated = true;
			for(int i = 0; i < game.getFamilies().size(); i++) {
				Family f = game.getFamilies().get(i);
				int y = 400 + (i * 150);
				RenderableString name = new RenderableString(
						f.getName(), 
						0, y, 
						ResourceLoader.getFontName("Bebas Neue"), 100);
				name.setColor(Color.WHITE);
				
				RenderableString score = new RenderableString(
						" " + f.getPoints(), 0, y, 
						ResourceLoader.getFontName("Bebas Neue"), 100);
				score.setColor(Color.WHITE);
				
				familyNames.add(name);
				familyScores.add(score);
			}
		}
		
		// Update scores
		if (!updated) {
			for(int i = 0; i < game.getFamilies().size(); i++) {
				Family f = game.getFamilies().get(i);
				familyScores.get(i).setText(" " + f.getPoints());
			}
		}
	}
	
	@Override
	public void render(RenderingPanel panel, Graphics g) {
		title.render(panel, g);
		
		int center = GameWindow.WIDTH / 2;
{'fraction_non_alphanumeric': 0.1235632183908046, 'fraction_numerical': 0.011715296198054819, 'mean_word_length': 3.9834801762114536, 'pattern_counts': {'":': 0, '<': 15, '<?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': '4891843', 'n_tokens_mistral': 1741, 'n_tokens_neox': 1476, 'n_words': 341}