]> Skullheadx's Git Forge - word-hunt.git/commitdiff
timer box added
authorSkullheadx <94652084+Skullheadx@users.noreply.github.com>
Fri, 25 Nov 2022 16:02:25 +0000 (11:02 -0500)
committerSkullheadx <94652084+Skullheadx@users.noreply.github.com>
Fri, 25 Nov 2022 16:02:25 +0000 (11:02 -0500)
.idea/misc.xml
.idea/word-hunt.iml
Main/__pycache__/board.cpython-310.pyc
Main/__pycache__/game.cpython-310.pyc
Main/__pycache__/setup.cpython-310.pyc
Main/__pycache__/tile.cpython-310.pyc
Main/__pycache__/timer.cpython-310.pyc
Main/__pycache__/word_connector.cpython-310.pyc
Main/__pycache__/words_display.cpython-310.pyc
Main/game.py
Main/timer.py

index a4652f355e26c43a58fbff0f10cd661868d00976..d8a3dd862ab749b9d47a3524c1bf032024a561e9 100644 (file)
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
-  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (venv)" project-jdk-type="Python SDK" />
+  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (word-hunt)" project-jdk-type="Python SDK" />
 </project>
\ No newline at end of file
index 7efdecd328a17c536c884ecbc5c9748187a461a1..a3fe4f9401ce578136d15c7f3bce857b3938e3a4 100644 (file)
@@ -5,7 +5,7 @@
       <excludeFolder url="file://$MODULE_DIR$/Main/venv" />
       <excludeFolder url="file://$MODULE_DIR$/venv" />
     </content>
-    <orderEntry type="jdk" jdkName="Python 3.10 (venv)" jdkType="Python SDK" />
+    <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
   </component>
 </module>
\ No newline at end of file
index d6f0cae572b428c499ff5a12ee4d2de00d971e20..8f37252d064ad83dc1306458531ecbebef240ac0 100644 (file)
Binary files a/Main/__pycache__/board.cpython-310.pyc and b/Main/__pycache__/board.cpython-310.pyc differ
index 186ed23bc977075391b726a3481a9c2cdcf4df8f..851c75d07bb0e7c07e411a5164b3e8db12ed3820 100644 (file)
Binary files a/Main/__pycache__/game.cpython-310.pyc and b/Main/__pycache__/game.cpython-310.pyc differ
index 34c28cf2aa5a7e90e43eb525e1639659909555c9..800458e329af3a0f5b2059fd6a639f2453d9dd37 100644 (file)
Binary files a/Main/__pycache__/setup.cpython-310.pyc and b/Main/__pycache__/setup.cpython-310.pyc differ
index 45cfd25fe0feff68f4e4671701de1ea96910b3fc..44094fe81dc883e2e25cb41db4ee14ce47cfe7f0 100644 (file)
Binary files a/Main/__pycache__/tile.cpython-310.pyc and b/Main/__pycache__/tile.cpython-310.pyc differ
index 7dd974ea0b946be8ee890cce2b75c77a5a4fda77..95bcd967e30b66ae108800efc971473b2b15fd76 100644 (file)
Binary files a/Main/__pycache__/timer.cpython-310.pyc and b/Main/__pycache__/timer.cpython-310.pyc differ
index e4da1227ac47bb17e62f70e2bee295e727b1cd0f..4d258cd58aa32ffcfa0bff51e65c819f64fe547d 100644 (file)
Binary files a/Main/__pycache__/word_connector.cpython-310.pyc and b/Main/__pycache__/word_connector.cpython-310.pyc differ
index b4b7b646cec561affd509f00796f30671bef0c03..be2ef95b818154bb547cc3ac7a6c017f5350c9fc 100644 (file)
Binary files a/Main/__pycache__/words_display.cpython-310.pyc and b/Main/__pycache__/words_display.cpython-310.pyc differ
index dbbba98c15450b51446b9361142810b0f450a91c..097563a0a4ffad9e93448522719bfbc69eb6e24e 100644 (file)
@@ -49,7 +49,7 @@ class Game:
         self.word_connector = WordConnector()
         self.bg_colour = Colour.LIGHT_GRAY
         self.unknown_word_display = UnknownWordDisplay((SCREEN_WIDTH*2/3-UnknownWordDisplay.inset,self.board.position.y),self.word_frequency)
-        self.timer = Timer(self.unknown_word_display.position + pygame.Vector2(0, self.unknown_word_display.get_rect().height/2 + self.word_disp_separation_distance))
+        self.timer = Timer(self.unknown_word_display.position + pygame.Vector2(0, self.unknown_word_display.get_rect().height/2 ))
 
     def update(self, delta):
         self.word += self.board.update(delta, self.bg_colour, self.points)
index c7b1b0c82f1b1690481064cc7808287870233da0..af755b00c0dc05df0144dae0ac5c20f68f20dbec 100644 (file)
@@ -4,16 +4,25 @@ from setup import *
 class Timer:
     font = pygame.font.Font("font/Silkscreen-Regular.ttf", 30)
 
+    inset = 15
+    edge_radius = 10
+    bezel = 4
+
     def __init__(self, position):
         self.position = pygame.Vector2(position)
         self.time = 120 # 120 seconds
         self.text = self.font.render(f"{self.time//60}:{'%.2f' % (self.time % 60)}",True,Colour.BLACK)
 
     def update(self,delta):
-        self.time = max(0, self.time - delta/1000)
         mins, secs = divmod(int(self.time), 60)
         timer = '{:02d}:{:02d}'.format(mins, secs)
         self.text = self.font.render(f"{timer}",True,Colour.BLACK)
+        self.time = max(0, self.time - delta/1000)
+
+    def get_rect(self):
+        return pygame.Rect(self.position.x - self.inset, self.position.y, self.text.get_width() + 2 * self.inset, self.text.get_height())
 
     def draw(self, surf):
+        pygame.draw.rect(surf,Colour.LIGHT_GRAY,self.get_rect(),border_radius=self.edge_radius)
+        pygame.draw.rect(surf,Colour.DARK_GRAY,self.get_rect(),width= self.bezel,border_radius=self.edge_radius)
         surf.blit(self.text, self.text.get_rect(topleft =self.position))