From a34fd5a937419278ffe06a8d56153f6ace014fac Mon Sep 17 00:00:00 2001 From: adrianna Date: Thu, 15 May 2014 19:32:37 +0200 Subject: [PATCH] made available tiles an overlay --- data/images/board/tile_available.png | Bin 233 -> 255 bytes naja/widgets/tile.py | 22 +++++++++++++--------- sources/images/square.xcf | Bin 4573 -> 8702 bytes 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/data/images/board/tile_available.png b/data/images/board/tile_available.png index 39485cab6cc2625c448eb4a349496944279dcac3..01bf9495e8b167bfa671504e12dcdcb4e0b56851 100644 GIT binary patch delta 87 zcmaFK_@8k?B4WA)et<(a%LztfpGNy9?f)5S5w;&gICn!zzH$pWtj r0_Mkb4YQ7~kX>BXbIY+y)`Edy$NB8LA&WH%7=Xaj)z4*}Q$iB}qbMLV delta 68 zcmey*_>yr#;>0{Hc6MWKp{b9aOq{QwFXidt7-DfcIl=50pM;w#1hTm?i8C++Xk34p TDY*3u0}yz+`njxgN@xNA84eZ4 diff --git a/naja/widgets/tile.py b/naja/widgets/tile.py index 36b73d0..6606036 100644 --- a/naja/widgets/tile.py +++ b/naja/widgets/tile.py @@ -30,23 +30,27 @@ class TileWidget(Widget): def prepare(self): # Draw background x, y = abs(self.board_pos[0] - 2), abs(self.board_pos[1] - 2) - legal_move = (self.board_pos in self.state.player.legal_moves()) - if self.state.gameboard.player_mode == EXAMINE and legal_move: - bg = resources.get_image('board/tile_available.png', - transforms=(EIGHT_BIT,)) - elif (x + y) % 2 == 0: + + if (x + y) % 2 == 0: bg = resources.get_image('board/tile_2.png', transforms=(EIGHT_BIT,)) else: bg = resources.get_image('board/tile_1.png', transforms=(EIGHT_BIT,)) - overlay = None + overlays = [] + + legal_move = (self.board_pos in self.state.player.legal_moves()) + + if self.state.gameboard.player_mode in (MOVE, EXAMINE) and legal_move: + overlays.append(resources.get_image('board/tile_available.png', + transforms=(EIGHT_BIT,))) if self.highlighted: - overlay = resources.get_image('board/tile_selected.png', - transforms=(EIGHT_BIT,)) + overlays.append(resources.get_image('board/tile_selected.png', + transforms=(EIGHT_BIT,))) + self.surface = pygame.surface.Surface(TILE_SIZE) self.surface.blit(bg, (0, 0)) - if overlay is not None: + for overlay in overlays: self.surface.blit(overlay, (0, 0)) # Look up the required bits on the board location card = self.state.board_locations[self.board_pos] diff --git a/sources/images/square.xcf b/sources/images/square.xcf index 88e66bcaa46ef1c29f677c3cd2708626ac031993..73aa3899dedf5a412adaa998830c6e4e83e0773c 100644 GIT binary patch literal 8702 zcmeHNzmF0@6rP1c?g!_do?021E4)C#0Y(dr1<~SiF(wu!*2}Uin=EhvM6Qy~*2F{` zYh#S1l?^6#R%)TSKf%P}Dr2Mg-ZHC89_B$oLUJ?Y?Y{ZGnQtHaUY5x$u2*#Nr?wgKj6OQkEl!|O+z_e%YKfBV_d;LXp{t>j_Ngzop3gYEa`;KQRQ zUk1bB5XPSZGf-d?Z289HrRQkip8;DMX^V3sKe*6Yz;>a(?m|d8yIHS0jSln!^7PG? zV|AR0eBgCza(D0c9b`6wp&1PoZqZg z+fL_ifH<2%BV>Fk-Uro;A405s72-ly2zf0;;T+~U0shIm9^Ng-cWk)FIOqfzBuQW< zmz9snTv0xp#QBK78u8a6ek$UxM|=}})D2q_9K0SjRUqQUsEfzgYvqSgLv_a9jbpKo z*nbES_E#Y8**-H4hYFwVGvjcr&)i;yCbydai~vIuIRY>O3{B(+zz8rjks|;jz|cgF z0E_@b6FCAf0t`*$2*3z1G?60!Bf!u^jsT1RLlZdyFaiuso`2rx8}BLE}7&_s>^i~vIuIRY>O3{B(+zzK{m@XTO=XLT*lx5~bQ z3ng6NV_SrkUKk66lX@CN^)GzjQm@9b)LZO-5^*8o)0-haPd^xiW5S3Vb2R-0xb*1^ zFy*I9NS6>(BHR;9myj+YT|%?14CcO+$iwOew%%|fbxMPfrXP%=@Y_0sXT#h~e*rFa zIs;7k=@QZ<#FPm41k)v?OGuZ{Y%7DgFD3H0eG|UP!}pKLV0-Ek!i%sSwS|FN zR57M2o6j(baWb+@e$2hDeio`E10w?i&pK2wo_!$xKL%!9W~vkQG%=NUL&dQBX>y6& zYAwDf)NlX=CSM+^7+)QTKe$L>rP?dnR2^gV@2{?hZDJou{Y@jG& zs?Si*$?zX21dBHQ;MAPd