main.cpp 2.92 KB
Newer Older
1 2
/**********************************************************************************
  This file is part of the game 'KTron'
Stephan Kulow's avatar
Stephan Kulow committed
3

4
  Copyright (C) 1998-2000 by Matthias Kiefer <matthias.kiefer@gmx.de>
Benjamin Meyer's avatar
Benjamin Meyer committed
5
  Copyright (C) 2005 Benjamin C. Meyer <ben at meyerhome dot net>
6
  Copyright (C) 2008-2009 Stas Verberkt <legolas at legolasweb dot nl>
Stephan Kulow's avatar
Stephan Kulow committed
7 8 9 10 11

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
12

Stephan Kulow's avatar
Stephan Kulow committed
13 14 15 16
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.
17

Stephan Kulow's avatar
Stephan Kulow committed
18 19
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
Dirk Mueller's avatar
Dirk Mueller committed
20
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
Stephan Kulow's avatar
Stephan Kulow committed
21

22
  *******************************************************************************/
Laurent Montel's avatar
Laurent Montel committed
23
#include <QApplication>
Laurent Montel's avatar
Port++  
Laurent Montel committed
24 25 26

#include <KLocalizedString>
#include <KAboutData>
Waldo Bastian's avatar
Waldo Bastian committed
27

Laurent Montel's avatar
Port++  
Laurent Montel committed
28 29 30 31
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QStandardPaths>

Waldo Bastian's avatar
Waldo Bastian committed
32
#include "ktron.h"
33
#include "renderer.h"
Stas Verberkt's avatar
Stas Verberkt committed
34
#include "settings.h"
Stas Verberkt's avatar
Stas Verberkt committed
35
#include "version.h"
36

Laurent Montel's avatar
Port++  
Laurent Montel committed
37 38
static QString description = i18n("A race in hyperspace");
static QString notice = i18n("(c) 1998-2000, Matthias Kiefer\n"
39
"(c) 2005, Benjamin Meyer\n"
40
"(c) 2008-2009, Stas Verberkt\n"
41
"\n"
42
"Parts of the algorithms for the computer player are from\n"
43
"xtron-1.1 by Rhett D. Jacobs <rhett@hotel.canberra.edu.au>");
Stephan Kulow's avatar
Stephan Kulow committed
44 45


46 47
int main(int argc, char* argv[])
{
Jonathan Riddell's avatar
Jonathan Riddell committed
48
  KAboutData aboutData( "ksnakeduel", i18n("KSnakeDuel"),
Laurent Montel's avatar
Port++  
Laurent Montel committed
49 50 51 52 53 54 55 56 57 58 59
    KTRON_VERSION, description, KAboutLicense::GPL, notice);
  aboutData.addAuthor(i18n("Matthias Kiefer"), i18n("Original author"), "matthias.kiefer@gmx.de");
  aboutData.addAuthor(i18n("Benjamin Meyer"), i18n("Various improvements"), "ben+ktron@meyerhome.net");
  aboutData.addAuthor(i18n("Stas Verberkt"), i18n("KDE 4 Port, interface revision and KSnake mode"), "legolas@legolasweb.nl");

    QApplication app(argc, argv);
    QCommandLineParser parser;
    KAboutData::setApplicationData(aboutData);
    parser.addVersionOption();
    parser.addHelpOption();
  parser.addOption(QCommandLineOption(QStringList() <<  QLatin1String("snake"), i18n("Start in KSnake mode")));
Stas Verberkt's avatar
Stas Verberkt committed
60

Laurent Montel's avatar
Port++  
Laurent Montel committed
61 62 63
    aboutData.setupCommandLine(&parser);
    parser.process(app);
    aboutData.processCommandLine(&parser);
Waldo Bastian's avatar
Waldo Bastian committed
64

Stas Verberkt's avatar
Stas Verberkt committed
65

Laurent Montel's avatar
Laurent Montel committed
66
  //KStandardDirs::locateLocal("appdata", QLatin1String( "themes/" ));
67

Laurent Montel's avatar
Port++  
Laurent Montel committed
68
  if (parser.isSet("snake"))
Stas Verberkt's avatar
Stas Verberkt committed
69 70 71 72 73 74 75 76
  {
    Settings::setGameType(Settings::EnumGameType::Snake);
  }
  else if (Settings::gameType() == Settings::EnumGameType::Snake)
  {
    Settings::setGameType(Settings::EnumGameType::PlayerVSComputer);
  }

77
  Renderer::self(); // Creates Renderer
78 79 80

  KTron *ktron = new KTron();
  ktron->show();
Stas Verberkt's avatar
Stas Verberkt committed
81

Laurent Montel's avatar
Port++  
Laurent Montel committed
82
  return app.exec();
Stephan Kulow's avatar
Stephan Kulow committed
83 84
}