Mercurial > pyntnclick
diff gamelib/gamescreen.py @ 78:6bfebfbce42e
Partial message support
author | Neil Muller <neil@dip.sun.ac.za> |
---|---|
date | Mon, 23 Aug 2010 23:05:55 +0200 |
parents | 1a5fdc225939 |
children | 4fd56ee2af61 |
line wrap: on
line diff
--- a/gamelib/gamescreen.py Mon Aug 23 22:42:30 2010 +0200 +++ b/gamelib/gamescreen.py Mon Aug 23 23:05:55 2010 +0200 @@ -5,7 +5,7 @@ from albow.controls import Button, Label, Widget from albow.layout import Column from albow.palette_view import PaletteView -from albow.dialogs import Dialog +from albow.dialogs import Dialog, wrapped_label from pygame import Rect from pygame.color import Color from pygame.locals import BLEND_ADD @@ -54,7 +54,15 @@ self.state.draw(surface) def mouse_down(self, event): - self.state.interact(event.pos) + result = self.state.interact(event.pos) + if result and result.message: + # Display the message as a modal dialog + msg_label = wrapped_label(result.message, 60) + dialog = Dialog(msg_label) + dialog.click_outside_response = -1 + dialog.present() + # queue a redraw to show updated state + self.invalidate() def mouse_move(self, event): self.state.mouse_move(event.pos)