Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <SDL.h>
- #include <SDL_image.h>
- #include <SDL\SDL_ttf.h>
- int main(int argc, char *argv[])
- {
- SDL_Surface *ecran = NULL, *selectMenu = NULL, *textureDeFond = NULL; // Le pointeur qui va stocker la surface de l'écran
- SDL_Surface *menu = NULL, *menu1 = NULL, *menu2 = NULL, *menu3 = NULL, *menu4 = NULL, *menu5 = NULL, *menu6 = NULL, *menu7 = NULL;
- SDL_Surface *ssMenu1 = NULL, *ssMenu2 = NULL,*ssMenu3 = NULL, *ssMenu4 = NULL, *ssMenu5 = NULL, *ssMenu6 = NULL;
- SDL_Surface *texteSelect;
- SDL_Surface *pieceJeuOff1N, *pieceJeuDef1N, *pieceJeuOff2N, *pieceJeuDef2N;
- SDL_Surface *pieceOff1N, *pieceDef1N, *pieceOff2N, *pieceDef2N;
- SDL_Surface *pieceOff1B, *pieceDef1B, *pieceOff2B, *pieceDef2B;
- SDL_Surface *pieceOff1R, *pieceDef1R, *pieceOff2R, *pieceDef2R;
- SDL_Surface *pieceOff1V, *pieceDef1V, *pieceOff2V, *pieceDef2V;
- SDL_Surface *pieceOff1Bl, *pieceDef1Bl, *pieceOff2Bl, *pieceDef2Bl;
- SDL_Surface *pieceOff1J, *pieceDef1J, *pieceOff2J, *pieceDef2J;
- SDL_Surface *pieceOff1C, *pieceDef1C, *pieceOff2C, *pieceDef2C;
- SDL_Surface *pieceOff1M, *pieceDef1M, *pieceOff2M, *pieceDef2M;
- SDL_Surface *touchePre1, *toucheSui1, *touchePre2, *toucheSui2, *touchePre3, *toucheSui3, *touchePre4, *toucheSui4, *touchePre5, *toucheSui5, *touchePre6, *toucheSui6, *touchePre7, *toucheSui7;
- SDL_Surface *textureDamFond = NULL, *textureFond = NULL, *textureEtoile = NULL, *textureForet = NULL, *texturePlage = NULL, *textureNuit = NULL;
- SDL_Surface *textureEtoile2 = NULL, *textureForet2 = NULL, *textureNuit2 = NULL, *texturePlage2 = NULL;
- SDL_Surface *damierInc400400NB = NULL, *damierInc800800NB = NULL, *textureDamier = NULL, *reglageVol = NULL, *txtRegDuVol = NULL;
- SDL_Surface *txtTexture = NULL, *selectBoutonVol = NULL, *selectVolume = NULL;
- SDL_Surface *carreRouge1, *carreVert1, *carreBleu1, *carreRouge2, *carreVert2, *carreBleu2, *rouge1, *vert1, *bleu1, *rouge0, *vert0, *bleu0;
- SDL_Surface *carreBlanc = NULL, *textJ1Commence;
- SDL_Surface *regleJeu1 = NULL, *regleJeu2 = NULL, *regleJeu3 = NULL, *regleJeu4 = NULL, *regleJeu5 = NULL, *regleJeu6 = NULL, *regleJeu7 = NULL;
- SDL_Surface *txtDeplaNA;
- SDL_Surface *CubikRed, *CubikBlue;
- SDL_Rect positionFond, positionDamFond, positionNuit, positionPlage, positionForet, positionEtoile;
- SDL_Rect positionEtoile2, positionNuit2, positionPlage2, positionForet2;
- SDL_Rect posSelectMenu, positionMenu,positionMenu1,positionMenu2,positionMenu3,positionMenu4,positionMenu5,positionMenu6,positionMenu7;
- SDL_Rect positionSsMenu1, positionSsMenu2, positionSsMenu3, positionSsMenu4, positionSsMenu5, positionSsMenu6;
- SDL_Rect posTexteSelect, posDamInc800800NB;
- SDL_Rect positionPre1, positionSui1, positionPre2, positionSui2,positionSui3, positionPre3, positionPre4, positionSui4, positionPre5, positionSui5, positionSui6, positionPre6, positionSui7, positionPre7;
- SDL_Rect posPieceOff1N, posPieceDef1N, posPieceOff2N, posPieceDef2N;
- SDL_Rect posPieceJOff1N1, posPieceJDef1N1, posPieceJOff1N2, posPieceJDef1N2, posPieceJOff1N3, posPieceJDef1N3, posPieceJOff1N4, posPieceJDef1N4, posPieceJOff1N5, posPieceJDef1N5, posPieceJOff1N6, posPieceJDef1N6;
- SDL_Rect posPieceJOff2N1, posPieceJDef2N1, posPieceJOff2N2, posPieceJDef2N2, posPieceJOff2N3, posPieceJDef2N3, posPieceJOff2N4, posPieceJDef2N4, posPieceJOff2N5, posPieceJDef2N5, posPieceJOff2N6, posPieceJDef2N6;
- SDL_Rect posPieceOff1B, posPieceDef1B, posPieceOff2B, posPieceDef2B;
- SDL_Rect posPieceOff1R, posPieceDef1R, posPieceOff2R, posPieceDef2R;
- SDL_Rect posPieceOff1V, posPieceDef1V, posPieceOff2V, posPieceDef2V;
- SDL_Rect posPieceOff1Bl, posPieceDef1Bl, posPieceOff2Bl, posPieceDef2Bl;
- SDL_Rect posPieceOff1J, posPieceDef1J, posPieceOff2J, posPieceDef2J;
- SDL_Rect posPieceOff1C, posPieceDef1C, posPieceOff2C, posPieceDef2C;
- SDL_Rect posPieceOff1M, posPieceDef1M, posPieceOff2M, posPieceDef2M;
- SDL_Rect positionTextureD, positionTextureF, positionReglageV;
- SDL_Rect posDamInc400400VB, posTxtTexture, posSelectVol, posBoutonVol, posTxtReglageV;
- SDL_Rect posCarreRouge1, posCarreVert1, posCarreBleu1, posCarreRouge2, posCarreVert2, posCarreBleu2;
- SDL_Rect posRouge1A, posVert1A, posBleu1A, posRouge0A, posVert0A, posBleu0A, posRouge1B, posVert1B, posBleu1B, posRouge0B, posVert0B, posBleu0B;
- SDL_Rect posTxtJ1C;
- SDL_Rect posRegleJeu1, posRegleJeu2, posRegleJeu3, posRegleJeu4, posRegleJeu5, posRegleJeu6, posRegleJeu7;
- SDL_Rect posTxtDeplaNA;
- SDL_Rect posCubikRed,posCubikBlue;
- TTF_Font *police = NULL;
- SDL_Color couleurNoire = {0, 0, 0};
- SDL_Event event;
- int continuer = 1, continuer1 = 1, continuer2 = 1, compteurDebut = 1;
- int compteurFond = 0, compteurRegle = 0;
- int comptR1 = 0, comptV1 = 0, comptB1 = 0, comptR2 = 0, comptV2 = 0, comptB2 = 0;
- int dragAndDrop = 1;
- int positionX, positionY;
- int posPieceX, posPieceY;
- int posCubeX, posCubeY;
- int i, j;
- int x, y;
- int a1, a2, a3, a4, a5, a6;
- int b1, b2, b3, b4, b5, b6;
- int c1, c2, c3, c4, c5, c6;
- int d1, d2, d3, d4, d5, d6;
- int e1, e2, e3, e4, e5, e6;
- int f1, f2, f3, f4, f5, f6;
- int g1, g2, g3, g4, g5, g6;
- int h1, h2, h3, h4, h5, h6;
- FILE* fichier1 = NULL;
- FILE* fichier2 = NULL;
- FILE* fichier3 = NULL;
- FILE* fichier4 = NULL;
- FILE* fichier5 = NULL;
- FILE* fichier6 = NULL;
- SDL_Rect PointHaut[15][15]; //position des points pour la zone de déposition des pions
- x = 208;
- for (i = 0 ; i < 15 ; i++)
- {
- y = 25;
- for (j = 0 ; j < 15 ; j++)
- {
- PointHaut[i][j].x = x;
- PointHaut[i][j].y = y;
- fichier1 = fopen("test.txt", "a");
- if (fichier1 != NULL)
- {
- fseek(fichier1, 0, SEEK_END);
- fprintf(fichier1, "x%d=%d\ny%d=%d\n\n",i,PointHaut[i][j].x,j,PointHaut[i][j].y);
- fclose(fichier1);
- }
- y+=50;
- }
- x+=50;
- }
- SDL_Rect PointMid[15][15]; //position des points pour la zone de déposition des pions
- x = 158;
- for (i = 0 ; i < 15 ; i++)
- {
- y = 50;
- for (j = 0 ; j < 15 ; j++)
- {
- PointMid[i][j].x = x;
- PointMid[i][j].y = y;
- fichier2 = fopen("test2.txt", "a");
- if (fichier2 != NULL)
- {
- fseek(fichier2, 0, SEEK_END);
- fprintf(fichier2, "x=%d\ny=%d\n\n",PointMid[i][j].x,PointMid[i][j].y);
- fclose(fichier2);
- }
- y+=50;
- }
- x+=50;
- }
- SDL_Rect PointBas[15][15]; //position des points pour la zone de déposition des pions
- x = 208;
- for (i = 0 ; i < 15 ; i++)
- {
- y = 75;
- for (j = 0 ; j < 15 ; j++)
- {
- PointBas[i][j].x = x;
- PointBas[i][j].y = y;
- fichier3 = fopen("test3.txt", "a");
- if (fichier3 != NULL)
- {
- fseek(fichier3, 0, SEEK_END);
- fprintf(fichier3, "x=%d\ny=%d\n\n",PointBas[i][j].x,PointBas[i][j].y);
- fclose(fichier3);
- }
- y+=50;
- }
- x+=50;
- }
- SDL_Rect PosCasesJ1off[15][15]; //position que les pieces doivent prendre après dépose
- x = 133;
- for (i = 0 ; i < 15 ; i++)
- {
- y = 50;
- for (j = 0 ; j < 15 ; j++)
- {
- PosCasesJ1off[i][j].x = x;
- PosCasesJ1off[i][j].y = y;
- fichier5 = fopen("test5.txt", "a");
- if (fichier5 != NULL)
- {
- fseek(fichier5, 0, SEEK_END);
- fprintf(fichier5, "x=%d\ny=%d\n\n",PosCasesJ1off[i][j].x,PosCasesJ1off[i][j].y);
- fclose(fichier5);
- }
- y+=50;
- }
- x+=50;
- }
- SDL_Rect PosCasesJ1def[15][15]; //position que les pieces doivent prendre après dépose
- x = 133;
- for (i = 0 ; i < 15 ; i++)
- {
- y = 45;
- for (j = 0 ; j < 15 ; j++)
- {
- PosCasesJ1def[i][j].x = x;
- PosCasesJ1def[i][j].y = y;
- fichier4 = fopen("test4.txt", "a");
- if (fichier4 != NULL)
- {
- fseek(fichier4, 0, SEEK_END);
- fprintf(fichier4, "x=%d\ny=%d\n\n",PosCasesJ1def[i][j].x,PosCasesJ1def[i][j].y);
- fclose(fichier4);
- }
- y+=50;
- }
- x+=50;
- }
- SDL_Rect PosCasesJ2[15][15]; //position que les pieces doivent prendre après dépose
- x = 133;
- for (i = 0 ; i < 15 ; i++)
- {
- y = 0;
- for (j = 0 ; j < 15 ; j++)
- {
- PosCasesJ2[i][j].x = x;
- PosCasesJ2[i][j].y = y;
- fichier6 = fopen("test6.txt", "a");
- if (fichier6 != NULL)
- {
- fseek(fichier6, 0, SEEK_END);
- fprintf(fichier6, "x=%d\ny=%d\n\n",PosCasesJ2[i][j].x,PosCasesJ2[i][j].y);
- fclose(fichier6);
- }
- y+=50;
- }
- x+=50;
- }
- SDL_Init(SDL_INIT_VIDEO);
- TTF_Init();
- if(TTF_Init() == -1)
- {
- fprintf(stderr, "Erreur d'initialisation de TTF_Init : %s\n", TTF_GetError());
- exit(EXIT_FAILURE);
- }
- //On ouvre une fenetre et on vérifie l'ouverture
- ecran = SDL_SetVideoMode(1066, 800, 32, SDL_HWSURFACE | SDL_DOUBLEBUF); //SDL_FULLSCREEN
- SDL_WM_SetCaption("Jeu dAVVA", NULL);
- if (ecran == NULL) // Si l'ouverture a échoué, on écrit l'erreur et on arrête
- {
- fprintf(stderr, "Impossible de charger le mode vidéo : %s\n", SDL_GetError());
- exit(EXIT_FAILURE);
- }
- /* Chargement de l'icone */
- SDL_WM_SetIcon(IMG_Load("images/JeuAVVA.bmp"), NULL);
- //On insere l'image de fond
- textureFond = IMG_Load("images/AvvAFond.jpg"); /* Chargement d'une image Bitmap dans une surface */
- positionFond.x = 0;
- positionFond.y = 0;
- //on insere l'icone de selection du menu
- selectMenu = IMG_Load("images/SelectionMenu.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posSelectMenu.x = 170;
- posSelectMenu.y = 200;
- SDL_SetColorKey(selectMenu, SDL_SRCCOLORKEY, SDL_MapRGB(selectMenu->format, 255, 255, 255));
- //On insere touche précédent1
- touchePre1 = IMG_Load("images/AvvaPrecedent.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionPre1.x = 540;
- positionPre1.y = 180;
- SDL_SetColorKey(touchePre1, SDL_SRCCOLORKEY, SDL_MapRGB(touchePre1->format, 255, 255, 255));
- //On insere touche suivante1
- toucheSui1 = IMG_Load("images/AvvaSuivant.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionSui1.x = 600;
- positionSui1.y = 180;
- SDL_SetColorKey(toucheSui1, SDL_SRCCOLORKEY, SDL_MapRGB(toucheSui1->format, 255, 255, 255));
- //On insere touche précédent2
- touchePre2 = IMG_Load("images/AvvaPrecedent.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionPre2.x = 540;
- positionPre2.y = 210;
- SDL_SetColorKey(touchePre2, SDL_SRCCOLORKEY, SDL_MapRGB(touchePre2->format, 255, 255, 255));
- //On insere touche suivante2
- toucheSui2 = IMG_Load("images/AvvaSuivant.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionSui2.x = 600;
- positionSui2.y = 210;
- SDL_SetColorKey(toucheSui2, SDL_SRCCOLORKEY, SDL_MapRGB(toucheSui2->format, 255, 255, 255));
- //On insere touche précédent3
- touchePre3 = IMG_Load("images/AvvaPrecedent.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionPre3.x = 540;
- positionPre3.y = 240;
- SDL_SetColorKey(touchePre3, SDL_SRCCOLORKEY, SDL_MapRGB(touchePre3->format, 255, 255, 255));
- //On insere touche suivante3
- toucheSui3 = IMG_Load("images/AvvaSuivant.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionSui3.x = 600;
- positionSui3.y = 240;
- SDL_SetColorKey(toucheSui3, SDL_SRCCOLORKEY, SDL_MapRGB(toucheSui3->format, 255, 255, 255));
- //On insere touche précédent4
- touchePre4 = IMG_Load("images/AvvaPrecedent.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionPre4.x = 540;
- positionPre4.y = 330;
- SDL_SetColorKey(touchePre4, SDL_SRCCOLORKEY, SDL_MapRGB(touchePre4->format, 255, 255, 255));
- //On insere touche suivante4
- toucheSui4 = IMG_Load("images/AvvaSuivant.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionSui4.x = 600;
- positionSui4.y = 330;
- SDL_SetColorKey(toucheSui4, SDL_SRCCOLORKEY, SDL_MapRGB(toucheSui4->format, 255, 255, 255));
- //On insere touche précédent5
- touchePre5 = IMG_Load("images/AvvaPrecedent.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionPre5.x = 540;
- positionPre5.y = 360;
- SDL_SetColorKey(touchePre5, SDL_SRCCOLORKEY, SDL_MapRGB(touchePre5->format, 255, 255, 255));
- //On insere touche suivante5
- toucheSui5 = IMG_Load("images/AvvaSuivant.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionSui5.x = 600;
- positionSui5.y = 360;
- SDL_SetColorKey(toucheSui5, SDL_SRCCOLORKEY, SDL_MapRGB(toucheSui5->format, 255, 255, 255));
- //On insere touche précédent6
- touchePre6 = IMG_Load("images/AvvaPrecedent.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionPre6.x = 540;
- positionPre6.y = 390;
- SDL_SetColorKey(touchePre6, SDL_SRCCOLORKEY, SDL_MapRGB(touchePre6->format, 255, 255, 255));
- //On insere touche suivante6
- toucheSui6 = IMG_Load("images/AvvaSuivant.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionSui6.x = 600;
- positionSui6.y = 390;
- SDL_SetColorKey(toucheSui6, SDL_SRCCOLORKEY, SDL_MapRGB(toucheSui6->format, 255, 255, 255));
- //On insere touche précédent7
- touchePre7 = IMG_Load("images/AvvaPrecedent.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionPre7.x = ecran->w / 2 - touchePre7->w / 2 - 20 ;
- positionPre7.y = 480;
- SDL_SetColorKey(touchePre7, SDL_SRCCOLORKEY, SDL_MapRGB(touchePre7->format, 255, 255, 255));
- //On insere touche suivante7
- toucheSui7 = IMG_Load("images/AvvaSuivant.bmp"); /* Chargement d'une image Bitmap dans une surface */
- positionSui7.x = ecran->w / 2 - toucheSui7->w / 2 + 20 ;
- positionSui7.y = 480;
- SDL_SetColorKey(toucheSui7, SDL_SRCCOLORKEY, SDL_MapRGB(toucheSui7->format, 255, 255, 255));
- /* Chargement du Titre PRINCIPALE = Jeu D'AVVA */
- police = TTF_OpenFont("polices/ALGER.TTF", 65);
- TTF_SetFontStyle(police, TTF_STYLE_UNDERLINE);
- menu = TTF_RenderText_Blended(police, "Jeu D'AVVA", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionMenu.x = ecran->w / 2 - menu->w / 2;
- positionMenu.y = 100;
- /* Chargement menu 1 = 1 Joueur */
- police = TTF_OpenFont("polices/ALGER.TTF", 35);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- menu1 = TTF_RenderText_Blended(police, "1 - 1 Joueur", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionMenu1.x = ecran->w / 2 - menu1->w / 2;
- positionMenu1.y = 200;
- //on insere le carre rouge de slection de piece//
- CubikRed = SDL_LoadBMP("images/CarreRouge.bmp");
- posCubikRed.x = 0;
- posCubikRed.y = 0;
- SDL_SetColorKey(CubikRed, SDL_SRCCOLORKEY, SDL_MapRGB(CubikRed->format, 255, 255, 255));
- /* Transparence Alpha moyenne (128) : */
- SDL_SetAlpha(CubikRed, SDL_SRCALPHA, 128);
- //on insere le carre rouge de slection de piece//
- CubikBlue = SDL_LoadBMP("images/CarreBleu.bmp");
- posCubikBlue.x = 0;
- posCubikBlue.y = 0;
- SDL_SetColorKey(CubikBlue, SDL_SRCCOLORKEY, SDL_MapRGB(CubikBlue->format, 255, 255, 255));
- /* Transparence Alpha moyenne (128) : */
- SDL_SetAlpha(CubikBlue, SDL_SRCALPHA, 128);
- //On insere touche suivante7
- txtDeplaNA = IMG_Load("images/DeplacementNA.JPG"); /* Chargement d'une image Bitmap dans une surface */
- posTxtDeplaNA.x = ecran->w / 2 - txtDeplaNA->w / 2;
- posTxtDeplaNA.y = 200;
- /*Chargement titre du sous menu 1joueur*/
- police = TTF_OpenFont("polices/ALGER.TTF", 50);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- ssMenu1 = TTF_RenderText_Blended(police, "1 JOUEUR", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionSsMenu1.x = ecran->w / 2 - ssMenu1->w / 2;
- positionSsMenu1.y = 100;
- //On insere l'image du damier de jeu
- damierInc800800NB = IMG_Load("images/Damier800x800DAM.bmp"); /* Chargement d'une image Bitmap dans une surface */
- posDamInc800800NB.x = ecran -> w / 2 - damierInc800800NB -> w / 2 ;
- posDamInc800800NB.y = 0;
- SDL_SetColorKey(damierInc800800NB, SDL_SRCCOLORKEY, SDL_MapRGB(damierInc800800NB->format, 255, 255, 255));
- //On insere l'image de fond étoile
- textureEtoile = IMG_Load("fond/etoile.jpg"); /* Chargement d'une image Bitmap dans une surface */
- positionEtoile.x = 0;
- positionEtoile.y = 0;
- //On insere l'image de fond plage
- texturePlage = IMG_Load("fond/plage.jpg"); /* Chargement d'une image Bitmap dans une surface */
- positionPlage.x = 0;
- positionPlage.y = 0;
- //On insere l'image de fond foret
- textureForet = IMG_Load("fond/foret.jpg"); /* Chargement d'une image Bitmap dans une surface */
- positionForet.x = 0;
- positionForet.y = 0;
- //On insere l'image de fond nuit
- textureNuit = IMG_Load("fond/ciel-nuit.jpg"); /* Chargement d'une image Bitmap dans une surface */
- positionNuit.x = 0;
- positionNuit.y = 0;
- //On insere l'image JOUEUR 1 COMMENCE
- textJ1Commence = IMG_Load("images/Joueur1Commence.JPG"); /* Chargement d'une image Bitmap dans une surface */
- posTxtJ1C.x = ecran -> w / 2 - textJ1Commence -> w / 2 ;
- posTxtJ1C.y = ecran -> h / 2 - textJ1Commence -> h / 2 ;
- //on insere la piece offensive NOIR du joueur1
- pieceJeuOff1N = IMG_Load("pieces/PieceJeuJ1/Noir/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceJOff1N1.x = 383;
- posPieceJOff1N1.y = 650;
- posPieceJOff1N2.x = 583;
- posPieceJOff1N2.y = 650;
- posPieceJOff1N3.x = 433;
- posPieceJOff1N3.y = 600;
- posPieceJOff1N4.x = 533;
- posPieceJOff1N4.y = 600;
- posPieceJOff1N5.x = 283;
- posPieceJOff1N5.y = 550;
- posPieceJOff1N6.x = 683;
- posPieceJOff1N6.y = 550;
- SDL_SetColorKey(pieceJeuOff1N, SDL_SRCCOLORKEY, SDL_MapRGB(pieceJeuOff1N->format, 255, 255, 255));
- //on insere la piece defensive NOIR du joueur1
- pieceJeuDef1N = IMG_Load("pieces/PieceJeuJ1/Noir/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceJDef1N1.x = 433;
- posPieceJDef1N1.y = 695;
- posPieceJDef1N2.x = 533;
- posPieceJDef1N2.y = 695;
- posPieceJDef1N3.x = 483;
- posPieceJDef1N3.y = 645;
- posPieceJDef1N4.x = 333;
- posPieceJDef1N4.y = 595;
- posPieceJDef1N5.x = 633;
- posPieceJDef1N5.y = 595;
- posPieceJDef1N6.x = 483;
- posPieceJDef1N6.y = 545;
- SDL_SetColorKey(pieceJeuDef1N, SDL_SRCCOLORKEY, SDL_MapRGB(pieceJeuDef1N->format, 255, 255, 255));
- //on insere la piece offensive Blanc du joueur2
- pieceJeuOff2N = IMG_Load("pieces/PieceJeuJ2/Blanc/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceJOff2N1.x = 383;
- posPieceJOff2N1.y = 100;
- posPieceJOff2N2.x = 583;
- posPieceJOff2N2.y = 100;
- posPieceJOff2N3.x = 433;
- posPieceJOff2N3.y = 150;
- posPieceJOff2N4.x = 533;
- posPieceJOff2N4.y = 150;
- posPieceJOff2N5.x = 283;
- posPieceJOff2N5.y = 200;
- posPieceJOff2N6.x = 683;
- posPieceJOff2N6.y = 200;
- SDL_SetColorKey(pieceJeuOff2N, SDL_SRCCOLORKEY, SDL_MapRGB(pieceJeuOff2N->format, 255, 255, 255));
- //on insere la piece defensive Blanc du joueur2
- pieceJeuDef2N = IMG_Load("pieces/PieceJeuJ2/Blanc/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceJDef2N1.x = 433;
- posPieceJDef2N1.y = 50;
- posPieceJDef2N2.x = 533;
- posPieceJDef2N2.y = 50;
- posPieceJDef2N3.x = 483;
- posPieceJDef2N3.y = 100;
- posPieceJDef2N4.x = 333;
- posPieceJDef2N4.y = 150;
- posPieceJDef2N5.x = 633;
- posPieceJDef2N5.y = 150;
- posPieceJDef2N6.x = 483;
- posPieceJDef2N6.y = 200;
- SDL_SetColorKey(pieceJeuDef2N, SDL_SRCCOLORKEY, SDL_MapRGB(pieceJeuDef2N->format, 255, 255, 255));
- /* Chargement du menu 2 - 2 joueurs */
- police = TTF_OpenFont("polices/ALGER.TTF", 35);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- menu2 = TTF_RenderText_Blended(police, "2 - 2 Joueurs", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionMenu2.x = ecran->w / 2 - menu2->w / 2;
- positionMenu2.y = 250;
- /*Chargement titre du sous menu 2joueur*/
- police = TTF_OpenFont("polices/ALGER.TTF", 50);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- ssMenu2 = TTF_RenderText_Blended(police, "2 JOUEURS", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionSsMenu2.x = ecran->w / 2 - ssMenu2->w / 2;
- positionSsMenu2.y = 100;
- /* Chargement menu 3 - Charger une partie */
- police = TTF_OpenFont("polices/ALGER.TTF", 35);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- menu3 = TTF_RenderText_Blended(police, "3 - Charger une partie", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionMenu3.x = ecran->w / 2 - menu3->w / 2;
- positionMenu3.y = 300;
- /*Chargement titre du sous menu 3 - charger une partie*/
- police = TTF_OpenFont("polices/ALGER.TTF", 50);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- ssMenu3 = TTF_RenderText_Blended(police, "Charger une partie", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionSsMenu3.x = ecran->w / 2 - ssMenu3->w / 2;
- positionSsMenu3.y = 100;
- /* Chargement menu 4 - revoir une partie */
- police = TTF_OpenFont("polices/ALGER.TTF", 35);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- menu4 = TTF_RenderText_Blended(police, "4 - Revoir une partie", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionMenu4.x = ecran->w / 2 - menu4->w / 2;
- positionMenu4.y = 350;
- /*Chargement titre du sous menu 4 - revoir une partie*/
- police = TTF_OpenFont("polices/ALGER.TTF", 50);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- ssMenu4 = TTF_RenderText_Blended(police, "Revoir une partie", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionSsMenu4.x = ecran->w / 2 - ssMenu4->w / 2;
- positionSsMenu4.y = 100;
- /* Chargement titre du sous menu 4 - Selectionner une partie a revoir */
- police = TTF_OpenFont("polices/TIMES.TTF", 15);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- texteSelect = TTF_RenderText_Blended(police, "Selectionner une partie à revoir", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- posTexteSelect.x = ecran->w / 2 - texteSelect->w / 2;
- posTexteSelect.y = 200;
- /* Chargement et du menu 5 - option */
- police = TTF_OpenFont("polices/ALGER.TTF", 35);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- menu5 = TTF_RenderText_Blended(police, "5 - Options", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionMenu5.x = ecran->w / 2 - menu5->w / 2;
- positionMenu5.y = 400;
- /* Chargement titre sous menu 5 - option */
- police = TTF_OpenFont("polices/ALGER.TTF", 50);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- ssMenu5 = TTF_RenderText_Blended(police, "Options", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionSsMenu5.x = ecran->w / 2 - ssMenu5->w / 2;
- positionSsMenu5.y = 100;
- /* Sous menu option/changer la couleur des pieces */
- police = TTF_OpenFont("polices/ALGER.TTF", 30);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- textureDamier = TTF_RenderText_Blended(police, "Changer la couleur des pieces", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionTextureD.x = ecran->w / 2 - textureDamier->w / 2;
- positionTextureD.y = 200;
- //on insere la piece offensive NOIR du joueur1
- pieceOff1N = IMG_Load("pieces/Joueur1/Noir/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff1N.x = 200;
- posPieceOff1N.y = 200;
- SDL_SetColorKey(pieceOff1N, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff1N->format, 255, 255, 255));
- //on insere la piece defensive NOIR du joueur1
- pieceDef1N = IMG_Load("pieces/Joueur1/Noir/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef1N.x = 350;
- posPieceDef1N.y = 193;
- SDL_SetColorKey(pieceDef1N, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef1N->format, 255, 255, 255));
- //on insere la piece offensive NOIR du joueur2
- pieceOff2N = IMG_Load("pieces/Joueur2/Noir/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff2N.x = 200;
- posPieceOff2N.y = 340;
- SDL_SetColorKey(pieceOff2N, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff2N->format, 255, 255, 255));
- //on insere la piece defensive NOIR du joueur2
- pieceDef2N = IMG_Load("pieces/Joueur2/Noir/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef2N.x = 350;
- posPieceDef2N.y = 340;
- SDL_SetColorKey(pieceDef2N, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef2N->format, 255, 255, 255));
- //on insere la piece offensive BLANC du joueur1
- pieceOff1B = IMG_Load("pieces/Joueur1/Blanc/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff1B.x = 200;
- posPieceOff1B.y = 200;
- SDL_SetColorKey(pieceOff1B, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff1B->format, 255, 255, 255));
- //on insere la piece defensive BLANC du joueur1
- pieceDef1B = IMG_Load("pieces/Joueur1/Blanc/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef1B.x = 350;
- posPieceDef1B.y = 193;
- SDL_SetColorKey(pieceDef1B, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef1B->format, 255, 255, 255));
- //on insere la piece offensive BLANC du joueur2
- pieceOff2B = IMG_Load("pieces/Joueur2/Blanc/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff2B.x = 200;
- posPieceOff2B.y = 340;
- SDL_SetColorKey(pieceOff2B, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff2B->format, 255, 255, 255));
- //on insere la piece defensive BLANC du joueur2
- pieceDef2B = IMG_Load("pieces/Joueur2/Blanc/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef2B.x = 350;
- posPieceDef2B.y = 340;
- SDL_SetColorKey(pieceDef2B, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef2B->format, 255, 255, 255));
- //on insere la piece offensive ROUGE du joueur1
- pieceOff1R = IMG_Load("pieces/Joueur1/Rouge/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff1R.x = 200;
- posPieceOff1R.y = 200;
- SDL_SetColorKey(pieceOff1R, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff1R->format, 255, 255, 255));
- //on insere la piece defensive ROUGE du joueur1
- pieceDef1R = IMG_Load("pieces/Joueur1/Rouge/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef1R.x = 350;
- posPieceDef1R.y = 193;
- SDL_SetColorKey(pieceDef1R, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef1R->format, 255, 255, 255));
- //on insere la piece offensive ROUGE du joueur2
- pieceOff2R = IMG_Load("pieces/Joueur2/Rouge/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff2R.x = 200;
- posPieceOff2R.y = 340;
- SDL_SetColorKey(pieceOff2R, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff2R->format, 255, 255, 255));
- //on insere la piece defensive ROUGE du joueur2
- pieceDef2R = IMG_Load("pieces/Joueur2/Rouge/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef2R.x = 350;
- posPieceDef2R.y = 340;
- SDL_SetColorKey(pieceDef2R, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef2R->format, 255, 255, 255));
- //on insere la piece offensive VERT du joueur1
- pieceOff1V = IMG_Load("pieces/Joueur1/Vert/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff1V.x = 200;
- posPieceOff1V.y = 200;
- SDL_SetColorKey(pieceOff1V, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff1V->format, 255, 255, 255));
- //on insere la piece defensive VERT du joueur1
- pieceDef1V = IMG_Load("pieces/Joueur1/Vert/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef1V.x = 350;
- posPieceDef1V.y = 193;
- SDL_SetColorKey(pieceDef1V, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef1V->format, 255, 255, 255));
- //on insere la piece offensive VERT du joueur2
- pieceOff2V = IMG_Load("pieces/Joueur2/Vert/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff2V.x = 200;
- posPieceOff2V.y = 340;
- SDL_SetColorKey(pieceOff2V, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff2V->format, 255, 255, 255));
- //on insere la piece defensive VERT du joueur2
- pieceDef2V = IMG_Load("pieces/Joueur2/Vert/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef2V.x = 350;
- posPieceDef2V.y = 340;
- SDL_SetColorKey(pieceDef2V, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef2V->format, 255, 255, 255));
- //on insere la piece offensive BLEU du joueur1
- pieceOff1Bl = IMG_Load("pieces/Joueur1/Bleu/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff1Bl.x = 200;
- posPieceOff1Bl.y = 200;
- SDL_SetColorKey(pieceOff1Bl, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff1Bl->format, 255, 255, 255));
- //on insere la piece defensive BLEU du joueur1
- pieceDef1Bl = IMG_Load("pieces/Joueur1/Bleu/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef1Bl.x = 350;
- posPieceDef1Bl.y = 193;
- SDL_SetColorKey(pieceDef1Bl, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef1Bl->format, 255, 255, 255));
- //on insere la piece offensive BLEU du joueur2
- pieceOff2Bl = IMG_Load("pieces/Joueur2/Bleu/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff2Bl.x = 200;
- posPieceOff2Bl.y = 340;
- SDL_SetColorKey(pieceOff2Bl, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff2Bl->format, 255, 255, 255));
- //on insere la piece defensive BLEU du joueur2
- pieceDef2Bl = IMG_Load("pieces/Joueur2/Bleu/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef2Bl.x = 350;
- posPieceDef2Bl.y = 340;
- SDL_SetColorKey(pieceDef2Bl, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef2Bl->format, 255, 255, 255));
- //on insere la piece offensive JAUNE du joueur1
- pieceOff1J = IMG_Load("pieces/Joueur1/Jaune/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff1J.x = 200;
- posPieceOff1J.y = 200;
- SDL_SetColorKey(pieceOff1J, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff1J->format, 255, 255, 255));
- //on insere la piece defensive JAUNE du joueur1
- pieceDef1J = IMG_Load("pieces/Joueur1/Jaune/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef1J.x = 350;
- posPieceDef1J.y = 193;
- SDL_SetColorKey(pieceDef1J, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef1J->format, 255, 255, 255));
- //on insere la piece offensive JAUNE du joueur2
- pieceOff2J = IMG_Load("pieces/Joueur2/Jaune/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff2J.x = 200;
- posPieceOff2J.y = 340;
- SDL_SetColorKey(pieceOff2J, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff2J->format, 255, 255, 255));
- //on insere la piece defensive JAUNE du joueur2
- pieceDef2J = IMG_Load("pieces/Joueur2/Jaune/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef2J.x = 350;
- posPieceDef2J.y = 340;
- SDL_SetColorKey(pieceDef2J, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef2J->format, 255, 255, 255));
- //on insere la piece offensive CYAN du joueur1
- pieceOff1C = IMG_Load("pieces/Joueur1/Cyan/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff1C.x = 200;
- posPieceOff1C.y = 200;
- SDL_SetColorKey(pieceOff1C, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff1C->format, 255, 255, 255));
- //on insere la piece defensive CYAN du joueur1
- pieceDef1C = IMG_Load("pieces/Joueur1/Cyan/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef1C.x = 350;
- posPieceDef1C.y = 193;
- SDL_SetColorKey(pieceDef1C, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef1C->format, 255, 255, 255));
- //on insere la piece offensive CYAN du joueur2
- pieceOff2C = IMG_Load("pieces/Joueur2/Cyan/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff2C.x = 200;
- posPieceOff2C.y = 340;
- SDL_SetColorKey(pieceOff2C, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff2C->format, 255, 255, 255));
- //on insere la piece defensive CYAN du joueur2
- pieceDef2C = IMG_Load("pieces/Joueur2/Cyan/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef2C.x = 350;
- posPieceDef2C.y = 340;
- SDL_SetColorKey(pieceDef2C, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef2C->format, 255, 255, 255));
- //on insere la piece offensive MAGENTA du joueur1
- pieceOff1M = IMG_Load("pieces/Joueur1/Magenta/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff1M.x = 200;
- posPieceOff1M.y = 200;
- SDL_SetColorKey(pieceOff1M, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff1M->format, 255, 255, 255));
- //on insere la piece defensive MAGENTA du joueur1
- pieceDef1M = IMG_Load("pieces/Joueur1/Magenta/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef1M.x = 350;
- posPieceDef1M.y = 193;
- SDL_SetColorKey(pieceDef1M, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef1M->format, 255, 255, 255));
- //on insere la piece offensive MAGENTA du joueur2
- pieceOff2M = IMG_Load("pieces/Joueur2/Magenta/pieceOff.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceOff2M.x = 200;
- posPieceOff2M.y = 340;
- SDL_SetColorKey(pieceOff2M, SDL_SRCCOLORKEY, SDL_MapRGB(pieceOff2M->format, 255, 255, 255));
- //on insere la piece defensive MAGENTA du joueur2
- pieceDef2M = IMG_Load("pieces/Joueur2/Magenta/pieceDef.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posPieceDef2M.x = 350;
- posPieceDef2M.y = 340;
- SDL_SetColorKey(pieceDef2M, SDL_SRCCOLORKEY, SDL_MapRGB(pieceDef2M->format, 255, 255, 255));
- //On insere le carreRouge1
- carreRouge1 = IMG_Load("images/carreRouge.JPG"); /* Chargement d'une image Bitmap dans une surface */
- posCarreRouge1.x = 570;
- posCarreRouge1.y = 185;
- //On insere le carreVert1
- carreVert1 = IMG_Load("images/carreVert.JPG"); /* Chargement d'une image Bitmap dans une surface */
- posCarreVert1.x = 570;
- posCarreVert1.y = 215;
- //On insere le carreBleu1
- carreBleu1 = IMG_Load("images/carreBleu.JPG"); /* Chargement d'une image Bitmap dans une surface */
- posCarreBleu1.x = 570;
- posCarreBleu1.y = 245;
- //On insere le carreRouge2
- carreRouge2 = IMG_Load("images/carreRouge.JPG"); /* Chargement d'une image Bitmap dans une surface */
- posCarreRouge2.x = 570;
- posCarreRouge2.y = 335;
- //On insere le carreVert2
- carreVert2 = IMG_Load("images/carreVert.JPG"); /* Chargement d'une image Bitmap dans une surface */
- posCarreVert2.x = 570;
- posCarreVert2.y = 365;
- //On insere le carreBleu2
- carreBleu2 = IMG_Load("images/carreBleu.JPG"); /* Chargement d'une image Bitmap dans une surface */
- posCarreBleu2.x = 570;
- posCarreBleu2.y = 395;
- //On insere le 0 rouge
- rouge0 = IMG_Load("images/rouge0.bmp"); /* Chargement d'une image Bitmap dans une surface */
- posRouge0A.x = 520;
- posRouge0A.y = 185;
- posRouge0B.x = 520;
- posRouge0B.y = 335;
- SDL_SetColorKey(rouge0, SDL_SRCCOLORKEY, SDL_MapRGB(rouge0->format, 255, 255, 255));
- //On insere le 1 rouge
- rouge1 = IMG_Load("images/rouge1.bmp"); /* Chargement d'une image Bitmap dans une surface */
- posRouge1A.x = 630;
- posRouge1A.y = 185;
- posRouge1B.x = 630;
- posRouge1B.y = 335;
- SDL_SetColorKey(rouge1, SDL_SRCCOLORKEY, SDL_MapRGB(rouge1->format, 255, 255, 255));
- //On insere le 0 vert
- vert0 = IMG_Load("images/vert0.bmp"); /* Chargement d'une image Bitmap dans une surface */
- posVert0A.x = 520;
- posVert0A.y = 215;
- posVert0B.x = 520;
- posVert0B.y = 365;
- SDL_SetColorKey(vert0, SDL_SRCCOLORKEY, SDL_MapRGB(vert0->format, 255, 255, 255));
- //On insere le 1 vert
- vert1 = IMG_Load("images/vert1.bmp"); /* Chargement d'une image Bitmap dans une surface */
- posVert1A.x = 630;
- posVert1A.y = 215;
- posVert1B.x = 630;
- posVert1B.y = 365;
- SDL_SetColorKey(vert1, SDL_SRCCOLORKEY, SDL_MapRGB(vert1->format, 255, 255, 255));
- //On insere le 0 bleu
- bleu0 = IMG_Load("images/bleu0.bmp"); /* Chargement d'une image Bitmap dans une surface */
- posBleu0A.x = 520;
- posBleu0A.y = 245;
- posBleu0B.x = 520;
- posBleu0B.y = 395;
- SDL_SetColorKey(bleu0, SDL_SRCCOLORKEY, SDL_MapRGB(bleu0->format, 255, 255, 255));
- //On insere le 1 bleu
- bleu1 = IMG_Load("images/bleu1.bmp"); /* Chargement d'une image Bitmap dans une surface */
- posBleu1A.x = 630;
- posBleu1A.y = 245;
- posBleu1B.x = 630;
- posBleu1B.y = 395;
- SDL_SetColorKey(bleu1, SDL_SRCCOLORKEY, SDL_MapRGB(bleu1->format, 255, 255, 255));
- /* Sous menu option/changer le fond */
- police = TTF_OpenFont("polices/ALGER.TTF", 30);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- textureDeFond = TTF_RenderText_Blended(police, "Changer la texture de fond", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionTextureF.x = ecran->w / 2 - textureDeFond->w / 2;
- positionTextureF.y = 250;
- /* Sous menu option/changer de fond Titre : texture */
- police = TTF_OpenFont("polices/ALGER.TTF", 35);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- txtTexture = TTF_RenderText_Blended(police, "Texture", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- posTxtTexture.x = ecran->w / 2 - txtTexture->w / 2;
- posTxtTexture.y = 100;
- //On insere l'image de fond dans le menu selection du fond
- textureDamFond = IMG_Load("fond/AvvA2.jpg"); /* Chargement d'une image Bitmap dans une surface */
- positionDamFond.x = ecran->w / 2 - textureDamFond->w / 2;
- positionDamFond.y = 150;
- //On insere l'image de fond étoile
- textureEtoile2 = IMG_Load("fond/etoile2.jpg"); /* Chargement d'une image Bitmap dans une surface */
- positionEtoile2.x = ecran->w / 2 - textureEtoile2->w / 2;
- positionEtoile2.y = 150;
- //On insere l'image de fond nuit
- textureNuit2 = IMG_Load("fond/ciel-nuit2.jpg"); /* Chargement d'une image Bitmap dans une surface */
- positionNuit2.x = ecran->w / 2 - textureNuit2->w / 2;
- positionNuit2.y = 150;
- //On insere l'image de fond plage
- texturePlage2 = IMG_Load("fond/plage2.jpg"); /* Chargement d'une image Bitmap dans une surface */
- positionPlage2.x = ecran->w / 2 - texturePlage2->w / 2;
- positionPlage2.y = 150;
- //On insere l'image de fond foret
- textureForet2 = IMG_Load("fond/Foret2.jpg"); /* Chargement d'une image Bitmap dans une surface */
- positionForet2.x = ecran->w / 2 - textureForet2->w / 2;
- positionForet2.y = 150;
- //on insere le damier incliner dans le menu option changer les fonds
- damierInc400400NB = IMG_Load("images/Damier400x400NB.bmp"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posDamInc400400VB.x = ecran->w / 2 - damierInc400400NB->w / 2;
- posDamInc400400VB.y = 170;
- SDL_SetColorKey(damierInc400400NB, SDL_SRCCOLORKEY, SDL_MapRGB(damierInc400400NB->format, 255, 255, 255));
- /* Sous menu option/Réglage du volume */
- police = TTF_OpenFont("polices/ALGER.TTF", 30);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- reglageVol = TTF_RenderText_Blended(police, "Reglage du volume", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionReglageV.x = ecran->w / 2 - reglageVol->w / 2;
- positionReglageV.y = 300;
- /* Sous menu option/ Titre :Réglage du volume */
- police = TTF_OpenFont("polices/ALGER.TTF", 30);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- txtRegDuVol = TTF_RenderText_Blended(police, "Reglage du volume", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- posTxtReglageV.x = ecran->w / 2 - txtRegDuVol->w / 2;
- posTxtReglageV.y = 100;
- //on insere l'icone barre du volume
- selectVolume = IMG_Load("images/barreVol.png"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posSelectVol.x = ecran ->w / 2 - selectVolume->w / 2 + 2;
- posSelectVol.y = 200;
- SDL_SetColorKey(selectVolume, SDL_SRCCOLORKEY, SDL_MapRGB(selectVolume->format, 255, 255, 255));
- //on insere l'icone bouton du volume
- selectBoutonVol = IMG_Load("images/boutonVol.png"); /* Chargement et blittage de l'icone de selection menu sur la scène */
- posBoutonVol.x = ecran ->w / 2 - selectBoutonVol->w / 2 ;
- posBoutonVol.y = 195;
- SDL_SetColorKey(selectBoutonVol, SDL_SRCCOLORKEY, SDL_MapRGB(selectBoutonVol->format, 255, 255, 255));
- /* Chargement du menu 6 - Règle du Jeu*/
- police = TTF_OpenFont("polices/ALGER.TTF", 35);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- menu6 = TTF_RenderText_Blended(police, "6 - Règle du jeu", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionMenu6.x = ecran->w / 2 - menu6->w / 2;
- positionMenu6.y = 450;
- /* Chargement du menu 6 - Règle du Jeu*/
- police = TTF_OpenFont("polices/ALGER.TTF", 35);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- ssMenu6 = TTF_RenderText_Blended(police, "Règle du jeu", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionSsMenu6.x = ecran->w / 2 - ssMenu6->w / 2;
- positionSsMenu6.y = 100;
- //On insere la regle du jeu 1
- regleJeu1 = IMG_Load("images/regles/regle1.bmp"); // Chargement d'une image Bitmap dans une surface //
- posRegleJeu1.x = ecran->w / 2 - regleJeu1->w / 2;
- posRegleJeu1.y = 150;
- //On insere la regle du jeu 2
- regleJeu2 = IMG_Load("images/regles/regle2.bmp"); // Chargement d'une image Bitmap dans une surface //
- posRegleJeu2.x = ecran->w / 2 - regleJeu2->w / 2;
- posRegleJeu2.y = 150;
- //On insere la regle du jeu 3
- regleJeu3 = IMG_Load("images/regles/regle3.bmp"); // Chargement d'une image Bitmap dans une surface //
- posRegleJeu3.x = ecran->w / 2 - regleJeu3->w / 2;
- posRegleJeu3.y = 150;
- //On insere la regle du jeu 4
- regleJeu4 = IMG_Load("images/regles/regle4.bmp"); // Chargement d'une image Bitmap dans une surface //
- posRegleJeu4.x = ecran->w / 2 - regleJeu4->w / 2;
- posRegleJeu4.y = 150;
- //On insere la regle du jeu 5
- regleJeu5 = IMG_Load("images/regles/regle5.bmp"); // Chargement d'une image Bitmap dans une surface //
- posRegleJeu5.x = ecran->w / 2 - regleJeu5->w / 2;
- posRegleJeu5.y = 150;
- //On insere la regle du jeu 6
- regleJeu6 = IMG_Load("images/regles/regle6.bmp"); // Chargement d'une image Bitmap dans une surface //
- posRegleJeu6.x = ecran->w / 2 - regleJeu6->w / 2;
- posRegleJeu6.y = 150;
- //On insere la regle du jeu 7
- regleJeu7 = IMG_Load("images/regles/regle7.bmp"); // Chargement d'une image Bitmap dans une surface //
- posRegleJeu7.x = ecran->w / 2 - regleJeu7->w / 2;
- posRegleJeu7.y = 150;
- /* Chargement du menu 7 - Exit*/
- police = TTF_OpenFont("polices/ALGER.TTF", 35);
- TTF_SetFontStyle(police,TTF_STYLE_NORMAL);
- menu7 = TTF_RenderText_Blended(police, "7 - Exit (or press esc)", couleurNoire);/* Ecriture du texte dans la SDL_Surface "texte" en mode Blended (optimal) */
- positionMenu7.x = ecran->w / 2 - menu7->w / 2;
- positionMenu7.y = 500;
- /* Activation de la répétition au clavier */
- SDL_EnableKeyRepeat(400, 5);
- while (continuer) /* TANT QUE la variable ne vaut pas 0, on répète la page du menu principale, continuer vaut 0 quand on fait echap ou "enter" sur "exit" du menu*/
- {
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_QUIT: /* Si c'est un évènement QUITTER - le croix dans le coin supérieur droit */
- continuer = 0; /* On met continuer à 0, donc la boucle va s'arrêter et le programme s'arrête*/
- break;
- case SDL_KEYDOWN:
- switch (event.key.keysym.sym)
- {
- case SDLK_ESCAPE: /* Appui sur la touche Echap, on arrête le programme */
- continuer = 0;
- break;
- case SDLK_UP: // Flèche haut
- if(posSelectMenu.y >=250)
- {
- posSelectMenu.y = posSelectMenu.y-50;
- break;
- }
- break;
- case SDLK_DOWN: // Flèche bas
- if (posSelectMenu.y <=450)
- {
- posSelectMenu.y = posSelectMenu.y+50;
- break;
- }
- break;
- case SDLK_RETURN: //Touche entrer
- while (continuer)
- {
- //quand le pointeur est sur 1 joueur
- if (posSelectMenu.y >=0 && posSelectMenu.y<250)
- {
- while (continuer1) /* TANT QUE la variable ne vaut pas 0 */
- {
- dragAndDrop = 1;
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_KEYDOWN:
- switch(event.key.keysym.sym)
- {
- case SDLK_ESCAPE: /* Appui sur la touche Echap, on arrête le programme */
- continuer1 = 0;
- default:
- break;
- }
- break;
- case SDL_MOUSEBUTTONDOWN:
- for(i=0 ; i<15 ; i++)
- {
- for(j=0 ; j<15 ; j++)
- {
- if (PosCasesJ1off[i][j].x == posPieceJOff1N1.x && PosCasesJ1off[i][j].y == posPieceJOff1N1.y)
- {
- a1=i;
- b1=j;
- }
- else if (PosCasesJ1off[i][j].x == posPieceJOff1N2.x && PosCasesJ1off[i][j].y == posPieceJOff1N2.y)
- {
- a2=i;
- b2=j;
- }
- else if (PosCasesJ1off[i][j].x == posPieceJOff1N3.x && PosCasesJ1off[i][j].y == posPieceJOff1N3.y)
- {
- a3=i;
- b3=j;
- }
- else if (PosCasesJ1off[i][j].x == posPieceJOff1N4.x && PosCasesJ1off[i][j].y == posPieceJOff1N4.y)
- {
- a4=i;
- b4=j;
- }
- else if (PosCasesJ1off[i][j].x == posPieceJOff1N5.x && PosCasesJ1off[i][j].y == posPieceJOff1N5.y)
- {
- a5=i;
- b5=j;
- }
- else if (PosCasesJ1off[i][j].x == posPieceJOff1N6.x && PosCasesJ1off[i][j].y == posPieceJOff1N6.y)
- {
- a6=i;
- b6=j;
- }
- else if (PosCasesJ1def[i][j].x == posPieceJDef1N1.x && PosCasesJ1def[i][j].y == posPieceJDef1N1.y)
- {
- c1=i;
- d1=j;
- }
- else if (PosCasesJ1def[i][j].x == posPieceJDef1N2.x && PosCasesJ1def[i][j].y == posPieceJDef1N2.y)
- {
- c2=i;
- d2=j;
- }
- else if (PosCasesJ1def[i][j].x == posPieceJDef1N3.x && PosCasesJ1def[i][j].y == posPieceJDef1N3.y)
- {
- c3=i;
- d3=j;
- }
- else if (PosCasesJ1def[i][j].x == posPieceJDef1N4.x && PosCasesJ1def[i][j].y == posPieceJDef1N4.y)
- {
- c4=i;
- d4=j;
- }
- else if (PosCasesJ1def[i][j].x == posPieceJDef1N5.x && PosCasesJ1def[i][j].y == posPieceJDef1N5.y)
- {
- c5=i;
- d5=j;
- }
- else if (PosCasesJ1def[i][j].x == posPieceJDef1N6.x && PosCasesJ1def[i][j].y == posPieceJDef1N6.y)
- {
- c6=i;
- d6=j;
- }
- else if (PosCasesJ2[i][j].x == posPieceJOff2N1.x && PosCasesJ2[i][j].y == posPieceJOff2N1.y)
- {
- e1=i;
- f1=j;
- }
- else if (PosCasesJ2[i][j].x == posPieceJOff2N2.x && PosCasesJ2[i][j].y == posPieceJOff2N2.y)
- {
- e2=i;
- f2=j;
- }
- else if (PosCasesJ2[i][j].x == posPieceJOff2N3.x && PosCasesJ2[i][j].y == posPieceJOff2N3.y)
- {
- e3=i;
- f3=j;
- }
- else if (PosCasesJ2[i][j].x == posPieceJOff2N4.x && PosCasesJ2[i][j].y == posPieceJOff2N4.y)
- {
- e4=i;
- f4=j;
- }
- else if (PosCasesJ2[i][j].x == posPieceJOff2N5.x && PosCasesJ2[i][j].y == posPieceJOff2N5.y)
- {
- e5=i;
- f5=j;
- }
- else if (PosCasesJ2[i][j].x == posPieceJOff2N6.x && PosCasesJ2[i][j].y == posPieceJOff2N6.y)
- {
- e6=i;
- f6=j;
- }
- else if (PosCasesJ2[i][j].x == posPieceJDef2N1.x && PosCasesJ2[i][j].y == posPieceJDef2N1.y)
- {
- g1=i;
- h1=j;
- }
- else if (PosCasesJ2[i][j].x == posPieceJDef2N2.x && PosCasesJ2[i][j].y == posPieceJDef2N2.y)
- {
- g2=i;
- h2=j;
- }
- else if (PosCasesJ2[i][j].x == posPieceJDef2N3.x && PosCasesJ2[i][j].y == posPieceJDef2N3.y)
- {
- g3=i;
- h3=j;
- }
- else if (PosCasesJ2[i][j].x == posPieceJDef2N4.x && PosCasesJ2[i][j].y == posPieceJDef2N4.y)
- {
- g4=i;
- h4=j;
- }
- else if (PosCasesJ2[i][j].x == posPieceJDef2N5.x && PosCasesJ2[i][j].y == posPieceJDef2N5.y)
- {
- g5=i;
- h5=j;
- }
- else if (PosCasesJ2[i][j].x == posPieceJDef2N6.x && PosCasesJ2[i][j].y == posPieceJDef2N6.y)
- {
- g6=i;
- h6=j;
- }
- }
- }
- if (event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[a1][b1].x && event.motion.x <= PointBas[a1][b1].x && event.motion.y >= PointMid[a1][b1].y && event.motion.y <= PointBas[a1][b1].y && posPieceJOff1N1.x == PosCasesJ1off[a1][b1].x && posPieceJOff1N1.y == PosCasesJ1off[a1][b1].y)
- //if (event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[5][12].x && event.motion.x <= PointBas[5][12].x && event.motion.y >= PointMid[5][12].y && event.motion.y <= PointBas[5][12].y && posPieceJOff1N1.x == PosCasesJ1off[5][12].x && posPieceJOff1N1.y == PosCasesJ1off[5][12].y)//
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJOff1N1.x;
- posCubikRed.x = posPieceX;
- posCubeX = posCubikRed.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJOff1N1.y;
- posCubikRed.y = posPieceY-50;
- posCubeY = posCubikRed.y;
- /*if(positionX > posPieceX && positionY == posPieceY)
- {
- posCubikRed.x = posCubikRed.x+100;
- posPieceJOff1N1.x = posPieceJOff1N1.x+100;
- }*/
- /*else*/ if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJOff1N1.x = posPieceJOff1N1.x+50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJOff1N1.y = posPieceJOff1N1.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJOff1N1.x = posPieceJOff1N1.x+50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJOff1N1.y = posPieceJOff1N1.y-50;
- }
- /*else if(positionX == posPieceX && positionY > posPieceY)
- {
- posCubikRed.y = posCubikRed.y+100;
- posPieceJOff1N1.y = posPieceJOff1N1.y+100;
- }
- else if(positionX == posPieceX && positionY < posPieceY)
- {
- posCubikRed.y = positionY-100;
- posPieceJOff1N1.y = positionY-100;
- }
- else if(positionX < posPieceX && positionY == posPieceY)
- {
- posCubikRed.x = posCubikRed.x-100;
- posPieceJOff1N1.x = posPieceJOff1N1.x-100;
- }*/
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJOff1N1.x = posPieceJOff1N1.x-50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJOff1N1.y = posPieceJOff1N1.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJOff1N1.x = posPieceJOff1N1.x-50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJOff1N1.y = posPieceJOff1N1.y+50;
- }
- /*posCubikRed.x = positionX-50;
- posPieceJOff1N1.x = positionX-50;
- posCubikRed.y = positionY-75;
- posPieceJOff1N1.y = positionY-25;*/
- //SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointBas[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointBas[i][j].y)
- {
- posPieceJOff1N1.x = PosCasesJ1off[i][j].x;
- posPieceJOff1N1.y = PosCasesJ1off[i][j].y;
- }
- }
- }
- //SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikRed, NULL, ecran, &posCubikRed);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[a2][b2].x && event.motion.x <= PointBas[a2][b2].x && event.motion.y >= PointMid[a2][b2].y && event.motion.y <= PointBas[a2][b2].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJOff1N2.x;
- posCubikRed.x = posPieceX;
- posCubeX = posCubikRed.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJOff1N2.y;
- posCubikRed.y = posPieceY-50;
- posCubeY = posCubikRed.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJOff1N2.x = posPieceJOff1N2.x+50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJOff1N2.y = posPieceJOff1N2.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJOff1N2.x = posPieceJOff1N2.x+50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJOff1N2.y = posPieceJOff1N2.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJOff1N2.x = posPieceJOff1N2.x-50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJOff1N2.y = posPieceJOff1N2.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJOff1N2.x = posPieceJOff1N2.x-50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJOff1N2.y = posPieceJOff1N2.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointBas[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointBas[i][j].y)
- {
- posPieceJOff1N2.x = PosCasesJ1off[i][j].x;
- posPieceJOff1N2.y = PosCasesJ1off[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikRed, NULL, ecran, &posCubikRed);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[a3][b3].x && event.motion.x <= PointBas[a3][b3].x && event.motion.y >= PointMid[a3][b3].y && event.motion.y <= PointBas[a3][b3].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJOff1N3.x;
- posCubikRed.x = posPieceX;
- posCubeX = posCubikRed.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJOff1N3.y;
- posCubikRed.y = posPieceY-50;
- posCubeY = posCubikRed.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJOff1N3.x = posPieceJOff1N3.x+50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJOff1N3.y = posPieceJOff1N3.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJOff1N3.x = posPieceJOff1N3.x+50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJOff1N3.y = posPieceJOff1N3.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJOff1N3.x = posPieceJOff1N3.x-50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJOff1N3.y = posPieceJOff1N3.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJOff1N3.x = posPieceJOff1N3.x-50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJOff1N3.y = posPieceJOff1N3.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointBas[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointBas[i][j].y)
- {
- posPieceJOff1N3.x = PosCasesJ1off[i][j].x;
- posPieceJOff1N3.y = PosCasesJ1off[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikRed, NULL, ecran, &posCubikRed);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[a4][b4].x && event.motion.x <= PointBas[a4][b4].x && event.motion.y >= PointMid[a4][b4].y && event.motion.y <= PointBas[a4][b4].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJOff1N4.x;
- posCubikRed.x = posPieceX;
- posCubeX = posCubikRed.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJOff1N4.y;
- posCubikRed.y = posPieceY-50;
- posCubeY = posCubikRed.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJOff1N4.x = posPieceJOff1N4.x+50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJOff1N4.y = posPieceJOff1N4.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJOff1N4.x = posPieceJOff1N4.x+50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJOff1N4.y = posPieceJOff1N4.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJOff1N4.x = posPieceJOff1N4.x-50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJOff1N4.y = posPieceJOff1N4.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJOff1N4.x = posPieceJOff1N4.x-50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJOff1N4.y = posPieceJOff1N4.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointBas[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointBas[i][j].y)
- {
- posPieceJOff1N4.x = PosCasesJ1off[i][j].x;
- posPieceJOff1N4.y = PosCasesJ1off[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikRed, NULL, ecran, &posCubikRed);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[a5][b5].x && event.motion.x <= PointBas[a5][b5].x && event.motion.y >= PointMid[a5][b5].y && event.motion.y <= PointBas[a5][b5].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJOff1N5.x;
- posCubikRed.x = posPieceX;
- posCubeX = posCubikRed.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJOff1N5.y;
- posCubikRed.y = posPieceY-50;
- posCubeY = posCubikRed.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJOff1N5.x = posPieceJOff1N5.x+50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJOff1N5.y = posPieceJOff1N5.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJOff1N5.x = posPieceJOff1N5.x+50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJOff1N5.y = posPieceJOff1N5.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJOff1N5.x = posPieceJOff1N5.x-50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJOff1N5.y = posPieceJOff1N5.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJOff1N5.x = posPieceJOff1N5.x-50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJOff1N5.y = posPieceJOff1N5.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointBas[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointBas[i][j].y)
- {
- posPieceJOff1N5.x = PosCasesJ1off[i][j].x;
- posPieceJOff1N5.y = PosCasesJ1off[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikRed, NULL, ecran, &posCubikRed);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[a6][b6].x && event.motion.x <= PointBas[a6][b6].x && event.motion.y >= PointMid[a6][b6].y && event.motion.y <= PointBas[a6][b6].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJOff1N6.x;
- posCubikRed.x = posPieceX;
- posCubeX = posCubikRed.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJOff1N6.y;
- posCubikRed.y = posPieceY-50;
- posCubeY = posCubikRed.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJOff1N6.x = posPieceJOff1N6.x+50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJOff1N6.y = posPieceJOff1N6.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJOff1N6.x = posPieceJOff1N6.x+50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJOff1N6.y = posPieceJOff1N6.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJOff1N6.x = posPieceJOff1N6.x-50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJOff1N6.y = posPieceJOff1N6.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJOff1N6.x = posPieceJOff1N6.x-50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJOff1N6.y = posPieceJOff1N6.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointBas[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointBas[i][j].y)
- {
- posPieceJOff1N6.x = PosCasesJ1off[i][j].x;
- posPieceJOff1N6.y = PosCasesJ1off[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikRed, NULL, ecran, &posCubikRed);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- //on passe au pieces defensive du joueur1
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[c1][d1].x && event.motion.x <= PointBas[c1][d1].x && event.motion.y >= PointMid[c1][d1].y && event.motion.y <= PointBas[c1][d1].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJDef1N1.x;
- posCubikRed.x = posPieceX;
- posCubeX = posCubikRed.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJDef1N1.y;
- posCubikRed.y = posPieceY-45;
- posCubeY = posCubikRed.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJDef1N1.x = posPieceJDef1N1.x+50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJDef1N1.y = posPieceJDef1N1.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJDef1N1.x = posPieceJDef1N1.x+50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJDef1N1.y = posPieceJDef1N1.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJDef1N1.x = posPieceJDef1N1.x-50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJDef1N1.y = posPieceJDef1N1.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJDef1N1.x = posPieceJDef1N1.x-50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJDef1N1.y = posPieceJDef1N1.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointBas[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointBas[i][j].y)
- {
- posPieceJDef1N1.x = PosCasesJ1def[i][j].x;
- posPieceJDef1N1.y = PosCasesJ1def[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikRed, NULL, ecran, &posCubikRed);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[c2][d2].x && event.motion.x <= PointBas[c2][d2].x && event.motion.y >= PointMid[c2][d2].y && event.motion.y <= PointBas[c2][d2].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJDef1N2.x;
- posCubikRed.x = posPieceX;
- posCubeX = posCubikRed.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJDef1N2.y;
- posCubikRed.y = posPieceY-45;
- posCubeY = posCubikRed.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJDef1N2.x = posPieceJDef1N2.x+50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJDef1N2.y = posPieceJDef1N2.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJDef1N2.x = posPieceJDef1N2.x+50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJDef1N2.y = posPieceJDef1N2.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJDef1N2.x = posPieceJDef1N2.x-50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJDef1N2.y = posPieceJDef1N2.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJDef1N2.x = posPieceJDef1N2.x-50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJDef1N2.y = posPieceJDef1N2.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointBas[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointBas[i][j].y)
- {
- posPieceJDef1N2.x = PosCasesJ1def[i][j].x;
- posPieceJDef1N2.y = PosCasesJ1def[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikRed, NULL, ecran, &posCubikRed);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[c3][d3].x && event.motion.x <= PointBas[c3][d3].x && event.motion.y >= PointMid[c3][d3].y && event.motion.y <= PointBas[c3][d3].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJDef1N3.x;
- posCubikRed.x = posPieceX;
- posCubeX = posCubikRed.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJDef1N3.y;
- posCubikRed.y = posPieceY-45;
- posCubeY = posCubikRed.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJDef1N3.x = posPieceJDef1N3.x+50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJDef1N3.y = posPieceJDef1N3.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJDef1N3.x = posPieceJDef1N3.x+50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJDef1N3.y = posPieceJDef1N3.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJDef1N3.x = posPieceJDef1N3.x-50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJDef1N3.y = posPieceJDef1N3.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJDef1N3.x = posPieceJDef1N3.x-50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJDef1N3.y = posPieceJDef1N3.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointBas[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointBas[i][j].y)
- {
- {
- posPieceJDef1N3.x = PosCasesJ1def[i][j].x;
- posPieceJDef1N3.y = PosCasesJ1def[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikRed, NULL, ecran, &posCubikRed);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[c4][d4].x && event.motion.x <= PointBas[c4][d4].x && event.motion.y >= PointMid[c4][d4].y && event.motion.y <= PointBas[c4][d4].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJDef1N4.x;
- posCubikRed.x = posPieceX;
- posCubeX = posCubikRed.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJDef1N4.y;
- posCubikRed.y = posPieceY-45;
- posCubeY = posCubikRed.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJDef1N4.x = posPieceJDef1N4.x+50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJDef1N4.y = posPieceJDef1N4.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJDef1N4.x = posPieceJDef1N4.x+50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJDef1N4.y = posPieceJDef1N4.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJDef1N4.x = posPieceJDef1N4.x-50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJDef1N4.y = posPieceJDef1N4.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJDef1N4.x = posPieceJDef1N4.x-50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJDef1N4.y = posPieceJDef1N4.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointBas[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointBas[i][j].y)
- {
- posPieceJDef1N4.x = PosCasesJ1def[i][j].x;
- posPieceJDef1N4.y = PosCasesJ1def[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikRed, NULL, ecran, &posCubikRed);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[c5][d5].x && event.motion.x <= PointBas[c5][d5].x && event.motion.y >= PointMid[c5][d5].y && event.motion.y <= PointBas[c5][d5].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJDef1N5.x;
- posCubikRed.x = posPieceX;
- posCubeX = posCubikRed.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJDef1N5.y;
- posCubikRed.y = posPieceY-45;
- posCubeY = posCubikRed.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJDef1N5.x = posPieceJDef1N5.x+50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJDef1N5.y = posPieceJDef1N5.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJDef1N5.x = posPieceJDef1N5.x+50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJDef1N5.y = posPieceJDef1N5.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJDef1N5.x = posPieceJDef1N5.x-50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJDef1N5.y = posPieceJDef1N5.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJDef1N5.x = posPieceJDef1N5.x-50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJDef1N5.y = posPieceJDef1N5.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointBas[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointBas[i][j].y)
- {
- posPieceJDef1N5.x = PosCasesJ1def[i][j].x;
- posPieceJDef1N5.y = PosCasesJ1def[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikRed, NULL, ecran, &posCubikRed);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[c6][d6].x && event.motion.x <= PointBas[c6][d6].x && event.motion.y >= PointMid[c6][d6].y && event.motion.y <= PointBas[c6][d6].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJDef1N6.x;
- posCubikRed.x = posPieceX;
- posCubeX = posCubikRed.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJDef1N6.y;
- posCubikRed.y = posPieceY-45;
- posCubeY = posCubikRed.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJDef1N6.x = posPieceJDef1N6.x+50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJDef1N6.y = posPieceJDef1N6.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x+50;
- posPieceJDef1N6.x = posPieceJDef1N6.x+50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJDef1N6.y = posPieceJDef1N6.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJDef1N6.x = posPieceJDef1N6.x-50;
- posCubikRed.y = posCubikRed.y-50;
- posPieceJDef1N6.y = posPieceJDef1N6.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikRed.x = posCubikRed.x-50;
- posPieceJDef1N6.x = posPieceJDef1N6.x-50;
- posCubikRed.y = posCubikRed.y+50;
- posPieceJDef1N6.y = posPieceJDef1N6.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointBas[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointBas[i][j].y)
- {
- posPieceJDef1N6.x = PosCasesJ1def[i][j].x;
- posPieceJDef1N6.y = PosCasesJ1def[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikRed, NULL, ecran, &posCubikRed);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- //on passe au pièces du joueur2
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[e1][f1].x && event.motion.x <= PointHaut[e1][f1].x && event.motion.y <= PointMid[e1][f1].y && event.motion.y >= PointHaut[e1][f1].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJOff2N1.x;
- posCubikBlue.x = posPieceX;
- posCubeX = posCubikBlue.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJOff2N1.y;
- posCubikBlue.y = posPieceY;
- posCubeY = posCubikBlue.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJOff2N1.x = posPieceJOff2N1.x+50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJOff2N1.y = posPieceJOff2N1.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJOff2N1.x = posPieceJOff2N1.x+50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJOff2N1.y = posPieceJOff2N1.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJOff2N1.x = posPieceJOff2N1.x-50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJOff2N1.y = posPieceJOff2N1.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJOff2N1.x = posPieceJOff2N1.x-50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJOff2N1.y = posPieceJOff2N1.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointHaut[i][j].x && event.motion.y <= PointMid[i][j].y && event.motion.y >= PointHaut[i][j].y)
- {
- posPieceJOff2N1.x = PosCasesJ2[i][j].x;
- posPieceJOff2N1.y = PosCasesJ2[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikBlue, NULL, ecran, &posCubikBlue);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[e2][f2].x && event.motion.x <= PointHaut[e2][f2].x && event.motion.y <= PointMid[e2][f2].y && event.motion.y >= PointHaut[e2][f2].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJOff2N2.x;
- posCubikBlue.x = posPieceX;
- posCubeX = posCubikBlue.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJOff2N2.y;
- posCubikBlue.y = posPieceY;
- posCubeY = posCubikBlue.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJOff2N2.x = posPieceJOff2N2.x+50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJOff2N2.y = posPieceJOff2N2.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJOff2N2.x = posPieceJOff2N2.x+50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJOff2N2.y = posPieceJOff2N2.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJOff2N2.x = posPieceJOff2N2.x-50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJOff2N2.y = posPieceJOff2N2.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJOff2N2.x = posPieceJOff2N2.x-50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJOff2N2.y = posPieceJOff2N2.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointHaut[i][j].x && event.motion.y <= PointMid[i][j].y && event.motion.y >= PointHaut[i][j].y)
- {
- posPieceJOff2N2.x = PosCasesJ2[i][j].x;
- posPieceJOff2N2.y = PosCasesJ2[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikBlue, NULL, ecran, &posCubikBlue);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[e3][f3].x && event.motion.x <= PointHaut[e3][f3].x && event.motion.y <= PointMid[e3][f3].y && event.motion.y >= PointHaut[e3][f3].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJOff2N3.x;
- posCubikBlue.x = posPieceX;
- posCubeX = posCubikBlue.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJOff2N3.y;
- posCubikBlue.y = posPieceY;
- posCubeY = posCubikBlue.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJOff2N3.x = posPieceJOff2N3.x+50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJOff2N3.y = posPieceJOff2N3.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJOff2N3.x = posPieceJOff2N3.x+50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJOff2N3.y = posPieceJOff2N3.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJOff2N3.x = posPieceJOff2N3.x-50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJOff2N3.y = posPieceJOff2N3.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJOff2N3.x = posPieceJOff2N3.x-50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJOff2N3.y = posPieceJOff2N3.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointHaut[i][j].x && event.motion.y <= PointMid[i][j].y && event.motion.y >= PointHaut[i][j].y)
- {
- posPieceJOff2N3.x = PosCasesJ2[i][j].x;
- posPieceJOff2N3.y = PosCasesJ2[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikBlue, NULL, ecran, &posCubikBlue);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[e4][f4].x && event.motion.x <= PointHaut[e4][f4].x && event.motion.y <= PointMid[e4][f4].y && event.motion.y >= PointHaut[e4][f4].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJOff2N4.x;
- posCubikBlue.x = posPieceX;
- posCubeX = posCubikBlue.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJOff2N4.y;
- posCubikBlue.y = posPieceY;
- posCubeY = posCubikBlue.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJOff2N4.x = posPieceJOff2N4.x+50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJOff2N4.y = posPieceJOff2N4.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJOff2N4.x = posPieceJOff2N4.x+50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJOff2N4.y = posPieceJOff2N4.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJOff2N4.x = posPieceJOff2N4.x-50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJOff2N4.y = posPieceJOff2N4.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJOff2N4.x = posPieceJOff2N4.x-50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJOff2N4.y = posPieceJOff2N4.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointHaut[i][j].x && event.motion.y <= PointMid[i][j].y && event.motion.y >= PointHaut[i][j].y)
- {
- posPieceJOff2N4.x = PosCasesJ2[i][j].x;
- posPieceJOff2N4.y = PosCasesJ2[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikBlue, NULL, ecran, &posCubikBlue);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[e5][f5].x && event.motion.x <= PointHaut[e5][f5].x && event.motion.y <= PointMid[e5][f5].y && event.motion.y >= PointHaut[e5][f5].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJOff2N5.x;
- posCubikBlue.x = posPieceX;
- posCubeX = posCubikBlue.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJOff2N5.y;
- posCubikBlue.y = posPieceY;
- posCubeY = posCubikBlue.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJOff2N5.x = posPieceJOff2N5.x+50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJOff2N5.y = posPieceJOff2N5.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJOff2N5.x = posPieceJOff2N5.x+50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJOff2N5.y = posPieceJOff2N5.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJOff2N5.x = posPieceJOff2N5.x-50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJOff2N5.y = posPieceJOff2N5.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJOff2N5.x = posPieceJOff2N5.x-50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJOff2N5.y = posPieceJOff2N5.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointHaut[i][j].x && event.motion.y <= PointMid[i][j].y && event.motion.y >= PointHaut[i][j].y)
- {
- posPieceJOff2N5.x = PosCasesJ2[i][j].x;
- posPieceJOff2N5.y = PosCasesJ2[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikBlue, NULL, ecran, &posCubikBlue);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[e6][f6].x && event.motion.x <= PointHaut[e6][f6].x && event.motion.y <= PointMid[e6][f6].y && event.motion.y >= PointHaut[e6][f6].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJOff2N6.x;
- posCubikBlue.x = posPieceX;
- posCubeX = posCubikBlue.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJOff2N6.y;
- posCubikBlue.y = posPieceY;
- posCubeY = posCubikBlue.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJOff2N6.x = posPieceJOff2N6.x+50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJOff2N6.y = posPieceJOff2N6.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJOff2N6.x = posPieceJOff2N6.x+50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJOff2N6.y = posPieceJOff2N6.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJOff2N6.x = posPieceJOff2N6.x-50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJOff2N6.y = posPieceJOff2N6.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJOff2N6.x = posPieceJOff2N6.x-50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJOff2N6.y = posPieceJOff2N6.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointHaut[i][j].x && event.motion.y <= PointMid[i][j].y && event.motion.y >= PointHaut[i][j].y)
- {
- posPieceJOff2N6.x = PosCasesJ2[i][j].x;
- posPieceJOff2N6.y = PosCasesJ2[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikBlue, NULL, ecran, &posCubikBlue);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- //on passe au piece defensive du joueur2//
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[g1][h1].x && event.motion.x <= PointHaut[g1][h1].x && event.motion.y <= PointMid[g1][h1].y && event.motion.y >= PointHaut[g1][h1].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJDef2N1.x;
- posCubikBlue.x = posPieceX;
- posCubeX = posCubikBlue.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJDef2N1.y;
- posCubikBlue.y = posPieceY;
- posCubeY = posCubikBlue.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJDef2N1.x = posPieceJDef2N1.x+50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJDef2N1.y = posPieceJDef2N1.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJDef2N1.x = posPieceJDef2N1.x+50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJDef2N1.y = posPieceJDef2N1.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJDef2N1.x = posPieceJDef2N1.x-50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJDef2N1.y = posPieceJDef2N1.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJDef2N1.x = posPieceJDef2N1.x-50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJDef2N1.y = posPieceJDef2N1.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointHaut[i][j].x && event.motion.y >= PointMid[i][j].y && event.motion.y <= PointHaut[i][j].y)
- {
- posPieceJDef2N1.x = PosCasesJ2[i][j].x;
- posPieceJDef2N1.y = PosCasesJ2[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikBlue, NULL, ecran, &posCubikBlue);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[g2][h2].x && event.motion.x <= PointHaut[g2][h2].x && event.motion.y <= PointMid[g2][h2].y && event.motion.y >= PointHaut[g2][h2].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJDef2N2.x;
- posCubikBlue.x = posPieceX;
- posCubeX = posCubikBlue.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJDef2N2.y;
- posCubikBlue.y = posPieceY;
- posCubeY = posCubikBlue.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJDef2N2.x = posPieceJDef2N2.x+50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJDef2N2.y = posPieceJDef2N2.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJDef2N2.x = posPieceJDef2N2.x+50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJDef2N2.y = posPieceJDef2N2.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJDef2N2.x = posPieceJDef2N2.x-50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJDef2N2.y = posPieceJDef2N2.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJDef2N2.x = posPieceJDef2N2.x-50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJDef2N2.y = posPieceJDef2N2.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointHaut[i][j].x && event.motion.y <= PointMid[i][j].y && event.motion.y >= PointHaut[i][j].y)
- {
- posPieceJDef2N2.x = PosCasesJ2[i][j].x;
- posPieceJDef2N2.y = PosCasesJ2[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikBlue, NULL, ecran, &posCubikBlue);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[g3][h3].x && event.motion.x <= PointHaut[g3][h3].x && event.motion.y <= PointMid[g3][h3].y && event.motion.y >= PointHaut[g3][h3].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJDef2N3.x;
- posCubikBlue.x = posPieceX;
- posCubeX = posCubikBlue.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJDef2N3.y;
- posCubikBlue.y = posPieceY;
- posCubeY = posCubikBlue.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJDef2N3.x = posPieceJDef2N3.x+50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJDef2N3.y = posPieceJDef2N3.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJDef2N3.x = posPieceJDef2N3.x+50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJDef2N3.y = posPieceJDef2N3.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJDef2N3.x = posPieceJDef2N3.x-50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJDef2N3.y = posPieceJDef2N3.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJDef2N3.x = posPieceJDef2N3.x-50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJDef2N3.y = posPieceJDef2N3.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointHaut[i][j].x && event.motion.y <= PointMid[i][j].y && event.motion.y >= PointHaut[i][j].y)
- {
- posPieceJDef2N3.x = PosCasesJ2[i][j].x;
- posPieceJDef2N3.y = PosCasesJ2[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikBlue, NULL, ecran, &posCubikBlue);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[g4][h4].x && event.motion.x <= PointHaut[g4][h4].x && event.motion.y <= PointMid[g4][h4].y && event.motion.y >= PointHaut[g4][h4].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJDef2N4.x;
- posCubikBlue.x = posPieceX;
- posCubeX = posCubikBlue.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJDef2N4.y;
- posCubikBlue.y = posPieceY;
- posCubeY = posCubikBlue.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJDef2N4.x = posPieceJDef2N4.x+50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJDef2N4.y = posPieceJDef2N4.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJDef2N4.x = posPieceJDef2N4.x+50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJDef2N4.y = posPieceJDef2N4.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJDef2N4.x = posPieceJDef2N4.x-50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJDef2N4.y = posPieceJDef2N4.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJDef2N4.x = posPieceJDef2N4.x-50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJDef2N4.y = posPieceJDef2N4.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointHaut[i][j].x && event.motion.y <= PointMid[i][j].y && event.motion.y >= PointHaut[i][j].y)
- {
- posPieceJDef2N4.x = PosCasesJ2[i][j].x;
- posPieceJDef2N4.y = PosCasesJ2[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikBlue, NULL, ecran, &posCubikBlue);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[g5][h5].x && event.motion.x <= PointHaut[g5][h5].x && event.motion.y <= PointMid[g5][h5].y && event.motion.y >= PointHaut[g5][h5].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJDef2N5.x;
- posCubikBlue.x = posPieceX;
- posCubeX = posCubikBlue.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJDef2N5.y;
- posCubikBlue.y = posPieceY;
- posCubeY = posCubikBlue.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJDef2N5.x = posPieceJDef2N5.x+50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJDef2N5.y = posPieceJDef2N5.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJDef2N5.x = posPieceJDef2N5.x+50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJDef2N5.y = posPieceJDef2N5.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJDef2N5.x = posPieceJDef2N5.x-50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJDef2N5.y = posPieceJDef2N5.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJDef2N5.x = posPieceJDef2N5.x-50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJDef2N5.y = posPieceJDef2N5.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointHaut[i][j].x && event.motion.y <= PointMid[i][j].y && event.motion.y >= PointHaut[i][j].y)
- {
- posPieceJDef2N5.x = PosCasesJ2[i][j].x;
- posPieceJDef2N5.y = PosCasesJ2[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikBlue, NULL, ecran, &posCubikBlue);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- else if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[g6][h6].x && event.motion.x <= PointHaut[g6][h6].x && event.motion.y <= PointMid[g6][h6].y && event.motion.y >= PointHaut[g6][h6].y)
- {
- while (dragAndDrop)
- {
- positionX = event.motion.x; /* On change les coordonnées de la piece */
- posPieceX = posPieceJDef2N6.x;
- posCubikBlue.x = posPieceX;
- posCubeX = posCubikBlue.x;
- positionY = event.motion.y; /* On change les coordonnées de la piece */
- posPieceY = posPieceJDef2N6.y;
- posCubikBlue.y = posPieceY;
- posCubeY = posCubikBlue.y;
- if(positionX-25 > posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJDef2N6.x = posPieceJDef2N6.x+50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJDef2N6.y = posPieceJDef2N6.y+50;
- }
- else if(positionX-25 > posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x+50;
- posPieceJDef2N6.x = posPieceJDef2N6.x+50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJDef2N6.y = posPieceJDef2N6.y-50;
- }
- else if(positionX-25 < posPieceX && positionY+25 < posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJDef2N6.x = posPieceJDef2N6.x-50;
- posCubikBlue.y = posCubikBlue.y-50;
- posPieceJDef2N6.y = posPieceJDef2N6.y-50;
- }
- else if(positionX-25 < posPieceX && positionY-25 > posPieceY)
- {
- posCubikBlue.x = posCubikBlue.x-50;
- posPieceJDef2N6.x = posPieceJDef2N6.x-50;
- posCubikBlue.y = posCubikBlue.y+50;
- posPieceJDef2N6.y = posPieceJDef2N6.y+50;
- }
- SDL_ShowCursor(SDL_DISABLE);
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_MOUSEBUTTONUP:
- for(j=0 ; j<=15 ; j++)
- {
- for (i=0 ; i<=15 ; i++)
- {
- if(event.button.button == SDL_BUTTON_LEFT && event.motion.x >= PointMid[i][j].x && event.motion.x <= PointHaut[i][j].x && event.motion.y <= PointMid[i][j].y && event.motion.y >= PointHaut[i][j].y)
- {
- posPieceJDef2N6.x = PosCasesJ2[i][j].x;
- posPieceJDef2N6.y = PosCasesJ2[i][j].y;
- }
- }
- }
- SDL_ShowCursor(SDL_ENABLE);
- dragAndDrop = 0;
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(CubikBlue, NULL, ecran, &posCubikBlue);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- }
- //default:
- //break;
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- switch (compteurFond)
- {
- case 0:
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- break;
- case 1:
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- break;
- case 2:
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet);
- break;
- case 3:
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage);
- break;
- case 4:
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- break;
- default:
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- break;
- }
- if(compteurDebut == 0)
- {
- SDL_BlitSurface(textJ1Commence, NULL, ecran, &PointMid[3][3]);
- compteurDebut--;
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- //quand le pointeur est sur le menu 2 joueurs
- else if (posSelectMenu.y >=250 && posSelectMenu.y<300)
- {
- while (continuer1) /* TANT QUE la variable ne vaut pas 0 */
- {
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_KEYDOWN:
- switch(event.key.keysym.sym)
- {
- case SDLK_ESCAPE: /* Appui sur la touche Echap, on arrête le programme */
- continuer1 = 0;
- default:
- break;
- }
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage); /* On blitte par-dessus l'écran le fond */
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N1);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N2);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N3);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- break;
- }
- //quand le pointeur est sur le menu 2 joueurs
- else if (posSelectMenu.y >=250 && posSelectMenu.y<300)
- {
- while (continuer1) /* TANT QUE la variable ne vaut pas 0 */
- {
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_KEYDOWN:
- switch(event.key.keysym.sym)
- {
- case SDLK_ESCAPE: /* Appui sur la touche Echap, on arrête le programme */
- continuer1 = 0;
- default:
- break;
- }
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- if(compteurFond == 0)
- {
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 1)
- {
- SDL_BlitSurface(textureEtoile, NULL, ecran, &positionEtoile); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 2)
- {
- SDL_BlitSurface(textureForet, NULL, ecran, &positionForet); /* On blitte par-dessus l'écran le fond */
- }
- else if(compteurFond == 3)
- {
- SDL_BlitSurface(texturePlage, NULL, ecran, &positionPlage); /* On blitte par-dessus l'écran le fond */
- }
- else
- {
- SDL_BlitSurface(textureNuit, NULL, ecran, &positionNuit); /* On blitte par-dessus l'écran le fond */
- }
- SDL_BlitSurface(damierInc800800NB, NULL, ecran, &posDamInc800800NB);/* On blitte par-dessus l'écran un damier */
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N5);
- SDL_BlitSurface(pieceJeuOff1N, NULL, ecran, &posPieceJOff1N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N4);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N5);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJDef1N6);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N1);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N2);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N3);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N4);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N5);
- SDL_BlitSurface(pieceJeuOff2N, NULL, ecran, &posPieceJOff2N6);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJOff1N1);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJOff1N2);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJOff1N3);
- SDL_BlitSurface(pieceJeuDef1N, NULL, ecran, &posPieceJOff1N4);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N5);
- SDL_BlitSurface(pieceJeuDef2N, NULL, ecran, &posPieceJDef2N6);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- //quand le pointeur est sur le menu charger une partie
- else if (posSelectMenu.y >=300 && posSelectMenu.y<350)
- {
- posSelectMenu.x = 170;
- posSelectMenu.y = 200;
- while (continuer1) /* TANT QUE la variable ne vaut pas 0 */
- {
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_KEYDOWN:
- switch (event.key.keysym.sym)
- {
- case SDLK_ESCAPE: /* Appui sur la touche Echap, on arrête le programme */
- continuer1 = 0;
- break;
- case SDLK_UP: // Flèche haut
- if(posSelectMenu.y >=250)
- {
- posSelectMenu.y = posSelectMenu.y-50;
- break;
- }
- break;
- case SDLK_DOWN: // Flèche bas
- if (posSelectMenu.y <=350)
- {
- posSelectMenu.y = posSelectMenu.y+50;
- break;
- }
- default:
- break;
- }
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran */
- SDL_BlitSurface(selectMenu, NULL, ecran, &posSelectMenu);/* On blitte par-dessus l'écran */
- SDL_BlitSurface(ssMenu3, NULL, ecran, &positionSsMenu3); /* Blit du texte charger une partie par-dessus */
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- //quand le pointeur est sur le menu revoir une partie
- else if (posSelectMenu.y >=350 && posSelectMenu.y<400)
- {
- posSelectMenu.x = 170;
- posSelectMenu.y = 250;
- while (continuer1) /* TANT QUE la variable ne vaut pas 0 */
- {
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_KEYDOWN:
- switch (event.key.keysym.sym)
- {
- case SDLK_ESCAPE: /* Appui sur la touche Echap, on arrête le programme */
- continuer1 = 0;
- break;
- case SDLK_UP: // Flèche haut
- if(posSelectMenu.y >=300)
- {
- posSelectMenu.y = posSelectMenu.y-50;
- break;
- }
- default:
- break;
- case SDLK_DOWN: // Flèche bas
- if (posSelectMenu.y <=400)
- {
- posSelectMenu.y = posSelectMenu.y+50;
- break;
- }
- break;
- }
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran */
- SDL_BlitSurface(selectMenu, NULL, ecran, &posSelectMenu);/* On blitte par-dessus l'écran */
- SDL_BlitSurface(ssMenu4, NULL, ecran, &positionSsMenu4); /* Blit du texte revoir une partie par-dessus */
- SDL_BlitSurface(texteSelect, NULL, ecran, &posTexteSelect);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- //quand le pointeur est sur le menu sur option
- else if (posSelectMenu.y >=400 && posSelectMenu.y<450)
- {
- posSelectMenu.x = 120;
- posSelectMenu.y = 200;
- while (continuer1) /* TANT QUE la variable ne vaut pas 0 */
- {
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_KEYDOWN:
- switch (event.key.keysym.sym)
- {
- case SDLK_ESCAPE: /* Appui sur la touche Echap, on arrête le programme */
- continuer1 = 0;
- break;
- case SDLK_UP: // Flèche haut
- if(posSelectMenu.y >=250)
- {
- posSelectMenu.y = posSelectMenu.y-50;
- break;
- }
- break;
- case SDLK_DOWN: // Flèche bas
- if (posSelectMenu.y <=250)
- {
- posSelectMenu.y = posSelectMenu.y+50;
- break;
- }
- break;
- case SDLK_RETURN: //on rentre dans le menu Option si on appuie sur ENTRER
- while (continuer2) /* TANT QUE la variable ne vaut pas 0 */
- {
- //Option - réglage des couleurs des pieces
- if(posSelectMenu.y >=200 && (posSelectMenu.y <250))
- {
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_KEYDOWN:
- switch(event.key.keysym.sym)
- {
- case SDLK_ESCAPE: /* Appui sur la touche Echap, on arrête le programme */
- continuer2 = 0;
- default:
- break;
- }
- break;
- case SDL_MOUSEBUTTONUP:
- if(event.button.x>=540 && event.button.x<=568 && event.button.y>=180 && event.button.y<=198 && event.button.button == SDL_BUTTON_LEFT && comptR1 > 0)
- {
- comptR1--;
- break;
- }
- else if(event.button.x>=600 && event.button.x<=628 && event.button.y>=180 && event.button.y<=198 && event.button.button == SDL_BUTTON_LEFT && comptR1 < 1)
- {
- comptR1++;
- break;
- }
- else if(event.button.x>=540 && event.button.x<=568 && event.button.y>=210 && event.button.y<=228 && event.button.button == SDL_BUTTON_LEFT && comptV1 > 0)
- {
- comptV1--;
- break;
- }
- else if(event.button.x>=600 && event.button.x<=628 && event.button.y>=210 && event.button.y<=228 && event.button.button == SDL_BUTTON_LEFT && comptV1 < 1)
- {
- comptV1++;
- break;
- }
- else if(event.button.x>=540 && event.button.x<=568 && event.button.y>=240 && event.button.y<=258 && event.button.button == SDL_BUTTON_LEFT && comptB1 > 0)
- {
- comptB1--;
- break;
- }
- else if(event.button.x>=600 && event.button.x<=628 && event.button.y>=240 && event.button.y<=258 && event.button.button == SDL_BUTTON_LEFT && comptB1 < 1)
- {
- comptB1++;
- break;
- }
- else if(event.button.x>=540 && event.button.x<=568 && event.button.y>=330 && event.button.y<=348 && event.button.button == SDL_BUTTON_LEFT && comptR2 > 0)
- {
- comptR2--;
- break;
- }
- else if(event.button.x>=600 && event.button.x<=628 && event.button.y>=330 && event.button.y<=348 && event.button.button == SDL_BUTTON_LEFT && comptR2 < 1)
- {
- comptR2++;
- break;
- }
- else if(event.button.x>=540 && event.button.x<=568 && event.button.y>=360 && event.button.y<=378 && event.button.button == SDL_BUTTON_LEFT && comptV2 > 0)
- {
- comptV2--;
- break;
- }
- else if(event.button.x>=600 && event.button.x<=628 && event.button.y>=360 && event.button.y<=378 && event.button.button == SDL_BUTTON_LEFT && comptV2 < 1)
- {
- comptV2++;
- break;
- }
- else if(event.button.x>=540 && event.button.x<=568 && event.button.y>=390 && event.button.y<=408 && event.button.button == SDL_BUTTON_LEFT && comptB2 > 0)
- {
- comptB2--;
- break;
- }
- else if(event.button.x>=600 && event.button.x<=628 && event.button.y>=390 && event.button.y<=408 && event.button.button == SDL_BUTTON_LEFT && comptB2 < 1)
- {
- comptB2++;
- break;
- }
- else
- {
- break;
- }
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran*/
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran */
- SDL_BlitSurface(touchePre1, NULL, ecran, &positionPre1);
- SDL_BlitSurface(toucheSui1, NULL, ecran, &positionSui1);
- SDL_BlitSurface(touchePre2, NULL, ecran, &positionPre2);
- SDL_BlitSurface(toucheSui2, NULL, ecran, &positionSui2);
- SDL_BlitSurface(touchePre3, NULL, ecran, &positionPre3);
- SDL_BlitSurface(toucheSui3, NULL, ecran, &positionSui3);
- SDL_BlitSurface(touchePre4, NULL, ecran, &positionPre4);
- SDL_BlitSurface(toucheSui4, NULL, ecran, &positionSui4);
- SDL_BlitSurface(touchePre5, NULL, ecran, &positionPre5);
- SDL_BlitSurface(toucheSui5, NULL, ecran, &positionSui5);
- SDL_BlitSurface(touchePre6, NULL, ecran, &positionPre6);
- SDL_BlitSurface(toucheSui6, NULL, ecran, &positionSui6);
- SDL_BlitSurface(carreRouge1, NULL, ecran, &posCarreRouge1);
- SDL_BlitSurface(carreVert1, NULL, ecran, &posCarreVert1);
- SDL_BlitSurface(carreBleu1, NULL, ecran, &posCarreBleu1);
- SDL_BlitSurface(carreRouge2, NULL, ecran, &posCarreRouge2);
- SDL_BlitSurface(carreVert2, NULL, ecran, &posCarreVert2);
- SDL_BlitSurface(carreBleu2, NULL, ecran, &posCarreBleu2);
- if (comptR1 == 0 && comptV1 == 0 && comptB1 == 0 && comptR2 == 0 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1N, NULL, ecran, &posPieceOff1N);
- SDL_BlitSurface(pieceDef1N, NULL, ecran, &posPieceDef1N);
- SDL_BlitSurface(pieceOff2N, NULL, ecran, &posPieceOff2N);
- SDL_BlitSurface(pieceDef2N, NULL, ecran, &posPieceDef2N);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 0 && comptR2 == 1 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1N, NULL, ecran, &posPieceOff1N);
- SDL_BlitSurface(pieceDef1N, NULL, ecran, &posPieceDef1N);
- SDL_BlitSurface(pieceOff2B, NULL, ecran, &posPieceOff2B);
- SDL_BlitSurface(pieceDef2B, NULL, ecran, &posPieceDef2B);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 0 && comptR2 == 1 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1N, NULL, ecran, &posPieceOff1N);
- SDL_BlitSurface(pieceDef1N, NULL, ecran, &posPieceDef1N);
- SDL_BlitSurface(pieceOff2R, NULL, ecran, &posPieceOff2R);
- SDL_BlitSurface(pieceDef2R, NULL, ecran, &posPieceDef2R);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 0 && comptR2 == 0 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1N, NULL, ecran, &posPieceOff1N);
- SDL_BlitSurface(pieceDef1N, NULL, ecran, &posPieceDef1N);
- SDL_BlitSurface(pieceOff2V, NULL, ecran, &posPieceOff2V);
- SDL_BlitSurface(pieceDef2V, NULL, ecran, &posPieceDef2V);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 0 && comptR2 == 0 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1N, NULL, ecran, &posPieceOff1N);
- SDL_BlitSurface(pieceDef1N, NULL, ecran, &posPieceDef1N);
- SDL_BlitSurface(pieceOff2Bl, NULL, ecran, &posPieceOff2Bl);
- SDL_BlitSurface(pieceDef2Bl, NULL, ecran, &posPieceDef2Bl);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 0 && comptR2 == 1 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1N, NULL, ecran, &posPieceOff1N);
- SDL_BlitSurface(pieceDef1N, NULL, ecran, &posPieceDef1N);
- SDL_BlitSurface(pieceOff2J, NULL, ecran, &posPieceOff2J);
- SDL_BlitSurface(pieceDef2J, NULL, ecran, &posPieceDef2J);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 0 && comptR2 == 0 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1N, NULL, ecran, &posPieceOff1N);
- SDL_BlitSurface(pieceDef1N, NULL, ecran, &posPieceDef1N);
- SDL_BlitSurface(pieceOff2C, NULL, ecran, &posPieceOff2C);
- SDL_BlitSurface(pieceDef2C, NULL, ecran, &posPieceDef2C);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 0 && comptR2 == 1 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1N, NULL, ecran, &posPieceOff1N);
- SDL_BlitSurface(pieceDef1N, NULL, ecran, &posPieceDef1N);
- SDL_BlitSurface(pieceOff2M, NULL, ecran, &posPieceOff2M);
- SDL_BlitSurface(pieceDef2M, NULL, ecran, &posPieceDef2M);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 1 && comptR2 == 0 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1B, NULL, ecran, &posPieceOff1B);
- SDL_BlitSurface(pieceDef1B, NULL, ecran, &posPieceDef1B);
- SDL_BlitSurface(pieceOff2N, NULL, ecran, &posPieceOff2N);
- SDL_BlitSurface(pieceDef2N, NULL, ecran, &posPieceDef2N);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 1 && comptR2 == 1 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1B, NULL, ecran, &posPieceOff1B);
- SDL_BlitSurface(pieceDef1B, NULL, ecran, &posPieceDef1B);
- SDL_BlitSurface(pieceOff2B, NULL, ecran, &posPieceOff2B);
- SDL_BlitSurface(pieceDef2B, NULL, ecran, &posPieceDef2B);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 ==1 && comptR2 == 1 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1B, NULL, ecran, &posPieceOff1B);
- SDL_BlitSurface(pieceDef1B, NULL, ecran, &posPieceDef1B);
- SDL_BlitSurface(pieceOff2R, NULL, ecran, &posPieceOff2R);
- SDL_BlitSurface(pieceDef2R, NULL, ecran, &posPieceDef2R);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 1 && comptR2 == 0 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1B, NULL, ecran, &posPieceOff1B);
- SDL_BlitSurface(pieceDef1B, NULL, ecran, &posPieceDef1B);
- SDL_BlitSurface(pieceOff2V, NULL, ecran, &posPieceOff2V);
- SDL_BlitSurface(pieceDef2V, NULL, ecran, &posPieceDef2V);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 1 && comptR2 == 0 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1B, NULL, ecran, &posPieceOff1B);
- SDL_BlitSurface(pieceDef1B, NULL, ecran, &posPieceDef1B);
- SDL_BlitSurface(pieceOff1Bl, NULL, ecran, &posPieceOff1Bl);
- SDL_BlitSurface(pieceDef1Bl, NULL, ecran, &posPieceDef1Bl);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 1 && comptR2 == 1 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1B, NULL, ecran, &posPieceOff1B);
- SDL_BlitSurface(pieceDef1B, NULL, ecran, &posPieceDef1B);
- SDL_BlitSurface(pieceOff2J, NULL, ecran, &posPieceOff2J);
- SDL_BlitSurface(pieceDef2J, NULL, ecran, &posPieceDef2J);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 1 && comptR2 == 0 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1B, NULL, ecran, &posPieceOff1B);
- SDL_BlitSurface(pieceDef1B, NULL, ecran, &posPieceDef1B);
- SDL_BlitSurface(pieceOff2C, NULL, ecran, &posPieceOff2C);
- SDL_BlitSurface(pieceDef2C, NULL, ecran, &posPieceDef2C);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 1 && comptR2 == 1 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1B, NULL, ecran, &posPieceOff1B);
- SDL_BlitSurface(pieceDef1B, NULL, ecran, &posPieceDef1B);
- SDL_BlitSurface(pieceOff2M, NULL, ecran, &posPieceOff2M);
- SDL_BlitSurface(pieceDef2M, NULL, ecran, &posPieceDef2M);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 0 && comptR2 == 0 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1R, NULL, ecran, &posPieceOff1R);
- SDL_BlitSurface(pieceDef1R, NULL, ecran, &posPieceDef1R);
- SDL_BlitSurface(pieceOff2N, NULL, ecran, &posPieceOff2N);
- SDL_BlitSurface(pieceDef2N, NULL, ecran, &posPieceDef2N);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 0 && comptR2 == 1 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1R, NULL, ecran, &posPieceOff1R);
- SDL_BlitSurface(pieceDef1R, NULL, ecran, &posPieceDef1R);
- SDL_BlitSurface(pieceOff2B, NULL, ecran, &posPieceOff2B);
- SDL_BlitSurface(pieceDef2B, NULL, ecran, &posPieceDef2B);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 0 && comptR2 == 1 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1R, NULL, ecran, &posPieceOff1R);
- SDL_BlitSurface(pieceDef1R, NULL, ecran, &posPieceDef1R);
- SDL_BlitSurface(pieceOff2R, NULL, ecran, &posPieceOff2R);
- SDL_BlitSurface(pieceDef2R, NULL, ecran, &posPieceDef2R);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 0 && comptR2 == 0 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1R, NULL, ecran, &posPieceOff1R);
- SDL_BlitSurface(pieceDef1R, NULL, ecran, &posPieceDef1R);
- SDL_BlitSurface(pieceOff2V, NULL, ecran, &posPieceOff2V);
- SDL_BlitSurface(pieceDef2V, NULL, ecran, &posPieceDef2V);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 0 && comptR2 == 0 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1R, NULL, ecran, &posPieceOff1R);
- SDL_BlitSurface(pieceDef1R, NULL, ecran, &posPieceDef1R);
- SDL_BlitSurface(pieceOff2Bl, NULL, ecran, &posPieceOff2Bl);
- SDL_BlitSurface(pieceDef2Bl, NULL, ecran, &posPieceDef2Bl);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 0 && comptR2 == 1 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1R, NULL, ecran, &posPieceOff1R);
- SDL_BlitSurface(pieceDef1R, NULL, ecran, &posPieceDef1R);
- SDL_BlitSurface(pieceOff2J, NULL, ecran, &posPieceOff2J);
- SDL_BlitSurface(pieceDef2J, NULL, ecran, &posPieceDef2J);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 0 && comptR2 == 0 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1R, NULL, ecran, &posPieceOff1R);
- SDL_BlitSurface(pieceDef1R, NULL, ecran, &posPieceDef1R);
- SDL_BlitSurface(pieceOff2C, NULL, ecran, &posPieceOff2C);
- SDL_BlitSurface(pieceDef2C, NULL, ecran, &posPieceDef2C);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 0 && comptR2 == 1 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1R, NULL, ecran, &posPieceOff1R);
- SDL_BlitSurface(pieceDef1R, NULL, ecran, &posPieceDef1R);
- SDL_BlitSurface(pieceOff2M, NULL, ecran, &posPieceOff2M);
- SDL_BlitSurface(pieceDef2M, NULL, ecran, &posPieceDef2M);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 0 && comptR2 == 0 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1V, NULL, ecran, &posPieceOff1V);
- SDL_BlitSurface(pieceDef1V, NULL, ecran, &posPieceDef1V);
- SDL_BlitSurface(pieceOff2N, NULL, ecran, &posPieceOff2N);
- SDL_BlitSurface(pieceDef2N, NULL, ecran, &posPieceDef2N);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 0 && comptR2 == 1 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1V, NULL, ecran, &posPieceOff1V);
- SDL_BlitSurface(pieceDef1V, NULL, ecran, &posPieceDef1V);
- SDL_BlitSurface(pieceOff2B, NULL, ecran, &posPieceOff2B);
- SDL_BlitSurface(pieceDef2B, NULL, ecran, &posPieceDef2B);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 0 && comptR2 == 1 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1V, NULL, ecran, &posPieceOff1V);
- SDL_BlitSurface(pieceDef1V, NULL, ecran, &posPieceDef1V);
- SDL_BlitSurface(pieceOff2R, NULL, ecran, &posPieceOff2R);
- SDL_BlitSurface(pieceDef2R, NULL, ecran, &posPieceDef2R);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 0 && comptR2 == 0 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1V, NULL, ecran, &posPieceOff1V);
- SDL_BlitSurface(pieceDef1V, NULL, ecran, &posPieceDef1V);
- SDL_BlitSurface(pieceOff2V, NULL, ecran, &posPieceOff2V);
- SDL_BlitSurface(pieceDef2V, NULL, ecran, &posPieceDef2V);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 0 && comptR2 == 0 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1V, NULL, ecran, &posPieceOff1V);
- SDL_BlitSurface(pieceDef1V, NULL, ecran, &posPieceDef1V);
- SDL_BlitSurface(pieceOff2Bl, NULL, ecran, &posPieceOff2Bl);
- SDL_BlitSurface(pieceDef2Bl, NULL, ecran, &posPieceDef2Bl);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 0 && comptR2 == 1 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1V, NULL, ecran, &posPieceOff1V);
- SDL_BlitSurface(pieceDef1V, NULL, ecran, &posPieceDef1V);
- SDL_BlitSurface(pieceOff2J, NULL, ecran, &posPieceOff2J);
- SDL_BlitSurface(pieceDef2J, NULL, ecran, &posPieceDef2J);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 0 && comptR2 == 0 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1V, NULL, ecran, &posPieceOff1V);
- SDL_BlitSurface(pieceDef1V, NULL, ecran, &posPieceDef1V);
- SDL_BlitSurface(pieceOff2C, NULL, ecran, &posPieceOff2C);
- SDL_BlitSurface(pieceDef2C, NULL, ecran, &posPieceDef2C);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 0 && comptR2 == 1 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1V, NULL, ecran, &posPieceOff1V);
- SDL_BlitSurface(pieceDef1V, NULL, ecran, &posPieceDef1V);
- SDL_BlitSurface(pieceOff2M, NULL, ecran, &posPieceOff2M);
- SDL_BlitSurface(pieceDef2M, NULL, ecran, &posPieceDef2M);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 1 && comptR2 == 0 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1Bl, NULL, ecran, &posPieceOff1Bl);
- SDL_BlitSurface(pieceDef1Bl, NULL, ecran, &posPieceDef1Bl);
- SDL_BlitSurface(pieceOff2N, NULL, ecran, &posPieceOff2N);
- SDL_BlitSurface(pieceDef2N, NULL, ecran, &posPieceDef2N);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 1 && comptR2 == 1 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1Bl, NULL, ecran, &posPieceOff1Bl);
- SDL_BlitSurface(pieceDef1Bl, NULL, ecran, &posPieceDef1Bl);
- SDL_BlitSurface(pieceOff2B, NULL, ecran, &posPieceOff2B);
- SDL_BlitSurface(pieceDef2B, NULL, ecran, &posPieceDef2B);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 1 && comptR2 == 1 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1Bl, NULL, ecran, &posPieceOff1Bl);
- SDL_BlitSurface(pieceDef1Bl, NULL, ecran, &posPieceDef1Bl);
- SDL_BlitSurface(pieceOff2R, NULL, ecran, &posPieceOff2R);
- SDL_BlitSurface(pieceDef2R, NULL, ecran, &posPieceDef2R);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 1 && comptR2 == 0 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1Bl, NULL, ecran, &posPieceOff1Bl);
- SDL_BlitSurface(pieceDef1Bl, NULL, ecran, &posPieceDef1Bl);
- SDL_BlitSurface(pieceOff2V, NULL, ecran, &posPieceOff2V);
- SDL_BlitSurface(pieceDef2V, NULL, ecran, &posPieceDef2V);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 1 && comptR2 == 0 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1Bl, NULL, ecran, &posPieceOff1Bl);
- SDL_BlitSurface(pieceDef1Bl, NULL, ecran, &posPieceDef1Bl);
- SDL_BlitSurface(pieceOff2Bl, NULL, ecran, &posPieceOff2Bl);
- SDL_BlitSurface(pieceDef2Bl, NULL, ecran, &posPieceDef2Bl);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 1 && comptR2 == 1 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1Bl, NULL, ecran, &posPieceOff1Bl);
- SDL_BlitSurface(pieceDef1Bl, NULL, ecran, &posPieceDef1Bl);
- SDL_BlitSurface(pieceOff2J, NULL, ecran, &posPieceOff2J);
- SDL_BlitSurface(pieceDef2J, NULL, ecran, &posPieceDef2J);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 1 && comptR2 == 0 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1Bl, NULL, ecran, &posPieceOff1Bl);
- SDL_BlitSurface(pieceDef1Bl, NULL, ecran, &posPieceDef1Bl);
- SDL_BlitSurface(pieceOff2C, NULL, ecran, &posPieceOff2C);
- SDL_BlitSurface(pieceDef2C, NULL, ecran, &posPieceDef2C);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 0 && comptB1 == 1 && comptR2 == 1 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1Bl, NULL, ecran, &posPieceOff1Bl);
- SDL_BlitSurface(pieceDef1Bl, NULL, ecran, &posPieceDef1Bl);
- SDL_BlitSurface(pieceOff2M, NULL, ecran, &posPieceOff2M);
- SDL_BlitSurface(pieceDef2M, NULL, ecran, &posPieceDef2M);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 0 && comptR2 == 0 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1J, NULL, ecran, &posPieceOff1J);
- SDL_BlitSurface(pieceDef1J, NULL, ecran, &posPieceDef1J);
- SDL_BlitSurface(pieceOff2N, NULL, ecran, &posPieceOff2N);
- SDL_BlitSurface(pieceDef2N, NULL, ecran, &posPieceDef2N);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 0 && comptR2 == 1 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1J, NULL, ecran, &posPieceOff1J);
- SDL_BlitSurface(pieceDef1J, NULL, ecran, &posPieceDef1J);
- SDL_BlitSurface(pieceOff2B, NULL, ecran, &posPieceOff2B);
- SDL_BlitSurface(pieceDef2B, NULL, ecran, &posPieceDef2B);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 0 && comptR2 == 1 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1J, NULL, ecran, &posPieceOff1J);
- SDL_BlitSurface(pieceDef1J, NULL, ecran, &posPieceDef1J);
- SDL_BlitSurface(pieceOff2R, NULL, ecran, &posPieceOff2R);
- SDL_BlitSurface(pieceDef2R, NULL, ecran, &posPieceDef2R);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 0 && comptR2 == 0 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1J, NULL, ecran, &posPieceOff1J);
- SDL_BlitSurface(pieceDef1J, NULL, ecran, &posPieceDef1J);
- SDL_BlitSurface(pieceOff2V, NULL, ecran, &posPieceOff2V);
- SDL_BlitSurface(pieceDef2V, NULL, ecran, &posPieceDef2V);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 0 && comptR2 == 0 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1J, NULL, ecran, &posPieceOff1J);
- SDL_BlitSurface(pieceDef1J, NULL, ecran, &posPieceDef1J);
- SDL_BlitSurface(pieceOff2Bl, NULL, ecran, &posPieceOff2Bl);
- SDL_BlitSurface(pieceDef2Bl, NULL, ecran, &posPieceDef2Bl);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 0 && comptR2 == 1 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1J, NULL, ecran, &posPieceOff1J);
- SDL_BlitSurface(pieceDef1J, NULL, ecran, &posPieceDef1J);
- SDL_BlitSurface(pieceOff2J, NULL, ecran, &posPieceOff2J);
- SDL_BlitSurface(pieceDef2J, NULL, ecran, &posPieceDef2J);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 0 && comptR2 == 0 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1J, NULL, ecran, &posPieceOff1J);
- SDL_BlitSurface(pieceDef1J, NULL, ecran, &posPieceDef1J);
- SDL_BlitSurface(pieceOff2C, NULL, ecran, &posPieceOff2C);
- SDL_BlitSurface(pieceDef2C, NULL, ecran, &posPieceDef2C);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 1 && comptB1 == 0 && comptR2 == 1 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1J, NULL, ecran, &posPieceOff1J);
- SDL_BlitSurface(pieceDef1J, NULL, ecran, &posPieceDef1J);
- SDL_BlitSurface(pieceOff2M, NULL, ecran, &posPieceOff2M);
- SDL_BlitSurface(pieceDef2M, NULL, ecran, &posPieceDef2M);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 1 && comptR2 == 0 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1C, NULL, ecran, &posPieceOff1C);
- SDL_BlitSurface(pieceDef1C, NULL, ecran, &posPieceDef1C);
- SDL_BlitSurface(pieceOff2N, NULL, ecran, &posPieceOff2N);
- SDL_BlitSurface(pieceDef2N, NULL, ecran, &posPieceDef2N);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 1 && comptR2 == 1 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1C, NULL, ecran, &posPieceOff1C);
- SDL_BlitSurface(pieceDef1C, NULL, ecran, &posPieceDef1C);
- SDL_BlitSurface(pieceOff2B, NULL, ecran, &posPieceOff2B);
- SDL_BlitSurface(pieceDef2B, NULL, ecran, &posPieceDef2B);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 1 && comptR2 == 1 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1C, NULL, ecran, &posPieceOff1C);
- SDL_BlitSurface(pieceDef1C, NULL, ecran, &posPieceDef1C);
- SDL_BlitSurface(pieceOff2R, NULL, ecran, &posPieceOff2R);
- SDL_BlitSurface(pieceDef2R, NULL, ecran, &posPieceDef2R);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 1 && comptR2 == 0 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1C, NULL, ecran, &posPieceOff1C);
- SDL_BlitSurface(pieceDef1C, NULL, ecran, &posPieceDef1C);
- SDL_BlitSurface(pieceOff2V, NULL, ecran, &posPieceOff2V);
- SDL_BlitSurface(pieceDef2V, NULL, ecran, &posPieceDef2V);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 1 && comptR2 == 0 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1C, NULL, ecran, &posPieceOff1C);
- SDL_BlitSurface(pieceDef1C, NULL, ecran, &posPieceDef1C);
- SDL_BlitSurface(pieceOff2Bl, NULL, ecran, &posPieceOff2Bl);
- SDL_BlitSurface(pieceDef2Bl, NULL, ecran, &posPieceDef2Bl);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 1 && comptR2 == 1 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1C, NULL, ecran, &posPieceOff1C);
- SDL_BlitSurface(pieceDef1C, NULL, ecran, &posPieceDef1C);
- SDL_BlitSurface(pieceOff2J, NULL, ecran, &posPieceOff2J);
- SDL_BlitSurface(pieceDef2J, NULL, ecran, &posPieceDef2J);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 1 && comptR2 == 0 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1C, NULL, ecran, &posPieceOff1C);
- SDL_BlitSurface(pieceDef1C, NULL, ecran, &posPieceDef1C);
- SDL_BlitSurface(pieceOff2C, NULL, ecran, &posPieceOff2C);
- SDL_BlitSurface(pieceDef2C, NULL, ecran, &posPieceDef2C);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 0 && comptV1 == 1 && comptB1 == 1 && comptR2 == 1 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1C, NULL, ecran, &posPieceOff1C);
- SDL_BlitSurface(pieceDef1C, NULL, ecran, &posPieceDef1C);
- SDL_BlitSurface(pieceOff2M, NULL, ecran, &posPieceOff2M);
- SDL_BlitSurface(pieceDef2M, NULL, ecran, &posPieceDef2M);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 1 && comptR2 == 0 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1M, NULL, ecran, &posPieceOff1M);
- SDL_BlitSurface(pieceDef1M, NULL, ecran, &posPieceDef1M);
- SDL_BlitSurface(pieceOff2N, NULL, ecran, &posPieceOff2N);
- SDL_BlitSurface(pieceDef2N, NULL, ecran, &posPieceDef2N);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 1 && comptR2 == 1 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1M, NULL, ecran, &posPieceOff1M);
- SDL_BlitSurface(pieceDef1M, NULL, ecran, &posPieceDef1M);
- SDL_BlitSurface(pieceOff2B, NULL, ecran, &posPieceOff2B);
- SDL_BlitSurface(pieceDef2B, NULL, ecran, &posPieceDef2B);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 1 && comptR2 == 1 && comptV2 == 0 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1M, NULL, ecran, &posPieceOff1M);
- SDL_BlitSurface(pieceDef1M, NULL, ecran, &posPieceDef1M);
- SDL_BlitSurface(pieceOff2R, NULL, ecran, &posPieceOff2R);
- SDL_BlitSurface(pieceDef2R, NULL, ecran, &posPieceDef2R);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 1 && comptR2 == 0 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1M, NULL, ecran, &posPieceOff1M);
- SDL_BlitSurface(pieceDef1M, NULL, ecran, &posPieceDef1M);
- SDL_BlitSurface(pieceOff2V, NULL, ecran, &posPieceOff2V);
- SDL_BlitSurface(pieceDef2V, NULL, ecran, &posPieceDef2V);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 1 && comptR2 == 0 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1M, NULL, ecran, &posPieceOff1M);
- SDL_BlitSurface(pieceDef1M, NULL, ecran, &posPieceDef1M);
- SDL_BlitSurface(pieceOff2Bl, NULL, ecran, &posPieceOff2Bl);
- SDL_BlitSurface(pieceDef2Bl, NULL, ecran, &posPieceDef2Bl);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 1 && comptR2 == 1 && comptV2 == 1 && comptB2 == 0)
- {
- SDL_BlitSurface(pieceOff1M, NULL, ecran, &posPieceOff1M);
- SDL_BlitSurface(pieceDef1M, NULL, ecran, &posPieceDef1M);
- SDL_BlitSurface(pieceOff2J, NULL, ecran, &posPieceOff2J);
- SDL_BlitSurface(pieceDef2J, NULL, ecran, &posPieceDef2J);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 1 && comptR2 == 0 && comptV2 == 1 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1M, NULL, ecran, &posPieceOff1M);
- SDL_BlitSurface(pieceDef1M, NULL, ecran, &posPieceDef1M);
- SDL_BlitSurface(pieceOff2C, NULL, ecran, &posPieceOff2C);
- SDL_BlitSurface(pieceDef2C, NULL, ecran, &posPieceDef2C);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else if (comptR1 == 1 && comptV1 == 0 && comptB1 == 1 && comptR2 == 1 && comptV2 == 0 && comptB2 == 1)
- {
- SDL_BlitSurface(pieceOff1M, NULL, ecran, &posPieceOff1M);
- SDL_BlitSurface(pieceDef1M, NULL, ecran, &posPieceDef1M);
- SDL_BlitSurface(pieceOff2M, NULL, ecran, &posPieceOff2M);
- SDL_BlitSurface(pieceDef2M, NULL, ecran, &posPieceDef2M);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- else
- {
- SDL_BlitSurface(pieceOff1N, NULL, ecran, &posPieceOff1N);
- SDL_BlitSurface(pieceDef1N, NULL, ecran, &posPieceDef1N);
- SDL_BlitSurface(pieceOff2B, NULL, ecran, &posPieceOff2B);
- SDL_BlitSurface(pieceDef2B, NULL, ecran, &posPieceDef2B);
- SDL_BlitSurface(rouge0, NULL, ecran, &posRouge0A);
- SDL_BlitSurface(vert0, NULL, ecran, &posVert0A);
- SDL_BlitSurface(bleu0, NULL, ecran, &posBleu0A);
- SDL_BlitSurface(rouge1, NULL, ecran, &posRouge1B);
- SDL_BlitSurface(vert1, NULL, ecran, &posVert1B);
- SDL_BlitSurface(bleu1, NULL, ecran, &posBleu1B);
- }
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- //Option - reglage du fond d'écran
- else if(posSelectMenu.y >=250 && (posSelectMenu.y <300))
- {
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_KEYDOWN:
- switch(event.key.keysym.sym)
- {
- case SDLK_ESCAPE: /* Appui sur la touche Echap, on arrête le programme */
- continuer2 = 0;
- break;
- case SDLK_LEFT:
- if (compteurFond > 0)
- {
- compteurFond--;
- break;
- }
- break;
- case SDLK_RIGHT:
- if(compteurFond <= 3)
- {
- compteurFond++;
- break;
- }
- default:
- break;
- }
- break;
- case SDL_MOUSEBUTTONUP:
- if(event.button.x>=ecran->w / 2 - touchePre7->w / 2 - 20 && event.button.x<=ecran->w / 2 - touchePre7->w / 2 - 2 && event.button.y>=480 && event.button.y<=508 && event.button.button == SDL_BUTTON_LEFT && compteurFond > 0)
- {
- compteurFond--;
- }
- else if(event.button.x>=ecran->w / 2 - touchePre7->w / 2 + 20 && event.button.x<=ecran->w / 2 - touchePre7->w / 2 + 38 && event.button.y>=480 && event.button.y<=508 && event.button.button == SDL_BUTTON_LEFT && compteurFond <= 3)
- {
- compteurFond++;;
- break;
- }
- else
- {
- break;
- }
- }
- if (compteurFond == 0)
- {
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran*/
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran */
- SDL_BlitSurface(textureDamFond, NULL, ecran, &positionDamFond); /* On blitte par-dessus l'écran */
- }
- else if (compteurFond == 1)
- {
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran*/
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran */
- SDL_BlitSurface(textureEtoile2, NULL, ecran, &positionEtoile2); /* On blitte par-dessus l'écran */
- }
- else if (compteurFond == 2)
- {
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran*/
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran */
- SDL_BlitSurface(textureForet2, NULL, ecran, &positionForet2); /* On blitte par-dessus l'écran */
- }
- else if (compteurFond == 3)
- {
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran*/
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran */
- SDL_BlitSurface(texturePlage2, NULL, ecran, &positionPlage2); /* On blitte par-dessus l'écran */
- }
- else
- {
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran*/
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran */
- SDL_BlitSurface(textureNuit2, NULL, ecran, &positionNuit2); /* On blitte par-dessus l'écran */
- }
- SDL_BlitSurface(damierInc400400NB, NULL, ecran, &posDamInc400400VB);
- SDL_BlitSurface(touchePre7, NULL, ecran, &positionPre7);
- SDL_BlitSurface(toucheSui7, NULL, ecran, &positionSui7);
- SDL_BlitSurface(txtTexture, NULL, ecran, &posTxtTexture);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- //freesurface ici
- }
- //Option - reglage du volume
- else
- {
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_KEYDOWN:
- switch(event.key.keysym.sym)
- {
- case SDLK_ESCAPE: /* Appui sur la touche Echap, on arrête le programme */
- continuer2 = 0;
- break;
- case SDLK_LEFT: // Flèche gauche
- if(posBoutonVol.x >=400)
- {
- posBoutonVol.x = posBoutonVol.x - 77;
- break;
- }
- break;
- case SDLK_RIGHT: // Flèche droite
- if(posBoutonVol.x <=600)
- {
- posBoutonVol.x = posBoutonVol.x + 77;
- break;
- }
- default:
- break;
- }
- break;
- case SDL_MOUSEBUTTONUP:
- if(event.button.x>=590 && event.button.x<=608 && event.button.y>=230 && event.button.y<=258 && event.button.button == SDL_BUTTON_LEFT && posBoutonVol.x >= 230)
- {
- posBoutonVol.x = posBoutonVol.x - 77;
- break;
- }
- else if(event.button.x>=640 && event.button.x<=658 && event.button.y>=230 && event.button.y<=258 && event.button.button == SDL_BUTTON_LEFT && posBoutonVol.x <= 450)
- {
- posBoutonVol.x = posBoutonVol.x + 77;
- break;
- }
- else
- {
- break;
- }
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran*/
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran */
- SDL_BlitSurface(txtRegDuVol, NULL, ecran, &posTxtReglageV);
- SDL_BlitSurface(reglageVol, NULL, ecran, &positionReglageV);
- SDL_BlitSurface(selectVolume, NULL, ecran, &posSelectVol);
- SDL_BlitSurface(selectBoutonVol, NULL, ecran, &posBoutonVol);
- SDL_BlitSurface(touchePre7, NULL, ecran, &positionPre7);
- SDL_BlitSurface(toucheSui7, NULL, ecran, &positionSui7);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- }
- }
- default:
- break;
- }
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran */
- SDL_BlitSurface(selectMenu, NULL, ecran, &posSelectMenu);/* On blitte par-dessus l'écran */
- SDL_BlitSurface(ssMenu5, NULL, ecran, &positionSsMenu5); /* Blit du texte option par-dessus */
- SDL_BlitSurface(textureDamier, NULL, ecran, &positionTextureD); /* Blit du texte menu4 par-dessus */
- SDL_BlitSurface(textureDeFond, NULL, ecran, &positionTextureF); /* Blit du texte menu5 par-dessus */
- SDL_BlitSurface(reglageVol, NULL, ecran, &positionReglageV); /* Blit du texte menu6 par-dessus */
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- continuer2 = 1;
- }
- }
- //quand le pointeur est sur le menu Règle du jeu
- else if(posSelectMenu.y >=450 && posSelectMenu.y<500)
- {
- while (continuer1) /* TANT QUE la variable ne vaut pas 0 */
- {
- SDL_WaitEvent(&event); /* On attend un évènement qu'on récupère dans event */
- switch(event.type) /* On teste le type d'évènement */
- {
- case SDL_QUIT: /* Si c'est un évènement QUITTER */
- continuer = 0; /* On met le booléen à 0, donc la boucle va s'arrêter */
- break;
- case SDL_KEYDOWN:
- switch (event.key.keysym.sym)
- {
- case SDLK_ESCAPE: /* Appui sur la touche Echap, on arrête le programme */
- continuer1 = 0;
- break;
- case SDLK_LEFT:
- if (compteurRegle > 0)
- {
- compteurRegle--;
- break;
- }
- break;
- case SDLK_RIGHT:
- if(compteurRegle <= 5)
- {
- compteurRegle++;
- break;
- }
- default:
- break;
- }
- case SDL_MOUSEBUTTONUP:
- if(event.button.x>=ecran->w / 2 - touchePre7->w / 2 - 20 && event.button.x<=ecran->w / 2 - touchePre7->w / 2 - 2 && event.button.y>=480 && event.button.y<=508 && event.button.button == SDL_BUTTON_LEFT && compteurRegle > 0)
- {
- compteurRegle--;
- break;
- }
- else if(event.button.x>=ecran->w / 2 - touchePre7->w / 2 + 20 && event.button.x<=ecran->w / 2 - touchePre7->w / 2 + 38 && event.button.y>=480 && event.button.y<=508 && event.button.button == SDL_BUTTON_LEFT && compteurRegle <= 5)
- {
- compteurRegle++;
- break;
- }
- else
- {
- break;
- }
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran */
- SDL_BlitSurface(ssMenu6, NULL, ecran, &positionSsMenu6);
- if(compteurRegle == 1)
- {
- SDL_BlitSurface(regleJeu2, NULL, ecran, &posRegleJeu2);
- }
- else if(compteurRegle == 2)
- {
- SDL_BlitSurface(regleJeu3, NULL, ecran, &posRegleJeu3);
- }
- else if(compteurRegle == 3)
- {
- SDL_BlitSurface(regleJeu4, NULL, ecran, &posRegleJeu4);
- }
- else if(compteurRegle == 4)
- {
- SDL_BlitSurface(regleJeu5, NULL, ecran, &posRegleJeu5);
- }
- else if(compteurRegle == 5)
- {
- SDL_BlitSurface(regleJeu6, NULL, ecran, &posRegleJeu6);
- }
- else if(compteurRegle == 6)
- {
- SDL_BlitSurface(regleJeu7, NULL, ecran, &posRegleJeu7);
- }
- else
- {
- SDL_BlitSurface(regleJeu1, NULL, ecran, &posRegleJeu1);
- }
- SDL_BlitSurface(touchePre7, NULL, ecran, &positionPre7);
- SDL_BlitSurface(toucheSui7, NULL, ecran, &positionSui7);
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- continuer2 = 1;
- }
- }
- //quand le pointeur est sur le menu exit
- else
- {
- continuer = 0;
- break;
- }
- break;
- }
- }
- break;
- }
- SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255)); /* On efface l'écran */
- SDL_BlitSurface(textureFond, NULL, ecran, &positionFond); /* On blitte par-dessus l'écran */
- SDL_BlitSurface(selectMenu, NULL, ecran, &posSelectMenu);/* On blitte par-dessus l'écran */
- SDL_BlitSurface(menu, NULL, ecran, &positionMenu); /* Blit du texte menu par-dessus */
- SDL_BlitSurface(menu1, NULL, ecran, &positionMenu1); /* Blit du texte menu1 par-dessus */
- SDL_BlitSurface(menu2, NULL, ecran, &positionMenu2); /* Blit du texte menu2 par-dessus */
- SDL_BlitSurface(menu3, NULL, ecran, &positionMenu3); /* Blit du texte menu3 par-dessus */
- SDL_BlitSurface(menu4, NULL, ecran, &positionMenu4); /* Blit du texte menu4 par-dessus */
- SDL_BlitSurface(menu5, NULL, ecran, &positionMenu5); /* Blit du texte menu5 par-dessus */
- SDL_BlitSurface(menu6, NULL, ecran, &positionMenu6); /* Blit du texte menu6 par-dessus */
- SDL_BlitSurface(menu7, NULL, ecran, &positionMenu7); /* Blit du texte menu6 par-dessus */
- SDL_Flip(ecran); /* Mise à jour de l'écran avec sa nouvelle couleur */
- continuer1 = 1;
- }
- TTF_CloseFont(police);
- TTF_Quit();
- /* On libère les surfaces */
- SDL_FreeSurface(txtDeplaNA);
- SDL_FreeSurface(menu);
- SDL_FreeSurface(ecran);
- SDL_FreeSurface(CubikRed);
- SDL_FreeSurface(CubikBlue);
- SDL_FreeSurface(textureFond);
- SDL_FreeSurface(textureEtoile);
- SDL_FreeSurface(textureForet);
- SDL_FreeSurface(texturePlage);
- SDL_FreeSurface(textureNuit);
- SDL_FreeSurface(textJ1Commence);
- SDL_FreeSurface(damierInc800800NB);
- SDL_FreeSurface(pieceJeuOff1N);
- SDL_FreeSurface(pieceJeuDef1N);
- SDL_FreeSurface(pieceJeuOff2N);
- SDL_FreeSurface(pieceJeuDef2N);
- SDL_FreeSurface(menu2);
- SDL_FreeSurface(ssMenu2);
- SDL_FreeSurface(menu3);
- SDL_FreeSurface(ssMenu3);
- SDL_FreeSurface(menu4);
- SDL_FreeSurface(ssMenu4);
- SDL_FreeSurface(texteSelect);
- SDL_FreeSurface(menu5);
- SDL_FreeSurface(ssMenu5);
- SDL_FreeSurface(textureDeFond); //il s'agit d'un texte du sous menu 5
- SDL_FreeSurface(textureDamier);
- SDL_FreeSurface(textureDamFond);
- SDL_FreeSurface(txtTexture);
- SDL_FreeSurface(textureFond);
- SDL_FreeSurface(textureEtoile2);
- SDL_FreeSurface(textureNuit2);
- SDL_FreeSurface(texturePlage2);
- SDL_FreeSurface(textureForet2);
- SDL_FreeSurface(reglageVol);
- SDL_FreeSurface(ssMenu1);
- SDL_FreeSurface(pieceOff1N);
- SDL_FreeSurface(pieceDef1N);
- SDL_FreeSurface(pieceOff2N);
- SDL_FreeSurface(pieceDef2N);
- SDL_FreeSurface(pieceOff1B);
- SDL_FreeSurface(pieceDef1B);
- SDL_FreeSurface(pieceOff2B);
- SDL_FreeSurface(pieceDef2B);
- SDL_FreeSurface(pieceOff1R);
- SDL_FreeSurface(pieceDef1R);
- SDL_FreeSurface(pieceOff2R);
- SDL_FreeSurface(pieceDef2R);
- SDL_FreeSurface(pieceOff1V);
- SDL_FreeSurface(pieceDef1V);
- SDL_FreeSurface(pieceOff2V);
- SDL_FreeSurface(pieceDef2V);
- SDL_FreeSurface(pieceOff1Bl);
- SDL_FreeSurface(pieceDef1Bl);
- SDL_FreeSurface(pieceOff2Bl);
- SDL_FreeSurface(pieceDef2Bl);
- SDL_FreeSurface(pieceOff1J);
- SDL_FreeSurface(pieceDef1J);
- SDL_FreeSurface(pieceOff2J);
- SDL_FreeSurface(pieceDef2J);
- SDL_FreeSurface(pieceOff1C);
- SDL_FreeSurface(pieceDef1C);
- SDL_FreeSurface(pieceOff2C);
- SDL_FreeSurface(pieceDef2C);
- SDL_FreeSurface(pieceOff1M);
- SDL_FreeSurface(pieceDef1M);
- SDL_FreeSurface(pieceOff2M);
- SDL_FreeSurface(pieceDef2M);
- SDL_FreeSurface(touchePre1);
- SDL_FreeSurface(toucheSui1);
- SDL_FreeSurface(touchePre2);
- SDL_FreeSurface(toucheSui2);
- SDL_FreeSurface(touchePre3);
- SDL_FreeSurface(toucheSui3);
- SDL_FreeSurface(touchePre4);
- SDL_FreeSurface(toucheSui4);
- SDL_FreeSurface(touchePre5);
- SDL_FreeSurface(toucheSui5);
- SDL_FreeSurface(touchePre6);
- SDL_FreeSurface(toucheSui6);
- SDL_FreeSurface(touchePre7);
- SDL_FreeSurface(toucheSui7);
- SDL_FreeSurface(carreRouge1);
- SDL_FreeSurface(carreVert1);
- SDL_FreeSurface(carreBleu1);
- SDL_FreeSurface(carreRouge2);
- SDL_FreeSurface(carreVert2);
- SDL_FreeSurface(carreBleu2);
- SDL_FreeSurface(rouge1);
- SDL_FreeSurface(vert1);
- SDL_FreeSurface(bleu1);
- SDL_FreeSurface(rouge0);
- SDL_FreeSurface(vert0);
- SDL_FreeSurface(bleu0);
- SDL_FreeSurface(selectVolume);
- SDL_FreeSurface(selectBoutonVol);
- SDL_FreeSurface(txtRegDuVol);
- SDL_FreeSurface(damierInc400400NB);
- SDL_FreeSurface(menu6);
- SDL_FreeSurface(ssMenu6);
- SDL_FreeSurface(carreBlanc);
- SDL_FreeSurface(regleJeu1);
- SDL_FreeSurface(regleJeu2);
- SDL_FreeSurface(regleJeu3);
- SDL_FreeSurface(regleJeu4);
- SDL_FreeSurface(regleJeu5);
- SDL_FreeSurface(regleJeu6);
- SDL_FreeSurface(regleJeu7);
- SDL_FreeSurface(menu7);
- SDL_FreeSurface(selectMenu);
- SDL_Quit();
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement