Subversion Repositories sokoban

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 daniel-mar 1
package gdi1sokoban.main;
2
 
3
import java.io.IOException;
4
import java.net.URISyntaxException;
5
 
6
import gdi1sokoban.exceptions.InternalFailureException;
7
import gdi1sokoban.exceptions.ParameterOutOfRangeException;
8
import gdi1sokoban.exceptions.ParseException;
9
import gdi1sokoban.game.GameEngine;
10
import gdi1sokoban.gui.SokobanWindow;
11
 
12
/**
13
 * Sokoban v1.0
14
 * @author Samuel Kniesz, Victor Negoescu, Paul Ruchniewicz, Holger Thies
15
 * Sokoban Game
16
 *
17
 */
18
 
19
public class Sokoban {
20
        private static GameEngine engine;
21
        /**
22
         * @return engine
23
         */
24
        public static GameEngine getEngine() {
25
                return engine;
26
        }
27
 
28
        /**
29
         * @param args
30
         */
31
        public static void main(final String[] args) {
32
                // Game-Engine starten
33
                try {
34
                        final SokobanWindow gameGui = new SokobanWindow("Yocto Software Solutions - Sokoban");
35
                        startEngine(gameGui);
36
 
37
                        // show Window
38
                        gameGui.setVisible(true);
39
                        // load standard skin
40
                        gameGui.getGamePanel().loadSkin(1);
41
                        //      start Game
42
                        engine.newGame();
43
                } catch (final IOException e) {
44
                        System.err.println("Interne Ausnahmebedingung: I/O Error");
45
                        e.printStackTrace();
46
                } catch (final ParameterOutOfRangeException e) {
47
                        System.err.println("Interne Ausnahmebedingung: Ungültiger Parameter");
48
                        e.printStackTrace();
49
                } catch (final URISyntaxException e) {
50
                        System.err.println("Interne Ausnahmebedingung: Dateipfad-Fehler");
51
                        e.printStackTrace();
52
                } catch (final InternalFailureException e) {
53
                        System.err.println("Interne Ausnahmebedingung: Unbekannter interner Fehler");
54
                        e.printStackTrace();
55
                } catch (ParseException e) {
56
                        System.err.println("Ausnahmebedingung: Leveldatei fehlerhaft");
57
                        e.printStackTrace();
58
                }
59
        }
60
 
61
        /**
62
         * starts the game Engine
63
         * @param gameGui the gui with which the engine shall be started
64
         */
65
        public static void startEngine(final SokobanWindow gameGui){
66
                try {
67
                        engine = new GameEngine(gameGui);
68
                } catch (final InternalFailureException e) {
69
                        System.err.println("Interne unbehandelte Ausnahmebedingung: Unbekannter interner Fehler");
70
                        e.printStackTrace();
71
                }
72
        }
73
}