<commit_before>#include "YMain.h"

/** C++ **/
#include <cassert>

YMain::YMain(const char* a_title,
		  	 int a_width,
		  	 int a_height,
		  	 Error* a_error)
{
	SDL_Init(SDL_INIT_VIDEO);
	m_window = SDL_CreateWindow(a_title,
								SDL_WINDOWPOS_UNDEFINED, 
								SDL_WINDOWPOS_UNDEFINED, 
								a_width,
								a_height, 
								0);
	if (m_window == nullptr)
	{
		if (a_error != nullptr)
		{
			*a_error = CREATING_ERROR;
		}
	}
	else
	{
    	m_renderer = SDL_CreateRenderer(m_window, 
										-1,
										0);

    	if (m_renderer == nullptr)
    	{
    		if (a_error != nullptr)
    		{
    			*a_error = RENDERING_ERROR;
    		}
    	}
	}
}

YMain::~YMain()
{
	SDL_DestroyWindow(m_window);
	SDL_Quit();
}

void YMain::start(FunctionUpdate* a_update,
                  FunctionRender* a_render,
                  int a_maxFrameRate,
                  int a_skipFrames)
{
    const int SKIP_TICKS = 1000.f / (float)a_maxFrameRate;
    bool quit = false;
    int loops;
    SDL_Event event;
    Uint32 next_game_tick = SDL_GetTicks();
    float interpolation;
    
    while (!quit)
    {
        SDL_PollEvent(&event);
        
        switch (event.type)
        {
            case SDL_QUIT:
                quit = true;<commit_msg>Adds asserts on start method<commit_after>#include "YMain.h"

/** C++ **/
#include <cassert>

YMain::YMain(const char* a_title,
		  	 int a_width,
		  	 int a_height,
		  	 Error* a_error)
{
	SDL_Init(SDL_INIT_VIDEO);
	m_window = SDL_CreateWindow(a_title,
								SDL_WINDOWPOS_UNDEFINED, 
								SDL_WINDOWPOS_UNDEFINED, 
								a_width,
								a_height, 
								0);
	if (m_window == nullptr)
	{
		if (a_error != nullptr)
		{
			*a_error = CREATING_ERROR;
		}
	}
	else
	{
    	m_renderer = SDL_CreateRenderer(m_window, 
										-1,
										0);

    	if (m_renderer == nullptr)
    	{
    		if (a_error != nullptr)
    		{
    			*a_error = RENDERING_ERROR;
    		}
    	}
	}
}

YMain::~YMain()
{
	SDL_DestroyWindow(m_window);
	SDL_Quit();
}

void YMain::start(FunctionUpdate* a_update,
                  FunctionRender* a_render,
                  int a_maxFrameRate,
                  int a_skipFrames)
{
    assert(a_update != nullptr);
    assert(a_render != nullptr);
    
    const int SKIP_TICKS = 1000.f / (float)a_maxFrameRate;
    bool quit = false;
    int loops;
    SDL_Event event;
    Uint32 next_game_tick = SDL_GetTicks();
    float interpolation;
    
    while (!quit)
    {
        SDL_PollEvent(&event);
        
        switch (event.type)
        {
            case SDL_QUIT:
                quit = true;
{'fraction_non_alphanumeric': 0.10681114551083591, 'fraction_numerical': 0.00696594427244582, 'mean_word_length': 1.978110599078341, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2074267', 'n_tokens_mistral': 1149, 'n_tokens_neox': 964, 'n_words': 169}