1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| import pygame, sys
from pygame.locals import *
BORDEAUX= (130,0,0)
BLACK = (0,0,0)
WHITE = (255,255,255)
pygame.init()
maSurface = pygame.display.set_mode((800, 500))
pygame.display.set_caption('Pentago GUI')
maSurface.fill(BLACK)
def square(origineX,origineY):
pygame.draw.rect(maSurface,BORDEAUX,(origineX,origineY,140,140))
x,y = origineX+35,origineY+35
for i in range(0,3):
pygame.draw.rect(maSurface,(BORDEAUX),(x-10,y-10,20,20)) #rectangles virtuels qui prennent le cercle
pygame.draw.circle(maSurface,(160,0,0),(x,y),8)
for j in range(0,3):
pygame.draw.rect(maSurface,(BORDEAUX),(x-10,y-10,20,20))#rectangles virtuels qui prends le cercle
pygame.draw.circle(maSurface,(160,0,0),(x,y),8)
x += 35
x= origineX+35
y += 40
#VOIR LES BONNES POSIITONS ET CREER 4 CARRES
for (x,y) in ((80,110),(225,110),(80,255),(225,255)):
square(x,y)
fontOBj= pygame.font.Font('freesansbold.ttf',30)
textsurface = fontOBj.render('Nouvelle Partie',True,(160,0,0),BLACK)
textRec= textsurface.get_rect()
textRec.topright= (725,230)
maSurface.blit(textsurface,textRec)
fontOBj= pygame.font.Font('freesansbold.ttf',30)
textsurface = fontOBj.render('Quitter',True,(160,0,0),BLACK)
textRec= textsurface.get_rect()
textRec.topright= (660,300)
maSurface.blit(textsurface,textRec)
fontOBj= pygame.font.Font('freesansbold.ttf',30)
textsurface = fontOBj.render('P E N T A G O ',True,(160,0,0),BLACK)
textRec= textsurface.get_rect()
textRec.topright= (710,120)
maSurface.blit(textsurface,textRec)
########################Cette fonction pose_pion me pose problème
TourDuJoueur = 1
def pose_pions():
for event in pygame.event.get():
if event.type == MOUSEBUTTONDOWN:
while event.pos() != 0 :
pygame.draw.circle(maSurface,WHITE,(x,y),10)
TourDuJoueur = 2
TourDuJoueur = 2
if event.type == MOUSEBUTTONDOWN :
while event.pos() != 0 :
pygame.draw.circle(maSurface,BLACK,(x,y),10)
TourDuJoueur = 1
pose_pions()
inProgress = True
while inProgress:
for event in pygame.event.get():
if event.type == QUIT:
inProgress = False
pygame.display.update()
pygame.quit()
####################### |
Partager