From afb497fee73e9fdc15da752c4f373feca3b0b57c Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 17 May 2014 12:32:15 +0200 Subject: [PATCH 1/1] double-arrow selector --- naja/widgets/selector.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/naja/widgets/selector.py b/naja/widgets/selector.py index dcbc744..06e63e5 100644 --- a/naja/widgets/selector.py +++ b/naja/widgets/selector.py @@ -3,7 +3,7 @@ import pygame.locals as pgl from naja.constants import KEYS from naja.widgets.base import Container from naja.resources import resources -from naja.resources.mutators import EIGHT_BIT, R270 +from naja.resources.mutators import EIGHT_BIT, R270, R90 from naja.sound import sound @@ -11,19 +11,25 @@ class SelectorWidget(Container): def __init__(self, *args, **kwargs): super(SelectorWidget, self).__init__(*args, **kwargs) self.position = 0 - self.selector = resources.get_image('bits', 'arrow_on.png', - transforms=(R270, EIGHT_BIT)) + self.left_selector = resources.get_image('bits', 'arrow_on.png', + transforms=(R270, EIGHT_BIT)) + self.right_selector = resources.get_image('bits', 'arrow_on.png', + transforms=(R90, EIGHT_BIT)) def render(self, surface): super(SelectorWidget, self).render(surface) - pos = self.selector.get_rect() + pos = self.left_selector.get_rect() selected = self.widgets[self.position] if not selected.is_selectable(): selected = self.change_pos(1) pos = pos.move(selected.pos) - pos = pos.move(-pos.width * 1.5, (selected.size[1] - pos.height) / 2) - surface.blit(self.selector, pos) + left_pos = pos.move(-pos.width * 1.5, + (selected.size[1] - pos.height) / 2) + right_pos = pos.move(selected.size[0] + pos.width * 0.5, + (selected.size[1] - pos.height) / 2) + surface.blit(self.left_selector, left_pos) + surface.blit(self.right_selector, right_pos) def change_pos(self, change): self.position = (self.position + change) % len(self.widgets) -- 2.34.1