Commit 723cfbb9 authored by Bonnegent Sebastien's avatar Bonnegent Sebastien
Browse files

add: intégration des modifications faites par Ludovic de ZGen

parent ec2f2698
Pipeline #3639 passed with stage
in 18 seconds
......@@ -21,7 +21,7 @@ BROWN = (85, 46, 46)
PRETTY_BLUE = (0, 238, 195)
LIST_COLOR = [
BLACK,
WHITE,
YELLOW,
ORANGE,
RED,
......@@ -36,3 +36,7 @@ BROWN,
GRAY,
DARK_GRAY
]
#fond
REP_BACKGROUND = "fonds/"
BACKGROUND = ("plage.jpg","montage.jpg","espace.jpg","moulin.jpg","campagne.jpg")
\ No newline at end of file
......@@ -9,22 +9,42 @@ from player import Player
from menu import Menu
pygame.display.init()
pygame.mouse.set_visible(0)
player_1 = Player(1)
#players est la liste des joueurs
players = [player_1]
#screen correspond à l'ensemble de l'affichage.
screen = pygame.display.set_mode(constants.SCREENSIZE, pygame.FULLSCREEN)
screen.fill(constants.WHITE)
infoObject = pygame.display.Info()
idx_background = 0
aff_menu_complet = True
#def text_objects(text, font):
# textSurface = font.render(text, True, constants.WHITE)
# return textSurface, textSurface.get_rect()
screen = pygame.display.set_mode((infoObject.current_w,infoObject.current_h ), pygame.FULLSCREEN)
#adapte la zone wiimote avec la zone ecran
ratio_w = infoObject.current_w / 1024
ratio_h = infoObject.current_h / 768
#screen = pygame.display.set_mode(constants.SCREENSIZE, pygame.FULLSCREEN)
screen.fill(constants.BLACK)
pygame.display.update()
side_menu = Menu()
#background correspond uniquement à la surface sur laquelle les joueurs déssinent.
background = pygame.Surface(screen.get_size())
background.fill(constants.WHITE)
image_fond = pygame.image.load(constants.REP_BACKGROUND + constants.BACKGROUND[idx_background])
#background.fill(constants.BLACK)
background.blit(image_fond, (0, 0))
while 1 :
for player in players :
#On récupère la position et les boutons du joueurs.
player.set_position()
player.set_position(ratio_w,ratio_h)
player.set_boutons()
if cwiid.BTN_HOME in player.get_boutons():
try:
......@@ -43,10 +63,27 @@ while 1 :
if not(cwiid.BTN_1 in player.get_boutons() or cwiid.BTN_2 in player.get_boutons()) :
player.set_color_changed(False)
if cwiid.BTN_LEFT in player.get_boutons() and not(player.get_color_panel()) :
player.set_color_panel(True)
side_menu.change_state_show_menu()
player.set_color_panel(True)
side_menu.change_state_show_menu()
if cwiid.BTN_RIGHT in player.get_boutons() :
background.fill(constants.WHITE)
background.fill(constants.BLACK)
if cwiid.BTN_UP in player.get_boutons() :
idx_background = idx_background + 1
if idx_background > len(constants.BACKGROUND) -1 :
idx_background = 0
image_fond = pygame.image.load(constants.REP_BACKGROUND + constants.BACKGROUND[idx_background])
background.blit(image_fond, (0, 0))
if cwiid.BTN_DOWN in player.get_boutons() :
idx_background = idx_background - 1
if idx_background < 0 :
idx_background = len(constants.BACKGROUND) -1
image_fond = pygame.image.load( constants.REP_BACKGROUND + constants.BACKGROUND[idx_background])
background.blit(image_fond, (0, 0))
if not(cwiid.BTN_LEFT in player.get_boutons()):
player.set_color_panel(False)
if player.get_position() !=None :
......@@ -59,14 +96,23 @@ while 1 :
pygame.draw.circle(background, player.get_color(), player.get_position(), player.get_size())
elif cwiid.BTN_B in player.get_boutons() :
#Pour effacer on dessine en blanc sur le background.
pygame.draw.circle(background, constants.WHITE, player.get_position(), player.get_size())
pygame.draw.circle(background, constants.BLACK, player.get_position(), player.get_size())
#On affiche le nouveaux background sur le screen
#largeText = pygame.font.Font('freesansbold.ttf',115)
#TextSurf, TextRect = text_objects(str( ""), largeText)
#TextRect.center = ((infoObject.current_w/2),(infoObject.current_h/2))
screen.blit(background, (0,0))
# screen.blit(TextSurf, TextRect)
for player in players:
if player.get_position() !=None :
screen.blit(player.get_cursor(), player.get_cursor().get_position_center(player.get_position()))
if side_menu.get_show_menu() :
#On affichage le menu par dessus le nouveaux background
side_menu.show_menu_on_screen(screen)
side_menu.show_menu_on_screen(screen,aff_menu_complet)
#Met à jour l'affichage.
pygame.display.update()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment