Mercurial > boomslang
diff gamelib/custom_widgets.py @ 681:497b6d7c55e7 pyntnclick
Reimplement JIM-style in gamelib
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Sun, 12 Feb 2012 23:57:14 +0200 |
parents | |
children | c8b683dd56d3 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gamelib/custom_widgets.py Sun Feb 12 23:57:14 2012 +0200 @@ -0,0 +1,20 @@ +"""Custom widgets for Suspened Sentence""" + +import pygame +from pyntnclick.widgets.text import ModalWrappedTextLabel + + +class JimLabel(ModalWrappedTextLabel): + """Custom widget for JIM's speech""" + + def __init__(self, gd, mesg): + rect = pygame.Rect((0, 0), (1, 1)) + super(JimLabel, self).__init__(rect, gd, + text=mesg, fontname='Monospace.ttf', fontsize=20, + bg_color=pygame.Color(255, 175, 127, 191), + color=pygame.Color(0, 0, 0), + border_color=pygame.Color(127, 15, 0)) + # Centre the widget + # Should this happen automatically in state? + self.rect.center = (gd.constants.screen[0] / 2, + gd.constants.screen[1] / 2)