Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.51 KB | None | 0 0
  1. #include "jeu.h"
  2.  
  3. #include <iostream>
  4. #include <windows.h>
  5.  
  6. using namespace std;
  7.  
  8. jeu::jeu()
  9. {
  10.     int x,y;
  11.     x=6;
  12.     y=7;
  13.     tableau_affichage.resize(y);
  14.     for(int i=0;i<y;i++)
  15.     {
  16.         tableau_affichage[i].resize(x);
  17.  
  18.     }
  19.     for(int i=0;i<y;i++)
  20.     {
  21.         for(int j=0;j<x;j++)
  22.         {
  23.             tableau_affichage[i][j]=0;
  24.         }
  25.  
  26.     }
  27.     coup=0;
  28. }
  29.  
  30.  
  31. int jeu::jouer(int x)
  32. {
  33.     for(int y=0;y<6;y++)
  34.     {
  35.         if(tableau_affichage[y][x] == 0)
  36.         {
  37.            coup++;
  38.           tableau_affichage[y][x] = coup;
  39.  
  40.           return coup;
  41.         }
  42.     }
  43.     return -1;
  44. }
  45.  
  46. void jeu::affiche()
  47. {
  48.     QGraphicsScene scene;
  49.  
  50.  
  51.  
  52.  
  53.     QGraphicsItem *item;
  54.     QPixmap image;
  55.     image.load("rouge.jpg", 0, Qt::AutoColor);
  56.  
  57.             item = scene.addPixmap(image);
  58.             item->setPos(-450,-200);
  59.  
  60.     QGraphicsView vue(&scene);
  61.     vue.setFixedSize(850, 480);
  62. vue.show();
  63.  
  64.     item->setPos(50, 50);
  65.  
  66.      for(int i=0;i<=6;i++)
  67.      {
  68.         scene.addLine(-450,-200+i*50,-100,-200+i*50);
  69.      }
  70.  
  71.      for(int i=0;i<8;i++)
  72.      {
  73.         scene.addLine(-450+i*50,-200,-450+i*50,100);
  74.      }
  75.  
  76.  
  77.      for(int i=0;i<6;i++)
  78.      {
  79.          for(int j=0;j<7;j++)
  80.          {
  81.              if(tableau_affichage[i][j]>0)
  82.              {
  83.                 if (tableau_affichage[i][j]%2==1)
  84.                  {
  85.                     qDebug("rouge");
  86.                 }else{qDebug("jaune");}
  87.              }
  88.          }
  89.  
  90.      }
  91.  
  92. Sleep(5000);
  93.  
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement