2 # -*- coding: utf-8 -*-
6 This is the pygame minimal example.
10 __revision__
= "$Rev$"
11 __version__
= "3.0.0." + __revision__
[6:-2]
12 __author__
= 'DR0ID @ 2009-2011'
25 # -----------------------------------------------------------------------------
33 path_to_map
= os
.path
.join(os
.pardir
, "001-1.tmx")
34 print(("usage: python %s your_map.tmx\n\nUsing default map '%s'\n" % \
35 (os
.path
.basename(__file__
), path_to_map
)))
39 demo_pygame(path_to_map
)
41 # -----------------------------------------------------------------------------
43 def demo_pygame(file_name
):
45 Example showing how to load a map.
48 # parser the map (it is done here to initialize the
49 # window the same size as the map if it is small enough)
50 world_map
= tiledtmxloader
.tmxreader
.TileMapParser().parse_decode(file_name
)
53 print("loaded map:", world_map
.map_file_name
)
55 # let see how many pixels it will use
56 x_pixels
= world_map
.pixel_width
57 y_pixels
= world_map
.pixel_height
58 print("map size in pixels:", x_pixels
, y_pixels
)
61 # let see the tilesize
62 print("tile size used:", world_map
.tilewidth
, world_map
.tileheight
)
65 print("tiles used:", world_map
.width
, world_map
.height
)
68 print("found '", len(world_map
.layers
), "' layers on this map")
70 # # just to see if the map was loaded correctly we print
71 # # it on the console, warning: may be huge output!
72 # # tiledtmxloader.tmxreader.printer(world_map)
74 # -----------------------------------------------------------------------------
76 if __name__
== '__main__':