<commit_before>#include "game_window.h"
#include "chat.h"

Chat::Chat(GameWindow& owner) :
	owner(owner),
	size(owner.ancho_pantalla / 3, owner.alto_pantalla / 3),
	offset(0, 0),
	maxMessages(5)
{
}

Chat::~Chat() {
}

void Chat::draw(SDL_Renderer* renderer) {
	//Dibujo fondo
	SDL_Rect destinoFondoChat = { offset.x, offset.y, size.x, size.y };
	SDL_SetRenderDrawColor(renderer, 15, 15, 15, 255);
	SDL_RenderFillRect(renderer, &destinoFondoChat);

	SDL_Color colorBlanco = { 255, 255, 255 };
	if (owner.font) {
	}
}
		<commit_msg>dibujo los mensajes del chat<commit_after>#include "game_window.h"
#include "chat.h"

Chat::Chat(GameWindow& owner) :
	owner(owner),
	size(owner.ancho_pantalla / 3, owner.alto_pantalla / 3),
	offset(0, 0),
	maxMessages(5)
{
	messages.push_back("mensaje1");
	messages.push_back("mensaje2");
	messages.push_back("mensaje3");
	messages.push_back("mensaje4");
	messages.push_back("mensaje5");
	messages.push_back("mensaje6");
	messages.push_back("mensaje7");
}

Chat::~Chat() {
}

void Chat::draw(SDL_Renderer* renderer) {
	//Dibujo fondo
	SDL_Rect destinoFondoChat = { offset.x, offset.y, size.x, size.y };
	SDL_SetRenderDrawColor(renderer, 15, 15, 15, 255);
	SDL_RenderFillRect(renderer, &destinoFondoChat);

	//Me quedo con los ultimos mensajes
	while (messages.size() > maxMessages)
		messages.erase(messages.begin());

	//Texto
	std::string textMessages = "";
	SDL_Color colorBlanco = { 255, 255, 255 };
	if (owner.font) {
		for (int i = 0; i < maxMessages; i++) {
			if (messages.size() > i) {
				textMessages = textMessages + owner.completeLine(messages[i], size.x);
			}
		}
	}
	int access, w, h;
	Uint32 format;
	SDL_Surface * surface = TTF_RenderText_Blended_Wrapped(owner.font, textMessages.c_str(), colorBlanco, size.x / 3);
	SDL_Texture * textureChat = SDL_CreateTextureFromSurface(renderer, surface);
	SDL_QueryTexture(textureChat, &format, &access, &w, &h);
	SDL_Rect panel = { 0, 0, w , h };
	SDL_Rect text = { (int)offset.x, (int)offset.y,
		(int)((w>size.x / 3) ? size.x : w), (int)((h>size.y) ? size.y : h) };
	SDL_RenderCopy(renderer, textureChat, &panel, &text);
	SDL_FreeSurface(surface);
	SDL_DestroyTexture(textureChat);
}
		
{'fraction_non_alphanumeric': 0.1639871382636656, 'fraction_numerical': 0.02756086357372531, 'mean_word_length': 5.135211267605634, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, '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': '2092516', 'n_tokens_mistral': 933, 'n_tokens_neox': 859, 'n_words': 163}