Skip to content

Commit 986c90e

Browse files
committed
tiled support
1 parent 0f1ad08 commit 986c90e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+403
-0
lines changed

config_spec.ini

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[Base]
2+
ressource_path = string()
3+
script_path = string()
4+
5+
[Ressources]
6+
map1 = string()
7+
map2 = string()
8+
map3 = string()
9+
10+
[Text]
11+
font_name = string()
12+
font_size = integer()
13+
14+
[Window]
15+
width = integer()
16+
height = integer()

configobj_ext.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from configobj import ConfigObj, Section, flatten_errors
2+
from validate import Validator
3+
4+
def read_config(path, configspec=None):
5+
monkey_patch_section(Section) # dark stuff
6+
config = ConfigObj(path, configspec = configspec)
7+
validator = Validator()
8+
result = config.validate(validator)
9+
assert result == True
10+
return config
11+
12+
def pp_errors(config, errors):
13+
for (section_list, key, _) in flatten_errors(config, errors):
14+
if key is not None:
15+
print 'The "%s" key in the section "%s" failed validation' % (key, ', '.join(section_list))
16+
else:
17+
print 'The following section was missing:%s ' % ', '.join(section_list)
18+
19+
def monkey_patch_section(cls):
20+
def getattr(self, key):
21+
return self[key] if key in self else super(cls, self).__getattr__(self, key)
22+
cls.__getattr__ = getattr
23+
return cls
16.6 KB
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
87.7 KB
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
85.3 KB
Binary file not shown.
10.9 KB
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
18.9 KB
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
29.8 KB
61 KB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.
1.17 MB
Binary file not shown.

ressources/img/src/tiles.xcf

16.9 KB
Binary file not shown.

ressources/img/tiles.png

3.29 KB

ressources/map/test.tmx

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<map version="1.0" orientation="orthogonal" width="10" height="10" tilewidth="32" tileheight="32">
3+
<tileset firstgid="1" name="base_color" tilewidth="32" tileheight="32">
4+
<image source="../img/tiles.png" width="64" height="64"/>
5+
</tileset>
6+
<layer name="Tile Layer 1" width="10" height="10">
7+
<data encoding="base64" compression="gzip">
8+
H4sIAAAAAAAAA2NiYGBgJICZkNgsODAjFjXMaBhdLbIaJihGVouujgkNU6qOGHuJ8Qcx4cLEQFw4AwB/XbNekAEAAA==
9+
</data>
10+
</layer>
11+
</map>

ressources/map/test2.tmx

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<map version="1.0" orientation="orthogonal" width="20" height="20" tilewidth="32" tileheight="32">
3+
<tileset firstgid="1" name="base_color" tilewidth="32" tileheight="32">
4+
<image source="../img/tiles.png" width="64" height="64"/>
5+
</tileset>
6+
<layer name="Tile Layer 1" width="20" height="20">
7+
<data encoding="base64" compression="gzip">
8+
H4sIAAAAAAAAA83SSwoAIAgEUMHuf+a2MtjPGapFBJEPrXEzc3I12FkrrlfW6L7SjMaJh3XYV9XDmsyseNncrDfrU5lBhbfK1G1vlm3Gq+Zlx1V6v/1HfDvVvJmh8PCsA36gifRABgAA
9+
</data>
10+
</layer>
11+
</map>

ressources/map/test3.tmx

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<map version="1.0" orientation="orthogonal" width="20" height="20" tilewidth="40" tileheight="40">
3+
<tileset firstgid="1" name="PAVE" tilewidth="40" tileheight="40" spacing="40" margin="40">
4+
<image source="../img/2D Circle Graphic/PAVE.bmp" width="640" height="480"/>
5+
</tileset>
6+
<tileset firstgid="49" name="GRS2ROC" tilewidth="40" tileheight="40" margin="40">
7+
<image source="../img/2D Circle Graphic/GRS2ROC.bmp" width="640" height="480"/>
8+
</tileset>
9+
<tileset firstgid="214" name="TABLE1" tilewidth="40" tileheight="40" margin="40">
10+
<image source="../img/2D Circle Graphic/TABLE1.GIF" width="640" height="480"/>
11+
</tileset>
12+
<tileset firstgid="379" name="CLIFVEG2" tilewidth="40" tileheight="40" margin="40">
13+
<image source="../img/2D Circle Graphic/CLIFVEG2.bmp" width="640" height="480"/>
14+
</tileset>
15+
<layer name="first" width="20" height="20" visible="0">
16+
<data encoding="base64" compression="gzip">
17+
H4sIAAAAAAAAA3NjYGBwG8HYAYidgNiFSubFAXECFDuhYXLsAJnHCcRcSJgban4SmeYJAjETEDMDMQsQCw9z8ySBWAoJS1NgXg0Q1+HADWSYN4pH8VDGAB58eS9ABgAA
18+
</data>
19+
</layer>
20+
<layer name="Copy of first" width="20" height="20">
21+
<data encoding="base64" compression="gzip">
22+
H4sIAAAAAAAAA2NgGAXkADcoHkjzkqhsHiGzqOlfWoDB7j5qA2r41w2NHgWjABtww4EBBHZdr0AGAAA=
23+
</data>
24+
</layer>
25+
<layer name="2" width="20" height="20" visible="0">
26+
<data encoding="base64" compression="gzip">
27+
H4sIAAAAAAAAA2NgGAUjEVwD4htAfItK5n0B4m9A/INK5gkxMjCIALEYI5UMHAWjYBRQHQAAsLPPOUAGAAA=
28+
</data>
29+
</layer>
30+
</map>

0 commit comments

Comments
 (0)