Skip to content

Commit

Permalink
- Fixing bug in screen space health bar transparency
Browse files Browse the repository at this point in the history
  • Loading branch information
MyreMylar committed Nov 23, 2019
1 parent c4639af commit 0c80fd9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pygame_gui/core/drawable_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def redraw_state(self, state_str):
if self.theming['border_width'] > 0:

if type(self.theming[border_colour_state_str]) == ColourGradient:
border_shape_surface = pygame.Surface(self.border_rect.size)
border_shape_surface = pygame.Surface(self.border_rect.size, flags=pygame.SRCALPHA)
border_shape_surface.fill(pygame.Color('#FFFFFFFF'))
self.surfaces[state_str].blit(border_shape_surface,
self.border_rect, special_flags=pygame.BLEND_RGBA_SUB)
Expand All @@ -268,7 +268,7 @@ def redraw_state(self, state_str):
self.surfaces[state_str].fill(self.theming[border_colour_state_str], self.border_rect)

if type(self.theming[bg_colour_state_str]) == ColourGradient:
background_shape_surface = pygame.Surface(self.background_rect.size)
background_shape_surface = pygame.Surface(self.background_rect.size, flags=pygame.SRCALPHA)
background_shape_surface.fill(pygame.Color('#FFFFFFFF'))
self.surfaces[state_str].blit(background_shape_surface,
self.background_rect, special_flags=pygame.BLEND_RGBA_SUB)
Expand All @@ -281,7 +281,7 @@ def redraw_state(self, state_str):
bar_rect = pygame.Rect(self.background_rect.topleft, (self.theming['filled_bar_width'],
self.background_rect.height))
if type(self.theming['filled_bar']) == ColourGradient:
bar_shape_surface = pygame.Surface(bar_rect.size)
bar_shape_surface = pygame.Surface(bar_rect.size, flags=pygame.SRCALPHA)
bar_shape_surface.fill(pygame.Color('#FFFFFFFF'))
self.surfaces[state_str].blit(bar_shape_surface, bar_rect, special_flags=pygame.BLEND_RGBA_SUB)
self.theming['filled_bar'].apply_gradient_to_surface(bar_shape_surface)
Expand Down
6 changes: 0 additions & 6 deletions pygame_gui/elements/ui_screen_space_health_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def __init__(self, relative_rect: pygame.Rect,
self.font = None
self.border_width = None
self.shadow_width = None
self.background_colour = None
self.border_colour = None
self.bar_unfilled_colour = None
self.bar_filled_colour = None
Expand Down Expand Up @@ -237,11 +236,6 @@ def rebuild_from_changed_theme_data(self):
self.shadow_width = shadow_width
has_any_changed = True

background_colour = self.ui_theme.get_colour_or_gradient(self.object_ids, self.element_ids, 'normal_bg')
if background_colour != self.background_colour:
self.background_colour = background_colour
has_any_changed = True

border_colour = self.ui_theme.get_colour_or_gradient(self.object_ids, self.element_ids, 'normal_border')
if border_colour != self.border_colour:
self.border_colour = border_colour
Expand Down

0 comments on commit 0c80fd9

Please sign in to comment.