Scroll arrows on (and neater) how to play page
[naja.git] / naja / widgets / text.py
index 02de03fd955be7f9b45324077df7390daa6a8dcd..4cc4272f7435d9a7bf16ef530a3c1bb004a29c7a 100644 (file)
@@ -3,7 +3,7 @@ import pygame.locals as pgl
 
 from naja.constants import FONT, FONT_SIZE, EIGHT_BIT_SCALE, PALETTE, KEYS
 from naja.resources import resources
-from naja.resources.mutators import EIGHT_BIT, blender
+from naja.resources.mutators import EIGHT_BIT, R180, blender
 from naja.utils import convert_colour
 from naja.widgets.base import Widget
 
@@ -104,6 +104,23 @@ class TextWidget(Widget):
             rect = self.pos
             area = self.view_port
         surface.blit(self.surface, rect, area)
+        if self.view_port is not None:
+            self.draw_arrows(surface)
+
+    def draw_arrows(self, surface):
+        if self.view_port.top > 0:
+            up = resources.get_image('bits', 'arrow_on.png',
+                                     transforms=(EIGHT_BIT,))
+            icon_size = up.get_rect().height
+            pos = (self.pos[0] + self.view_port.width - icon_size, self.pos[1])
+            surface.blit(up, pos)
+        if self.view_port.bottom < self.surface.get_rect().bottom:
+            down = resources.get_image('bits', 'arrow_on.png',
+                                       transforms=(R180, EIGHT_BIT))
+            icon_size = down.get_rect().height
+            pos = (self.pos[0] + self.view_port.width - icon_size,
+                   self.pos[1] + self.view_port.height - icon_size)
+            surface.blit(down, pos)
 
 
 class TextBoxWidget(TextWidget):