<commit_before>#ifndef SCREENBUFFER_CPP
#define SCREENBUFFER_CPP
#include "ScreenBuffer.h"

using namespace std;

ScreenBuffer::ScreenBuffer(const int screenWidth, const int screenHeight):
m_BufferHeight(screenHeight),
m_BufferWidth(screenWidth),
// Allocate the memory for the 2d array
m_screenBuffer(new char *[m_BufferHeight]),
m_window(sf::VideoMode(800, 600), "Quadris SFML")
{
	for (int i = 0; i != m_BufferHeight; i++)
	{
		m_screenBuffer[i] = new char[m_BufferWidth];	
	}
}

ScreenBuffer::~ScreenBuffer()
{
	// Free the memory of the screenBuffer
	for (int i = 0; i != m_BufferHeight; i++)
	{
		delete[] m_screenBuffer[i];
	}
	delete[] m_screenBuffer;
}

int ScreenBuffer::getHeight() const
{
	return m_BufferHeight;
}

int ScreenBuffer::getWidth() const
{
	return m_BufferWidth;
}

void ScreenBuffer::add(const int X, const int Y, const char C)
{
	if (isInBufferArea(X, Y))
	{
		m_screenBuffer[Y][X] = C;
	}
}

void ScreenBuffer::add(const int StartX, const int StartY, const string Text)
{
	for (size_t x = StartX; x != StartX + Text.length(); x++)
	{
		if (isInBufferArea(x, StartY))
		{
			m_screenBuffer[StartY][x] = Text[x - StartX];	
		}
	}
}

void ScreenBuffer::clear()
{
	for (int y = 0; y != m_BufferHeight; y++)
	{
		for (int x = 0; x != m_BufferWidth; x++)
		{
			m_screenBuffer[y][x] = ' ';
		}	
	}
}

void ScreenBuffer::drawToScreen() 
{
	m_window.clear();
	m_window.display();
	
	for (int y = 0; y != m_BufferHeight; y++)
	{
		for (int x = 0; x != m_BufferWidth; x++)
		{
			cout << m_screenBuffer[y][x];<commit_msg>Handle window clearing now in the clear method<commit_after>#ifndef SCREENBUFFER_CPP
#define SCREENBUFFER_CPP
#include "ScreenBuffer.h"

using namespace std;

ScreenBuffer::ScreenBuffer(const int screenWidth, const int screenHeight):
m_BufferHeight(screenHeight),
m_BufferWidth(screenWidth),
// Allocate the memory for the 2d array
m_screenBuffer(new char *[m_BufferHeight]),
m_window(sf::VideoMode(800, 600), "Quadris SFML")
{
	for (int i = 0; i != m_BufferHeight; i++)
	{
		m_screenBuffer[i] = new char[m_BufferWidth];	
	}
}

ScreenBuffer::~ScreenBuffer()
{
	// Free the memory of the screenBuffer
	for (int i = 0; i != m_BufferHeight; i++)
	{
		delete[] m_screenBuffer[i];
	}
	delete[] m_screenBuffer;
}

int ScreenBuffer::getHeight() const
{
	return m_BufferHeight;
}

int ScreenBuffer::getWidth() const
{
	return m_BufferWidth;
}

void ScreenBuffer::add(const int X, const int Y, const char C)
{
	if (isInBufferArea(X, Y))
	{
		m_screenBuffer[Y][X] = C;
	}
}

void ScreenBuffer::add(const int StartX, const int StartY, const string Text)
{
	for (size_t x = StartX; x != StartX + Text.length(); x++)
	{
		if (isInBufferArea(x, StartY))
		{
			m_screenBuffer[StartY][x] = Text[x - StartX];	
		}
	}
}

void ScreenBuffer::clear()
{
	m_window.clear();
	for (int y = 0; y != m_BufferHeight; y++)
	{
		for (int x = 0; x != m_BufferWidth; x++)
		{
			m_screenBuffer[y][x] = ' ';
		}	
	}
}

void ScreenBuffer::drawToScreen() 
{
	m_window.display();
	
	for (int y = 0; y != m_BufferHeight; y++)
	{
		for (int x = 0; x != m_BufferWidth; x++)
		{
			cout << m_screenBuffer[y][x];
{'fraction_non_alphanumeric': 0.1523625843780135, 'fraction_numerical': 0.008357441337190614, 'mean_word_length': 4.5177304964539005, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '7343089', 'n_tokens_mistral': 1256, 'n_tokens_neox': 1193, 'n_words': 296}