From 9e4dfdc16ddb9e010eea90a59e8dd8202656abbf Mon Sep 17 00:00:00 2001 From: Nick Dyer Date: Fri, 4 Jun 2021 23:59:10 -0400 Subject: [PATCH] added arrows to scrolling, added arrow images --- pocket_friends/game_files/game.py | 13 ++++++++++++- .../resources/images/gui/down_arrow.png | Bin 0 -> 217 bytes .../game_files/resources/images/gui/up_arrow.png | Bin 0 -> 213 bytes 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 pocket_friends/game_files/resources/images/gui/down_arrow.png create mode 100644 pocket_friends/game_files/resources/images/gui/up_arrow.png diff --git a/pocket_friends/game_files/game.py b/pocket_friends/game_files/game.py index 4668ece..9fcb6b6 100644 --- a/pocket_friends/game_files/game.py +++ b/pocket_friends/game_files/game.py @@ -132,6 +132,11 @@ class InfoText: self.text = [] # Text broken up into a list according to how it will fit on screen. self.max_lines = 6 # Max number of lines to be shown on screen at a time. self.offset = 0 + + # Arrow icons to indicate scrolling + self.up_arrow = pygame.image.load(script_dir + '/resources/images/gui/up_arrow.png').convert_alpha() + self.down_arrow = pygame.image.load(script_dir + '/resources/images/gui/down_arrow.png').convert_alpha() + raw_text = text # Copy the text to a different variable to be cut up. max_line_width = 71 # The maximum pixel width that drawn text can be. @@ -198,7 +203,13 @@ class InfoText: for i in range(min(len(self.text), self.max_lines)): text = self.font.render(self.text[i + self.offset], False, (64, 64, 64)) - surface.blit(text, (3, 22 + (i * 7))) + surface.blit(text, (3, 25 + (i * 7))) + + # Draw the arrows if there is more text than is on screen. + if self.offset != 0: + surface.blit(self.up_arrow, (36, 22)) + if len(self.text) - (self.offset + 1) >= self.max_lines: + surface.blit(self.down_arrow, (36, 70)) def scroll_down(self): """ diff --git a/pocket_friends/game_files/resources/images/gui/down_arrow.png b/pocket_friends/game_files/resources/images/gui/down_arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..adf337ebb9513a795f81e585d3cc4b69ad96a947 GIT binary patch literal 217 zcmeAS@N?(olHy`uVBq!ia0vp^96-#*!3HG%vEKg;;v{*yy8vk*`02d69!PN(ctjR6 zFz6|RFk{71`!b*)dx@v7EBjM6R%SiJte8nYKq1Kz*N775{M_8syb=cIqSVBa)D(sC z%#sWRcTeAd@J2pypdv?47sn8e>$QC+c^M3OnABf(3EiD$KV@o7QQi{S&VEOU9huJE zMRF>P3BUP#9(U(z1>^_|_FHm&`+p{9(mdJy%GN9jlE$6J``LkpF?hQAxvXJjtt8pA^n$5>p2hfx_4Dh yOJkcY-zPwqQPl@Yce+