1 package se
.umu
.cs
.dit06ajnajs
;
4 import java
.io
.IOException
;
7 import java
.util
.logging
.Logger
;
8 import org
.jdom
.JDOMException
;
10 import se
.umu
.cs
.dit06ajnajs
.level
.Level
;
11 import se
.umu
.cs
.dit06ajnajs
.util
.LevelsXMLParser
;
14 * AntiTD loads either the default levels.xml file or a specified file
15 * containing XML-information describing the levels to play. XML-information is
16 * parsed and a List containing the resulted Levels are feeded to a newly
17 * created ATDController.
19 * @author Anton Johansson, dit06ajn@cs.umu.se
23 // The square size to use in the game, should be the same size as the images
24 // used for MapSquares.
25 public static final int SQUARE_SIZE
= 45;
27 // An URL pointing to the default levels.xml file.
28 private static final URL DEFAULT_LEVELS_XML
29 = AntiTD
.class.getResource("/resources/levels.xml");
32 * Starts the game, parses and validates an XML-file containing Level
33 * information. Creates a new ATDController.
35 * @param args if an argument is given this is used as a reference to an
36 * XML-file which should contain Level information. If no argument is given
37 * a default XML-file is used.
39 public static void main(String
[] args
) {
40 Logger
.getLogger("AntiTD").setLevel(java
.util
.logging
.Level
.OFF
);
45 if (args
.length
== 1) {
46 levels
= LevelsXMLParser
.parse(new File(args
[0]));
48 levels
= LevelsXMLParser
.parse(DEFAULT_LEVELS_XML
);
50 new ATDController(levels
);
51 } catch (IOException e
) {
52 System
.err
.println("Couldn't find specified file, argument should "
53 + "point to an XML-file containing level information");
55 } catch (JDOMException e
) {
56 System
.err
.println("Error parsing XML-file containing level information: ");
57 System
.err
.println(e
.getMessage());