-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
41 lines (36 loc) · 1.08 KB
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import com.trolltech.qt.gui.QApplication;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
/**
* Starts the Game
*/
public class Main {
/*
* If the first parameter is 'gui', then the game will start with a GUI.
* */
public static void main(String[] args){
Controller controller;
QApplication app = null;
if (args.length != 0 && args[0].equals("console")) {
controller = new ConsoleController();
}else{
app = new QApplication(args);
controller = new GuiController();
}
Path savePath = Paths.get(new File("").getAbsolutePath().concat("\\savegames"));
System.out.println(savePath.toString());
if (Files.notExists(savePath)){
try {
Files.createDirectory(savePath);
} catch (IOException e){}
}
controller.setSavegamePath(savePath);
if (args.length != 0 && args[0].equals("console")) {
} else {
app.exec();
}
}
}