Commit d8bf5c36 authored by captnfab's avatar captnfab 🦃
Browse files

Fix: hover buttons in selection menu

parent 0b572522
......@@ -643,7 +643,7 @@ class GuiSelection:
prect.center = portrait_center
self.charmenu_items.append((n, charname, crect, portrait, prect, chardescr))
if crect.width > cmaxwidth:
caxwidth=crect.width
cmaxwidth=crect.width
if crect.height > cmaxheight:
cmaxheight=crect.height
......@@ -654,11 +654,11 @@ class GuiSelection:
if m > dmaxwidth:
dmaxwidth=m
self.charmenu_rect = pygame.Rect(0, 0, cmaxwidth, cmaxheight)
self.charmenu_rect.center = charmenu_center
self.charmenu_crect = pygame.Rect((0, 0), (cmaxwidth, cmaxheight))
self.charmenu_crect.center = charmenu_center
self.charmenu_drect = pygame.Rect(0, 0, dmaxwidth, dmaxheight)
self.charmenu_drect.midtop = self.charmenu_rect.midbottom
self.charmenu_drect.midtop = self.charmenu_crect.midbottom
self.charmenu_drect.top += 15
self.charmenu_index = 0
......@@ -684,7 +684,7 @@ class GuiSelection:
s.blit(line, rect)
s.blit(portrait, prect)
update_rects.append(prect)
update_rects.append(self.charmenu_rect)
update_rects.append(self.charmenu_crect)
update_rects.append(self.charmenu_drect)
s.blit(self.menu_label, self.menu_label_rect)
......@@ -693,16 +693,19 @@ class GuiSelection:
s.blit(self.menu_next_hover, self.menu_next_rect)
else:
s.blit(self.menu_next, self.menu_next_rect)
update_rects.append(self.menu_next_rect)
if self.menu_prev_active:
s.blit(self.menu_prev_hover, self.menu_prev_rect)
else:
s.blit(self.menu_prev, self.menu_prev_rect)
update_rects.append(self.menu_prev_rect)
if self.menu_ok_active:
s.blit(self.menu_ok_hover, self.menu_ok_rect)
else:
s.blit(self.menu_ok, self.menu_ok_rect)
update_rects.append(self.menu_ok_rect)
return update_rects
......@@ -887,7 +890,7 @@ class GuiSetupShips:
ship['rdescr'] = [ shipdescr_font.render(line, 1, WHITE) for line in cut_text(descr_width, descr)]
ship['turntable'] = ShipTurntable(ship_size=size, pos=(int(WIDTH*0.75), int(HEIGHT*0.4)), loop=True)
models = {}
for direction,letter in [(Direction.NORTH, "N"), (Direction.SOUTH, "S"), (Direction.EAST, "E"), (Direction.WEST, "W"), ("P", "P")]:
for direction,letter in [(Direction.NORTH, "N"), (Direction.SOUTH, "S"), (Direction.EAST, "E"), (Direction.WEST, "W")]:
view = pygame.image.load("gfx/boat_"+str(size)+"_"+letter+".png").convert_alpha()
#view = pygame.transform.smoothscale(view, (int(5*self.cell_tl[0]),int(5*self.cell_tl[0])))
models[direction] = view
......@@ -1306,7 +1309,7 @@ class GuiBattleShips:
ship['name'] = name
ship['descr'] = descr
models = {}
for direction,letter in [(Direction.NORTH, "N"), (Direction.SOUTH, "S"), (Direction.EAST, "E"), (Direction.WEST, "W"), ("P", "P")]:
for direction,letter in [(Direction.NORTH, "N"), (Direction.SOUTH, "S"), (Direction.EAST, "E"), (Direction.WEST, "W")]:
view = pygame.image.load("gfx/boat_"+str(size)+"_"+letter+".png").convert_alpha()
#view = pygame.transform.smoothscale(view, (int(5*self.cell_tl[0]),int(5*self.cell_tl[0])))
models[direction] = view
......
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