<commit_before>#include "SDL.h"


void drawSquare(SDL_Surface *ecran, int px, int py, int size, RGB couleur)
{
	SDL_Rect rect;
	rect.x = px;
	rect.y = py;
	rect.h = rect.w = size;
	SDL_FillRect(ecran, &rect, SDL_MapRGB(ecran->format, couleur.r, couleur.g, couleur.b));
}

void fillScreen(SDL_Surface *ecran, RGB couleur)
{
	SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, couleur.r, couleur.g, couleur.b));
	SDL_Flip(ecran);	/*MàJ de l'écran*/
}

SDL_Rect position_SDL(SDL_Rect position, int px, int py)
{
	position.x = px;
	position.y = py;
	return position;
}

void display_menu(SDL_Surface *ecran, grille plateau, int size, int size_window)
{
	RGB V = {153, 255, 0};		// vert
	RGB R = {204, 0, 51};		// rouge-rose
	RGB B = {0, 102, 255};		// bleu
	RGB G = {102, 204, 204};	// bleu pastel
	RGB J = {255, 255, 102};	// jaune pastel
	RGB M = {153, 0, 255};		// violet

	int i, j;
	char couleur;

	for (i=0 ; i<size ; i++)
	{
		for (j=0 ; j<size ; j++)
		{
			couleur = plateau[i][j];
			switch (couleur)
			{
				case 'B':
				drawSquare(ecran, j*size_window/size, i*size_window/size, size_window/size, B);
				break;

				case 'V':
				drawSquare(ecran, j*size_window/size, i*size_window/size, size_window/size, V);
				break;

				case 'R':
				drawSquare(ecran, j*size_window/size, i*size_window/size, size_window/size, R);
				break;

				case 'J':
				drawSquare(ecran, j*size_window/size, i*size_window/size, size_window/size, J);
				break;

				case 'M':
				drawSquare(ecran, j*size_window/size, i*size_window/size, size_window/size, M);
				break;

				case 'G':
				drawSquare(ecran, j*size_window/size, i*size_window/size, size_window/size, G);
				break;
			}
		}
	}
}

SDL_Surface *menu(TTF_Font *police_moyenne, TTF_Font *police_grande, int *size, int *difficulte, int *nbr_coups_max)
{
	SDL_Surface *ecran, *nom_jeu, *taille_jeu, *niveau_jeu, *facile, *normal, *expert, *icone_plus, *icone_moins, *icone_jouer;
	SDL_Event event;
	SDL_Rect position_nom_jeu, position_taille_jeu, position_niveau_jeu, position_facile, position_normal, position_expert;
	SDL_Rect position_plus, position_moins, position_jouer;
	SDL_Color couleur_texte_W = {255, 255, 255, 42}, couleur_texte_G = {51, 51, 51, 42};

	bool flip = true;
	int continuer = 1, compteur = 3, niveau = 2;
	char compteur_txt[50];

	position_SDL(position_nom_jeu, 41, 5);
	position_SDL(position_taille_jeu, 78, 100);
	position_SDL(position_niveau_jeu, 125, 195);
	/*position_nom_jeu.x = 41;
	position_nom_jeu.y = 5;
	position_taille_jeu.x = 78;
	position_taille_jeu.y = 100;
	position_niveau_jeu.x = 125;
	position_niveau_jeu.y = 195;*/

	position_facile.x = 62;
	position_facile.y = 274;
	position_normal.x = 184;
	position_normal.y = 274;<commit_msg>up fonction position<commit_after>#include "SDL.h"


void drawSquare(SDL_Surface *ecran, int px, int py, int size, RGB couleur)
{
	SDL_Rect rect;
	rect.x = px;
	rect.y = py;
	rect.h = rect.w = size;
	SDL_FillRect(ecran, &rect, SDL_MapRGB(ecran->format, couleur.r, couleur.g, couleur.b));
}

void fillScreen(SDL_Surface *ecran, RGB couleur)
{
	SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, couleur.r, couleur.g, couleur.b));
	SDL_Flip(ecran);	/*MàJ de l'écran*/
}

SDL_Rect position_SDL(SDL_Rect position, int px, int py)
{
	position.x = px;
	position.y = py;
	return position;
}

void display_menu(SDL_Surface *ecran, grille plateau, int size, int size_window)
{
	RGB V = {153, 255, 0};		// vert
	RGB R = {204, 0, 51};		// rouge-rose
	RGB B = {0, 102, 255};		// bleu
	RGB G = {102, 204, 204};	// bleu pastel
	RGB J = {255, 255, 102};	// jaune pastel
	RGB M = {153, 0, 255};		// violet

	int i, j;
	char couleur;

	for (i=0 ; i<size ; i++)
	{
		for (j=0 ; j<size ; j++)
		{
			couleur = plateau[i][j];
			switch (couleur)
			{
				case 'B':
				drawSquare(ecran, j*size_window/size, i*size_window/size, size_window/size, B);
				break;

				case 'V':
				drawSquare(ecran, j*size_window/size, i*size_window/size, size_window/size, V);
				break;

				case 'R':
				drawSquare(ecran, j*size_window/size, i*size_window/size, size_window/size, R);
				break;

				case 'J':
				drawSquare(ecran, j*size_window/size, i*size_window/size, size_window/size, J);
				break;

				case 'M':
				drawSquare(ecran, j*size_window/size, i*size_window/size, size_window/size, M);
				break;

				case 'G':
				drawSquare(ecran, j*size_window/size, i*size_window/size, size_window/size, G);
				break;
			}
		}
	}
}

SDL_Surface *menu(TTF_Font *police_moyenne, TTF_Font *police_grande, int *size, int *difficulte, int *nbr_coups_max)
{
	SDL_Surface *ecran, *nom_jeu, *taille_jeu, *niveau_jeu, *facile, *normal, *expert, *icone_plus, *icone_moins, *icone_jouer;
	SDL_Event event;
	SDL_Rect position_nom_jeu, position_taille_jeu, position_niveau_jeu, position_facile, position_normal, position_expert;
	SDL_Rect position_plus, position_moins, position_jouer;
	SDL_Color couleur_texte_W = {255, 255, 255, 42}, couleur_texte_G = {51, 51, 51, 42};

	bool flip = true;
	int continuer = 1, compteur = 3, niveau = 2;
	char compteur_txt[50];

	position_nom_jeu = position_SDL(position_nom_jeu, 41, 5);
	position_taille_jeu = position_SDL(position_taille_jeu, 78, 100);
	position_niveau_jeu = position_SDL(position_niveau_jeu, 125, 195);
	/*position_nom_jeu.x = 41;
	position_nom_jeu.y = 5;
	position_taille_jeu.x = 78;
	position_taille_jeu.y = 100;
	position_niveau_jeu.x = 125;
	position_niveau_jeu.y = 195;*/

	position_facile.x = 62;
	position_facile.y = 274;
	position_normal.x = 184;
	position_normal.y = 274;
{'fraction_non_alphanumeric': 0.14153678869155492, 'fraction_numerical': 0.03986951794128307, 'mean_word_length': 4.261201143946616, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7327963', 'n_tokens_mistral': 2754, 'n_tokens_neox': 2354, 'n_words': 514}