package eu.oschl.schmorn;

import eu.oschl.textadventure.Game;

/**
 * Handles starting either CLI or GUI version of the game
 *
 * @author Ondřej Schlaichert
 */
public class Launcher {
    private static String[] args;

    public static void setArgs(String[] args) {
        Launcher.args = args;
    }

    public static void startGame() {
        var useCli = Launcher.args.length > 0 && args[0].equalsIgnoreCase("--cli");

        if (useCli) {
            startCli(Setup.createGame());
        } else {
            startGui(args);
        }
    }

    private static void startCli(Game game) {
        var session = new eu.oschl.cli.Session(game);
        session.start();
    }

    private static void startGui(String[] args) {
        eu.oschl.gui.Session.launchGui(args);
    }
}
