Changeset 134:4713a2a3b0be


Ignore:
Timestamp:
Apr 4, 2011, 10:06:07 PM (9 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
rebase_source:
2735b186797ca39978d36368554ef9d335836d8c
Message:

Initial cutscene screen

Location:
skaapsteker
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/menuscene.py

    r133 r134  
    22from pygame.locals import K_ESCAPE, K_q, KEYDOWN, QUIT
    33
     4from .cutscene import opening_cutscene
    45from .engine import ChangeScene, Scene
    56from .levelscene import LevelScene
     
    1718            ('Level 4', 'level4'),
    1819            ('Level 5', 'level5'),
     20            ('Starting Cutscene', 'cutscene'),
    1921            ('Quit', 'quit'),
    2022        ]
     
    2931        if data.startswith('level'):
    3032            ChangeScene.post(LevelScene(self._game_state, data))
    31         elif data == 'quit':
    32             pygame.event.post(pygame.event.Event(QUIT))
    3333        elif data == 'resume':
    3434            self.cur_game.thaw()
    3535            ChangeScene.post(self.cur_game)
     36        elif data == 'cutscene':
     37            ChangeScene.post(opening_cutscene(self._game_state))
     38        elif data == 'quit':
     39            pygame.event.post(pygame.event.Event(QUIT))
    3640
    3741    def draw(self, surface, engine):
  • skaapsteker/widgets/text.py

    r109 r134  
    2020        fonts[(name, size)] = pygame.font.Font(fontfn, size)
    2121    return fonts[(name, size)]
     22
     23# Probably belongs in a utils module
     24def unindent_text(text):
     25    """Reformat docstring-style text blocks."""
     26    text = text.split('\n')
     27    while text[0].strip() == '':
     28        text.pop(0)
     29    while text[-1].strip() == '':
     30        text.pop(-1)
     31    indent = len(text[0]) - len(text[0].lstrip())
     32    indent_chars = text[0][:indent]
     33    for index, line in enumerate(text):
     34        if line.startswith(indent_chars):
     35            text[index] = line[indent:]
     36    return '\n'.join(text)
    2237
    2338
Note: See TracChangeset for help on using the changeset viewer.