<commit_before>#include "Core.h"
#include <SDL2/SDL.h>
#include <stdio.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>

#define SUCCESS 0

//app initialization
Core::Core()
{
	if (!appInitialization())
		printf("App Initialization not successful\n");
}

//app destruction
Core::~Core()
{
	appCleanUp();
}

Uint64 Core::getTargetFPS()
{
	return targetFPS;
}

float Core::getTargetDeltaTime()
{
	return targetDeltaTime;
}

SDL_Renderer * Core::getRenderer()
{
	return mainRenderer;
}

SDL_Window * Core::getWindow()
{
	return mainWindow;
}

bool Core::appInitialization()
{
	SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER);

	if (SDL_GetNumVideoDisplays() <= 0)
	{
		printf("No display monitors attached to current device: %s\n", SDL_GetError());
		return false;
	}

	//obtain target fps based on monitor's refresh rate (hz).
	SDL_DisplayMode displayMode;
	//get the first monitor attached to device display mode settings.
	if (SDL_GetDisplayMode(0, 0, &displayMode) != SUCCESS)
	{
		printf("Unable to get display mode settings : %s\n", SDL_GetError());
		return false;
	}

	targetFPS = displayMode.refresh_rate;
	targetDeltaTime = 1000.0f / targetFPS;

	mainWindow = SDL_CreateWindow("Beat Em Left", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
	if (mainWindow == NULL)
	{
		printf("Main window creation failed : %s\n", SDL_GetError());
		return false;<commit_msg>Maintain max fps to 60 if a monitor's refresh rate exceeds 60hz<commit_after>#include "Core.h"
#include <SDL2/SDL.h>
#include <stdio.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>

#define SUCCESS 0

//app initialization
Core::Core()
{
	if (!appInitialization())
		printf("App Initialization not successful\n");
}

//app destruction
Core::~Core()
{
	appCleanUp();
}

Uint64 Core::getTargetFPS()
{
	return targetFPS;
}

float Core::getTargetDeltaTime()
{
	return targetDeltaTime;
}

SDL_Renderer * Core::getRenderer()
{
	return mainRenderer;
}

SDL_Window * Core::getWindow()
{
	return mainWindow;
}

bool Core::appInitialization()
{
	SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMECONTROLLER);

	if (SDL_GetNumVideoDisplays() <= 0)
	{
		printf("No display monitors attached to current device: %s\n", SDL_GetError());
		return false;
	}

	//obtain target fps based on monitor's refresh rate (hz).
	SDL_DisplayMode displayMode;
	//get the first monitor attached to device display mode settings.
	if (SDL_GetDisplayMode(0, 0, &displayMode) != SUCCESS)
	{
		printf("Unable to get display mode settings : %s\n", SDL_GetError());
		return false;
	}

	//cap targetFPS to 60
	targetFPS = displayMode.refresh_rate > 60 ? 60 : displayMode.refresh_rate;
	targetDeltaTime = 1000.0f / targetFPS;

	mainWindow = SDL_CreateWindow("Beat Em Left", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
	if (mainWindow == NULL)
	{
		printf("Main window creation failed : %s\n", SDL_GetError());
		return false;
{'fraction_non_alphanumeric': 0.12727886563133017, 'fraction_numerical': 0.012829169480081027, 'mean_word_length': 5.304255319148936, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 12, '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': '7476924', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1050, 'n_words': 259}