From: <ch...@us...> - 2009-02-22 10:59:53
|
Revision: 278 http://virtplayground.svn.sourceforge.net/virtplayground/?rev=278&view=rev Author: chozone Date: 2009-02-22 10:59:48 +0000 (Sun, 22 Feb 2009) Log Message: ----------- You will now see an image when you have multiple lines in your input. Modified Paths: -------------- trunk/VP/modules/input.py Added Paths: ----------- trunk/VP/images/Input/ trunk/VP/images/Input/multiple.png Added: trunk/VP/images/Input/multiple.png =================================================================== (Binary files differ) Property changes on: trunk/VP/images/Input/multiple.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/VP/modules/input.py =================================================================== --- trunk/VP/modules/input.py 2009-02-10 19:17:47 UTC (rev 277) +++ trunk/VP/modules/input.py 2009-02-22 10:59:48 UTC (rev 278) @@ -14,6 +14,7 @@ fontEndObj = pygame.font.Font(getRealDir('fonts', 'Bitstream Vera Sans.ttf'), 15) fontEndObj.set_bold(True) self.textEnd = fontEndObj.render('|', True, (0,130,21)) + self.multipleLines = loadImage('images', 'Input', 'multiple.png')[0] self.inputText = '' @@ -109,16 +110,21 @@ textSurf = self.fontObj.render(visibleLine , True, (0,0,0)) textLength = textSurf.get_width() - - if textLength < 350: + textWidth = 350 if len(self.inputText.split('\n')) == 1 else 340 #So we have 10px more for the icon, when there are multiple lines + + if textLength < textWidth: pos = 0 cursorPos = textLength else: - pos = textLength - 350 - cursorPos = 350 + pos = textLength - textWidth + cursorPos = textWidth - area = (pos, 0, 350, textSurf.get_height()) + area = (pos, 0, textWidth, textSurf.get_height()) + if len(self.inputText.split('\n'))>1: + #Multiple lines, let's show that cool icon! + self.surf.blit(self.multipleLines, (355, 4)) + self.surf.blit(textSurf, (12,4), area) self.surf.blit(self.textEnd, (10+cursorPos, 2)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |