annotate mamba/constants.py @ 561:9afaa1969d6f

Level format 2 support * * * Allow for blank author * * * Fix thinko in write code
author Neil Muller <drnlmuller@gmail.com>
date Tue, 18 Oct 2011 11:41:28 +0200
parents 4be447ecf53d
children b94f3db7bc90
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
228
d83fd4ebddd3 Add entrybox widget
Neil Muller <drnlmuller@gmail.com>
parents: 199
diff changeset
1 from pygame.locals import K_ESCAPE, K_q, K_BACKSPACE, K_DELETE
3
6b9fa5e2fbc6 Add initial window that does very little
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
2
561
9afaa1969d6f Level format 2 support
Neil Muller <drnlmuller@gmail.com>
parents: 526
diff changeset
3 # version tuple for maps
9afaa1969d6f Level format 2 support
Neil Muller <drnlmuller@gmail.com>
parents: 526
diff changeset
4 # NB: We only compare on the first two elements of the version when loading
9afaa1969d6f Level format 2 support
Neil Muller <drnlmuller@gmail.com>
parents: 526
diff changeset
5 # levels - this is so levels saved by later point releases are loadable by
9afaa1969d6f Level format 2 support
Neil Muller <drnlmuller@gmail.com>
parents: 526
diff changeset
6 # older versions. So changing the level format (new sprite, etc.) is not
9afaa1969d6f Level format 2 support
Neil Muller <drnlmuller@gmail.com>
parents: 526
diff changeset
7 # acceptable in a point release
9afaa1969d6f Level format 2 support
Neil Muller <drnlmuller@gmail.com>
parents: 526
diff changeset
8 VERSION = (0, 2, 0)
9afaa1969d6f Level format 2 support
Neil Muller <drnlmuller@gmail.com>
parents: 526
diff changeset
9
62
40be38f4427c Bug squashing.
Simon Cross <hodgestar@gmail.com>
parents: 52
diff changeset
10 # Display constants
3
6b9fa5e2fbc6 Add initial window that does very little
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
11 SCREEN = (800, 600)
62
40be38f4427c Bug squashing.
Simon Cross <hodgestar@gmail.com>
parents: 52
diff changeset
12 EDIT_SCREEN = (1000, 600)
50
1b725035b8ef Levels that are visible.
Jeremy Thurgood <firxen@gmail.com>
parents: 39
diff changeset
13 TILE_SIZE = (20, 20)
3
6b9fa5e2fbc6 Add initial window that does very little
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
14
62
40be38f4427c Bug squashing.
Simon Cross <hodgestar@gmail.com>
parents: 52
diff changeset
15 # Miscellaneous constants
526
4be447ecf53d Change name
Neil Muller <drnlmuller@gmail.com>
parents: 495
diff changeset
16 NAME = "Mutable Mamba"
450
f81c2ad8929b Set pygame window icon.
Simon Cross <hodgestar@gmail.com>
parents: 402
diff changeset
17 WINDOW_ICON = "icons/program/icon_24.png"
122
45dd79e9ba1b Rudimentary FPS and clock ticking.
Simon Cross <hodgestar@gmail.com>
parents: 75
diff changeset
18 FPS = 60
345
04bb1ffcd054 Activated ctpug level server.
Simon Cross <hodgestar@gmail.com>
parents: 270
diff changeset
19 LEVEL_SERVER = "http://ctpug.org.za/mamba/"
495
13639277c290 Add commented out local server to constants for testing.
Simon Cross <hodgestar@gmail.com>
parents: 459
diff changeset
20 # LEVEL_SERVER = "http://localhost:5000/"
52
d09f63429b80 Add screen size fiddling to editor habitat
Neil Muller <drnlmuller@gmail.com>
parents: 50
diff changeset
21
3
6b9fa5e2fbc6 Add initial window that does very little
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
22 # Sound constants
6b9fa5e2fbc6 Add initial window that does very little
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
23 FREQ = 44100 # same as audio CD
6b9fa5e2fbc6 Add initial window that does very little
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
24 BITSIZE = -16 # unsigned 16 bit
6b9fa5e2fbc6 Add initial window that does very little
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
25 CHANNELS = 2 # 1 == mono, 2 == stereo
6b9fa5e2fbc6 Add initial window that does very little
Neil Muller <drnlmuller@gmail.com>
parents:
diff changeset
26 BUFFER = 1024 # audio buffer size in no. of samples
17
236de980209a Add simple command line processing
Neil Muller <drnlmuller@gmail.com>
parents: 3
diff changeset
27
62
40be38f4427c Bug squashing.
Simon Cross <hodgestar@gmail.com>
parents: 52
diff changeset
28 # Keyboard constants
367
35a46716ffdd By popular demand (jeremy) backspace goes back a menu
Stefano Rivera <stefano@rivera.za.net>
parents: 366
diff changeset
29 ESCAPE_KEYS = (K_ESCAPE, K_q, K_BACKSPACE)
228
d83fd4ebddd3 Add entrybox widget
Neil Muller <drnlmuller@gmail.com>
parents: 199
diff changeset
30 DELETE_KEYS = (K_BACKSPACE, K_DELETE)
62
40be38f4427c Bug squashing.
Simon Cross <hodgestar@gmail.com>
parents: 52
diff changeset
31
75
ac6688820528 Move font name to constants, for future configurablity
Neil Muller <drnlmuller@gmail.com>
parents: 62
diff changeset
32 # For easy access later
ac6688820528 Move font name to constants, for future configurablity
Neil Muller <drnlmuller@gmail.com>
parents: 62
diff changeset
33 DEFAULT_FONT = 'DejaVuSans.ttf'
155
9afea431af36 Move common widget defauts (mainly colours) to constants
Stefano Rivera <stefano@rivera.za.net>
parents: 122
diff changeset
34 FONT_SIZE = 16
9afea431af36 Move common widget defauts (mainly colours) to constants
Stefano Rivera <stefano@rivera.za.net>
parents: 122
diff changeset
35
9afea431af36 Move common widget defauts (mainly colours) to constants
Stefano Rivera <stefano@rivera.za.net>
parents: 122
diff changeset
36 # Colours
459
7278518bde8d No yellow, no
Stefano Rivera <stefano@rivera.za.net>
parents: 450
diff changeset
37 FOCUS_COLOR = 'red'
155
9afea431af36 Move common widget defauts (mainly colours) to constants
Stefano Rivera <stefano@rivera.za.net>
parents: 122
diff changeset
38 COLOR = 'black'
75
ac6688820528 Move font name to constants, for future configurablity
Neil Muller <drnlmuller@gmail.com>
parents: 62
diff changeset
39
270
3c95ba7408f1 Add protected level name list. Add load & new buttons
Neil Muller <drnlmuller@gmail.com>
parents: 228
diff changeset
40 # Special level directory files
402
001c3797a63b Editor now uses templates and the user level directory.
Jeremy Thurgood <firxen@gmail.com>
parents: 367
diff changeset
41 RESERVED_NAMES = ['index']
270
3c95ba7408f1 Add protected level name list. Add load & new buttons
Neil Muller <drnlmuller@gmail.com>
parents: 228
diff changeset
42
199
986e72d2cb4d Rejiggered entrances and shifted directions around.
Jeremy Thurgood <firxen@gmail.com>
parents: 166
diff changeset
43 # Directions
986e72d2cb4d Rejiggered entrances and shifted directions around.
Jeremy Thurgood <firxen@gmail.com>
parents: 166
diff changeset
44 UP, DOWN, LEFT, RIGHT = [(0, -1), (0, 1), (-1, 0), (1, 0)]
986e72d2cb4d Rejiggered entrances and shifted directions around.
Jeremy Thurgood <firxen@gmail.com>
parents: 166
diff changeset
45
62
40be38f4427c Bug squashing.
Simon Cross <hodgestar@gmail.com>
parents: 52
diff changeset
46 # Default command-line options
17
236de980209a Add simple command line processing
Neil Muller <drnlmuller@gmail.com>
parents: 3
diff changeset
47 DEFAULTS = {
39
3ab5097e8757 Refactor options.
Simon Cross <hodgestar@gmail.com>
parents: 17
diff changeset
48 'debug': False,
17
236de980209a Add simple command line processing
Neil Muller <drnlmuller@gmail.com>
parents: 3
diff changeset
49 'sound': True,
236de980209a Add simple command line processing
Neil Muller <drnlmuller@gmail.com>
parents: 3
diff changeset
50 'level': None,
362
cc8be536a7fc Add ability to play uncurated levels via the command line.
Simon Cross <hodgestar@gmail.com>
parents: 345
diff changeset
51 'uncurated': None,
366
d759f49c477d Option for printing list of uncurated levels.
Simon Cross <hodgestar@gmail.com>
parents: 362
diff changeset
52 'list_uncurated': False,
17
236de980209a Add simple command line processing
Neil Muller <drnlmuller@gmail.com>
parents: 3
diff changeset
53 'edit': False,
166
bea4857487de Game state and level list
Stefano Rivera <stefano@rivera.za.net>
parents: 155
diff changeset
54 'save_location': None, # Determined by a function in options
17
236de980209a Add simple command line processing
Neil Muller <drnlmuller@gmail.com>
parents: 3
diff changeset
55 }