Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "jeu.h"
- #include <iostream>
- #include <windows.h>
- using namespace std;
- jeu::jeu()
- {
- int x,y;
- x=6;
- y=7;
- tableau_affichage.resize(y);
- for(int i=0;i<y;i++)
- {
- tableau_affichage[i].resize(x);
- }
- for(int i=0;i<y;i++)
- {
- for(int j=0;j<x;j++)
- {
- tableau_affichage[i][j]=0;
- }
- }
- coup=0;
- }
- int jeu::jouer(int x)
- {
- for(int y=0;y<6;y++)
- {
- if(tableau_affichage[y][x] == 0)
- {
- coup++;
- tableau_affichage[y][x] = coup;
- return coup;
- }
- }
- return -1;
- }
- void jeu::affiche()
- {
- QGraphicsScene scene;
- QGraphicsItem *item;
- QPixmap image;
- image.load("rouge.jpg", 0, Qt::AutoColor);
- item = scene.addPixmap(image);
- item->setPos(-450,-200);
- QGraphicsView vue(&scene);
- vue.setFixedSize(850, 480);
- vue.show();
- item->setPos(50, 50);
- for(int i=0;i<=6;i++)
- {
- scene.addLine(-450,-200+i*50,-100,-200+i*50);
- }
- for(int i=0;i<8;i++)
- {
- scene.addLine(-450+i*50,-200,-450+i*50,100);
- }
- for(int i=0;i<6;i++)
- {
- for(int j=0;j<7;j++)
- {
- if(tableau_affichage[i][j]>0)
- {
- if (tableau_affichage[i][j]%2==1)
- {
- qDebug("rouge");
- }else{qDebug("jaune");}
- }
- }
- }
- Sleep(5000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement