projects
/
naja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
It isn't always a 4/4 split
[naja.git]
/
naja
/
widgets
/
game_bits.py
diff --git
a/naja/widgets/game_bits.py
b/naja/widgets/game_bits.py
index a5dbeae604c0a576faba7d87d71286b829eda92a..de6c6be04608abc7cd5992ef3fafa777e7de6be8 100644
(file)
--- a/
naja/widgets/game_bits.py
+++ b/
naja/widgets/game_bits.py
@@
-4,8
+4,9
@@
Widget that holds the games's bits.
import pygame
import pygame
-from naja.constants import BIT_SIZE
, BITS
+from naja.constants import BIT_SIZE
from naja.resources import resources
from naja.resources import resources
+from naja.resources.mutators import EIGHT_BIT
from naja.widgets.base import Widget
from naja.widgets.base import Widget
@@
-19,19
+20,20
@@
class GameBitsWidget(Widget):
def prepare(self):
self.surface = pygame.Surface(BIT_SIZE)
def prepare(self):
self.surface = pygame.Surface(BIT_SIZE)
+
health = self.state.gameboard.health
health = self.state.gameboard.health
+ max_health = self.state.gameboard.max_health
wins = self.state.gameboard.wins
wins = self.state.gameboard.wins
+ wins_required = self.state.gameboard.wins_required
bits = []
bits = []
- bits.extend(
- (i < health, 'health', ()) for i in range(4))
- bits.extend(
- (i < wins, 'win', ()) for i in range(4))
+ bits.extend((i < health, 'health') for i in range(max_health))
+ bits.extend((i < wins, 'win') for i in range(wins_required))
- for pos, (is_set, image
, transforms
) in enumerate(bits):
+ for pos, (is_set, image) in enumerate(bits):
img = resources.get_image(
'bits', '%s_%s.png' % (image, 'on' if is_set else 'off'),
img = resources.get_image(
'bits', '%s_%s.png' % (image, 'on' if is_set else 'off'),
- transforms=
transforms
)
+ transforms=
(EIGHT_BIT,)
)
self.surface.blit(img, (img.get_width() * pos, 0))
def draw(self, surface):
self.surface.blit(img, (img.get_width() * pos, 0))
def draw(self, surface):