def process_events(self):
keys = pygame.key.get_pressed()
self.B1 = Button(self.width * 0.88, self.height * 0.04, self.width * 0.1, self.height * 0.07, I5)
self.B2 = Button(self.width * 0.88, self.height * 0.04, self.width * 0.1, self.height * 0.07, I5)
self.B3 = Button(self.width * 0.88, self.height * 0.04, self.width * 0.1, self.height * 0.07, I5)
self.H1 = Button(self.width * 0.88, self.height * 0.84, self.width * 0.1, self.height * 0.07, I6)
self.H2 = Button(self.width * 0.77, self.height * 0.84, self.width * 0.1, self.height * 0.07, I7)
self.M1 = Menu(self.width, self.height, I0)
self.screen_rect = self.screen.get_rect()
for event in pygame.event.get():
if event.type == VIDEORESIZE:
self.screen = pygame.display.set_mode(event.dict['size'], HWSURFACE | DOUBLEBUF | RESIZABLE)
self.width = event.dict['size'][0]
self.height = event.dict['size'][1]
if event.type == pygame.QUIT:
return True
if keys[pygame.K_LCTRL] and keys[pygame.K_w]:
return True
if keys[pygame.K_LALT] and keys[pygame.K_F4]:
return True
if keys[pygame.K_ESCAPE]:
if self.S0[1] == 1 or self.S0[2] == 1 or self.S0[3] == 1:
self.S0 = [1, 0, 0, 0]
if keys[pygame.K_r]:
self.D1
self.D1 = Dice(self.width * 0.5, self.height * 0.5, self.width * 0.1, self.width * 0.1)
if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1 and self.D1.rc == 0:
self.D1.check_click(event.pos)
if event.type == pygame.MOUSEBUTTONUP and event.button == 1:
self.D1.click = False
if self.D1.rc == 1:
self.D1.rc = 2
if self.D1.rc == 3 and self.D1.vcc < 30:
self.D1.rc = 0
self.D1.vcc = 0
if self.B1.rect.collidepoint(pygame.mouse.get_pos()) and self.S0[1] == 1:
self.S0 = [1, 0, 0, 0]
if self.B2.rect.collidepoint(pygame.mouse.get_pos()) and self.S0[2] == 1:
self.S0 = [1, 0, 0, 0]
if self.H1.rect.collidepoint(pygame.mouse.get_pos()) and self.S0[2] == 1:
self.S0 = [1, 0, 0, 0]
if self.H2.rect.collidepoint(pygame.mouse.get_pos()) and self.S0[2] == 1:
self.S0 = [1, 0, 0, 0]
if self.B3.rect.collidepoint(pygame.mouse.get_pos()) and self.S0[3] == 1:
self.S0 = [1, 0, 0, 0]
if self.M1.B1.rect.collidepoint(pygame.mouse.get_pos()) and self.S0[0] == 1:
self.S0 = [0, 1, 0, 0]
if self.M1.B2.rect.collidepoint(pygame.mouse.get_pos()) and self.S0[0] == 1:
self.S0 = [0, 0, 1, 0]
if self.M1.B3.rect.collidepoint(pygame.mouse.get_pos()) and self.S0[0] == 1:
self.S0 = [0, 0, 0, 1]
if self.M1.B4.rect.collidepoint(pygame.mouse.get_pos()) and self.S0[0] == 1:
return True
return False
评论列表
文章目录