summaryrefslogtreecommitdiffstats
path: root/ksirtet/ksirtet/main.cpp
blob: c586c0960686dfda5c6654fcd9ab1b473436a618 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include "main.h"
#include "main.moc"

#include <tdelocale.h>
#include <tdeapplication.h>
#include <highscore/khighscore.h>

#include "common/inter.h"
#include "common/highscores.h"
#include "prefs.h"
#include "piece.h"


//-----------------------------------------------------------------------------
const MPGameInfo MP_GAME_INFO = {
    "006", // multiplayer id (increase when incompatible changes are made)
    4,     // max nb local games
    500,   // interval
    true,  // IA allowed
    0, 0   // no setting slots
};

const MainData MAIN_DATA = {
    "ksirtet",
    I18N_NOOP("KSirtet"),
    I18N_NOOP("KSirtet is an adaptation of the well-known Tetris game"),
    "http://ksirtet.sourceforge.net/",
    I18N_NOOP("Removed Lines"),
    "2.1.11b",
    "2.1.11b (1 September 2005)"
};

const uint HISTOGRAM_SIZE = 8;
const uint HISTOGRAM[HISTOGRAM_SIZE] = {
    1, 5000, 10000, 20000, 50000, 100000, 200000, 300000
};

const BaseBoardInfo BASE_BOARD_INFO = {
    KSBoard::Width, 22, // width - height
    true, // with pieces

    150,  // before remove time
    10,   // after remove time
    3,    // nb toggles
    5,    // nb partial fall stages

    KSBoard::Nb_Stages, // nb arcade stages

    HISTOGRAM, HISTOGRAM_SIZE, false, // score is not bound
};

const CommonBoardInfo COMMON_BOARD_INFO = {
    1000, // base time
    20,   // drop down time
    10,   // before glue time
    10,   // after glue time
    10,   // after gift time
    3,    // nb bump stages
    10,   // nb removed to level
    3, 3, 800, 2000 // nb leds, nb max to send, shower timeout, pool timeout
};

KSFactory::KSFactory()
    : CommonFactory(MAIN_DATA, BASE_BOARD_INFO, COMMON_BOARD_INFO)
{}

BaseInterface *KSFactory::createInterface(TQWidget *parent)
{
    return new Interface(MP_GAME_INFO, parent);
}

//-----------------------------------------------------------------------------
int main(int argc, char **argv)
{
    KHighscore::init(MAIN_DATA.appName);
    KSFactory ksf;
    ksf.init(argc, argv);

    KSPieceInfo pieceInfo;
    CommonHighscores highscores;

    (void) Prefs::self(); // Create preferences

    if ( kapp->isRestored() ) RESTORE(KSMainWindow)
    else {
        KSMainWindow *mw = new KSMainWindow;
        kapp->setMainWidget(mw);
        mw->show();
    }
    return kapp->exec();
}