junglejourney

changeset 151:4eab1c5c40e1

Grouped text items into text boxes, adding support for indentation to allow the quotes to be grouped with normal paragraphs.
author David Boddie <david@boddie.org.uk>
date Tue Sep 13 21:13:01 2011 +0200
parents 71a391aac085
children ac122386cbad
files materials/make_packaging.py
diffstat 1 files changed, 75 insertions(+), 59 deletions(-) [+]
line diff
     1.1 --- a/materials/make_packaging.py	Tue Sep 13 20:36:35 2011 +0200
     1.2 +++ b/materials/make_packaging.py	Tue Sep 13 21:13:01 2011 +0200
     1.3 @@ -46,12 +46,17 @@
     1.4          
     1.5          for text_item in self.text_items:
     1.6          
     1.7 -            for pieces, line_height in text_item.readline(width):
     1.8 +            left_indent = text_item.font.get("left indent", 0)
     1.9 +            right_indent = text_item.font.get("right indent", 0)
    1.10 +            item_x = x + left_indent
    1.11 +            item_width = width - left_indent - right_indent
    1.12 +            
    1.13 +            for pieces, line_height in text_item.readline(item_width):
    1.14              
    1.15                  for font, word_x, text in pieces:
    1.16                  
    1.17                      p.setFont(font)
    1.18 -                    p.drawText(x + word_x, y, text)
    1.19 +                    p.drawText(item_x + word_x, y, text)
    1.20                  
    1.21                  y += line_height
    1.22          
    1.23 @@ -219,13 +224,29 @@
    1.24      
    1.25      italic_quote = {"family": "FreeSerif",
    1.26                      "size": 24,
    1.27 -                    "style": "italic"}
    1.28 +                    "style": "italic",
    1.29 +                    "left indent": 40,
    1.30 +                    "right indent": 40}
    1.31      
    1.32      quote = {"family": "FreeSerif",
    1.33 -             "size": 22}
    1.34 +             "size": 22,
    1.35 +             "left indent": 40,
    1.36 +             "right indent": 40}
    1.37      
    1.38 -    monospace = {"family": "FreeMono",
    1.39 -                 "size": 24}
    1.40 +    monospace_quote = {"family": "FreeMono",
    1.41 +                       "size": 24,
    1.42 +                       "left indent": 40,
    1.43 +                       "right indent": 40}
    1.44 +    
    1.45 +    keys_quote = {"family": "FreeSerif",
    1.46 +                  "size": 24,
    1.47 +                  "left indent": 40,
    1.48 +                  "right indent": 40}
    1.49 +    
    1.50 +    key_descriptions_quote = {"family": "FreeSerif",
    1.51 +                              "size": 24,
    1.52 +                              "left indent": 160,
    1.53 +                              "right indent": 40}
    1.54      
    1.55      pages = [
    1.56          Page((750, 1000),
    1.57 @@ -238,9 +259,8 @@
    1.58                              "sweep the cold face of the moon and I perceive the clicks, whistles and "
    1.59                              "cries of creatures in the hot air that cloaks this place. Desperately, I "
    1.60                              "try to stay my panic and remember those fragments of wilderness craft "
    1.61 -                            "learned and unlearned many years ago.\n")]),
    1.62 -              TextBox((90, 5, 570, 0),
    1.63 -                      [Text(italic_quote,
    1.64 +                            "learned and unlearned many years ago.\n"),
    1.65 +                       Text(italic_quote,
    1.66                              "Choose your weapon carefully,\n"
    1.67                              "Get ready for a fight.\n"
    1.68                              "The jungle can be dangerous\n"
    1.69 @@ -248,77 +268,73 @@
    1.70                              "There's time to pick up treasure,\n"
    1.71                              "But no time to stop and stare.\n"
    1.72                              "If you don't find the hidden gate\n"
    1.73 -                            "You won't get out of there.\n")],
    1.74 -                      follow = True),
    1.75 -              TextBox((50, 5, 650, 0),
    1.76 -                      [Text(regular,
    1.77 +                            "You won't get out of there.\n\n"),
    1.78 +                       Text(regular,
    1.79                              "Hopeless, I scramble to my feet, reaching for any weapon still left to me. "
    1.80                              "Struggling through the dense undergrowth, I search for signs of a track or "
    1.81                              "trail. At first glance, paths that seemed to lead to safety turn out to be "
    1.82                              "impassable, overgrown by tangled and twisted vines. I remember the words of "
    1.83 -                            "an old teacher:\n")],
    1.84 -                      follow = True),
    1.85 -              TextBox((90, 5, 570, 0),
    1.86 -                      [Text(quote,
    1.87 +                            "an old teacher:\n"),
    1.88 +                       Text(quote,
    1.89                              u'\u201cDo not be tempted to use fire to make your way. '
    1.90                              'Many a traveller has strayed from the path, using fire to blaze a trail, '
    1.91                              'only to reach a dead end. Trying to return, they find that the jungle '
    1.92                              'has grown back. Those who are desperate enough will even seek out '
    1.93 -                            u'forgotten routes when the way home is in sight.\u201d\n')],
    1.94 -                      follow = True),
    1.95 -              TextBox((50, 5, 650, 0),
    1.96 -                      [Text(regular,
    1.97 +                            u'forgotten routes when the way home is in sight.\u201d\n\n'),
    1.98 +                       Text(regular,
    1.99                              "Sensing my presence, obscene creatures emerge from the darkness, hungry "
   1.100                              "for prey. Only through skill and luck am I able to dispatch them back "
   1.101                              "into the shadows. Even though I know I must journey deeper into this "
   1.102 -                            "uncharted land to find the way home, the thought of vengeance drives me on.")],
   1.103 -                      follow = True)
   1.104 +                            "uncharted land to find the way home, the thought of vengeance drives me on.")
   1.105 +                      ])
   1.106               ]),
   1.107          Page((750, 1000),
   1.108               [TextBox((50, 40, 650, 0),
   1.109 -                      [Text(title, "Loading the Game\n")]),
   1.110 -              TextBox((50, 5, 640, 0),
   1.111 -                      [Text(regular, "Insert the cassette or disk and type\n")],
   1.112 -                      follow = True),
   1.113 -              TextBox((90, 5, 570, 0),
   1.114 -                      [Text(monospace, "*RUN JUNGLE\n")], follow = True),
   1.115 -              TextBox((50, 0, 640, 0),
   1.116 -                      [Text(regular,
   1.117 +                      [Text(title, "Loading the Game\n"),
   1.118 +                       Text(regular, "Insert the cassette or disk and type\n"),
   1.119 +                       Text(monospace_quote, "*RUN JUNGLE\n"),
   1.120 +                       Text(regular,
   1.121                              "then press Return. If you are loading the game from cassette, press play on the "
   1.122 -                            "cassette recorder. The game should now load.\n")],
   1.123 -                      follow = True),
   1.124 -              TextBox((50, 15, 640, 0),
   1.125 -                      [Text(title, "Playing the Game\n")],
   1.126 -                      follow = True),
   1.127 -              TextBox((50, 5, 640, 0),
   1.128 -                      [Text(regular,
   1.129 -                            "Your character can be moved around the screen by using four control keys:\n")],
   1.130 -                      follow = True),
   1.131 -              TextBox((90, 5, 570, 0),
   1.132 -                      [Text(regular,
   1.133 -                            "Z     left\n"
   1.134 -                            "X     right\n"
   1.135 -                            ":     up\n"
   1.136 -                            "/     down\n")], follow = True),
   1.137 -              TextBox((50, 5, 640, 0),
   1.138 -                      [Text(regular,
   1.139 +                            "cassette recorder. The game should now load.\n\n"),
   1.140 +                       Text(title, "Playing the Game\n"),
   1.141 +                       Text(regular,
   1.142 +                            "Your character can be moved around the screen by using four control keys:\n"),
   1.143 +                       Text(keys_quote,
   1.144 +                            "Z\n"
   1.145 +                            "X\n"
   1.146 +                            ":\n"
   1.147 +                            "/")
   1.148 +                      ]),
   1.149 +              TextBox((50, -keys_quote["size"]*4*1.125, 650, 0),
   1.150 +                      [Text(key_descriptions_quote,
   1.151 +                            "left\n"
   1.152 +                            "right\n"
   1.153 +                            "up\n"
   1.154 +                            "down\n"),
   1.155 +                       Text(regular,
   1.156                              "Enemies can be destroying by the projectiles fired by the player's weapon. "
   1.157                              "To fire a weapon, press the Return key. There are four different types of "
   1.158                              "weapon available in the game.\n\n"
   1.159                              "The player must help the character reach the exit for each level. However, the "
   1.160                              "player must first find a key to unlock the exit. On the final level, the exit "
   1.161                              "does not require a key but it may be obstructed.\n\n"
   1.162 -                            "Other keys can be used to control the game:\n")],
   1.163 -                      follow = True),
   1.164 -              TextBox((90, 5, 570, 0),
   1.165 -                      [Text(regular,
   1.166 -                            "S         enable sound effects\n"
   1.167 -                            "Q         disable sound effects\n"
   1.168 -                            "P         pause the game\n"
   1.169 -                            "O         resume the game\n"
   1.170 -                            "Escape    quits the game, returning to the title screen\n")],
   1.171 -                      follow = True)
   1.172 -              ])
   1.173 +                            "Other keys can be used to control the game:\n"),
   1.174 +                       Text(keys_quote,
   1.175 +                            "S\n"
   1.176 +                            "Q\n"
   1.177 +                            "P\n"
   1.178 +                            "O\n"
   1.179 +                            "Escape")
   1.180 +                      ], follow = True),
   1.181 +              TextBox((50, -keys_quote["size"]*5*1.125, 650, 0),
   1.182 +                      [Text(key_descriptions_quote,
   1.183 +                            "enable sound effects\n"
   1.184 +                            "disable sound effects\n"
   1.185 +                            "pause the game\n"
   1.186 +                            "resume the game\n"
   1.187 +                            "quit the game, returning to the title screen\n")
   1.188 +                      ], follow = True)
   1.189 +             ])
   1.190          ]
   1.191      
   1.192      i = 0