/* * help function to display the help info * * format of the .larn.help file * * 1st character of file: # of pages of help available (ascii digit) * page (23 lines) for the introductory message (not counted in above) * pages of help text (23 lines per page) */ void help(void) { int i, j; #ifndef VT100 char tmbuf[128]; /* intermediate translation buffer when not a VT100 */ #endif /* VT100 */ if ((j = openhelp()) < 0) /* open the help file and get # pages */ return; for (i = 0; i < 23; i++) /* skip over intro message */ lgetl(); for (; j > 0; j--) { clear(); for (i = 0; i < 23; i++) #ifdef VT100 lprcat(lgetl()); /* print out each line that we read in */ #else /* VT100 */ { tmcapcnv(tmbuf, lgetl()); lprcat(tmbuf); } /* intercept \33's */ #endif /* VT100 */ if (j > 1) { lprcat(" ---- Press "); standout("return"); lprcat(" to exit, "); standout("space"); lprcat(" for more help ---- "); i = 0; while ((i != ' ') && (i != '\n') && (i != '\33')) i = getchr(); if ((i == '\n') || (i == '\33')) { lrclose(); setscroll(); drawscreen(); return; } } } lrclose(); retcont(); drawscreen(); }
/* * function to display the welcome message and background */ void welcome(void) { int i; #ifndef VT100 char tmbuf[128]; /* intermediate translation buffer when not a VT100 */ #endif /* VT100 */ if (openhelp() < 0) /* open the help file */ return; clear(); for (i = 0; i < 23; i++) #ifdef VT100 lprcat(lgetl());/* print out each line that we read in */ #else /* VT100 */ { tmcapcnv(tmbuf, lgetl()); lprcat(tmbuf); } /* intercept \33's */ #endif /* VT100 */ lrclose(); retcont(); /* press return to continue */ }
MainWindow::MainWindow() { quitdlg=0; editdlg=0; helpdlg=0; windlg=0; losedlg=0; //QSound::play("C:/Users/Altair/Documents/Qt/Inversion/sound.wav"); QGridLayout* layout1 = new QGridLayout(); QHBoxLayout* layout4 = new QHBoxLayout(); QVBoxLayout *layout3 = new QVBoxLayout; for (int i=0; i < 5; i++) { for (int j=0; j < 5; j++) { b[i][j] = new QPushButton(this); grid[i][j]=1; b[i][j]->setStyleSheet(" QPushButton { border-image: url(C:/Users/Altair/Documents/Qt/Inversion/on.png) 1 1 1 1 ;color: grey;border-top: 3px transparent; border-bottom: 3px transparent;border-right: 10px transparent;border-left: 10px transparent;}"); b[i][j]->setMinimumSize(100, 100); layout1->addWidget(b[i][j], i, j); } } combo= new QComboBox(); QLabel *label = new QLabel("Choose the puzzle :"); label->setFixedSize(40,40); combo->addItem("--"); for (int i=1;i<=10;i++){ combo->addItem("Puzzle "+QString::number(i)); } connect(combo,SIGNAL(currentIndexChanged(int)),this,SLOT(opencombo(int))); combo->setFixedSize(40,40); combo->setStyleSheet("QWidget { background-color: gray;border-style: outset;}"); layout3->addWidget(label); layout3->addWidget(combo); layout4->addLayout(layout3); layout4->addLayout(layout1); QVBoxLayout *layout6= new QVBoxLayout(); gameTurns=0;gameTimes=0; gameScore=0;gamemin=0;gamesec=0; lblTurn = new QLabel(this); lblTurn->setFixedSize(30, 30); layout6->addWidget(lblTurn); lblTimes = new QLabel(this); lblTimes->setFixedSize(30, 30); layout6->addWidget(lblTimes); lblScore = new QLabel(this); lblScore->setFixedSize(30, 30); layout6->addWidget(lblScore); QSound* sound=new QSound("C:/Users/Altair/Documents/Qt/Inversion/sound.wav"); sound->setLoops(-1); soundplay = new QPushButton(this); soundplay->setMaximumSize(100, 100); soundplay->setStyleSheet("QPushButton{border-image: url(C:/Users/Altair/Documents/Qt/Inversion/sound.png)3 10 3 10;color: grey;border-top: 3px transparent; border-bottom: 3px transparent;border-right: 10px transparent;border-left: 10px transparent;}"); QObject::connect(soundplay,SIGNAL(clicked()),sound,SLOT(play())); layout6->addWidget(soundplay); soundstop = new QPushButton(this); soundstop->setMaximumSize(100, 100); soundstop->setStyleSheet("QPushButton{border-image: url(C:/Users/Altair/Documents/Qt/Inversion/mute.png)3 10 3 10;color: grey;border-top: 3px transparent; border-bottom: 3px transparent;border-right: 10px transparent;border-left: 10px transparent;}"); QObject::connect(soundstop,SIGNAL(clicked()),sound,SLOT(stop())); layout6->addWidget(soundstop); layout4->addLayout(layout6); this->setWindowFlags(Qt::FramelessWindowHint); this->setStyleSheet("QWidget {background: url('C:/Users/Altair/Documents/Qt/Inversion/back.png')no-repeat ; border-style: outset; border-width: 2px;border-radius: 10px;border-color: beige;font: bold 14px;min-width: 10em;padding: 6px; }"); QVBoxLayout *layoutPrincipal=new QVBoxLayout(this); QHBoxLayout *layout2=new QHBoxLayout(); quitdlg= new quitdial(this); helpdlg= new helpdial(this); editdlg= new editdial(this); windlg= new windial(this); losedlg= new losedial(this); player= new QPushButton("Play"); player->setCheckable(true); player->setStyleSheet(" QPushButton { border-image: url(C:/Users/Altair/Documents/Qt/Inversion/bouton.png) 3 10 3 10;color: grey;border-top: 3px transparent; border-bottom: 3px transparent;border-right: 10px transparent;border-left: 10px transparent;}"); connect(player, SIGNAL(clicked()), this, SLOT(openplay())); connect(player, SIGNAL(clicked()), this, SLOT(clik2())); player->setMinimumSize(50,50); layout2->addWidget(player); solve = new QPushButton("Solve"); solve->setCheckable(true); solve->setStyleSheet(" QPushButton { border-image: url(C:/Users/Altair/Documents/Qt/Inversion/bouton.png) 3 10 3 10;color: grey;border-top: 3px transparent; border-bottom: 3px transparent;border-right: 10px transparent;border-left: 10px transparent;}"); solve->setMinimumSize(50,50); solve->setEnabled(false); connect(solve, SIGNAL(clicked()), this, SLOT(opensolve())); layout2->addWidget(solve); mix= new QPushButton("Mix"); mix->setStyleSheet(" QPushButton { border-image: url(C:/Users/Altair/Documents/Qt/Inversion/bouton.png) 3 10 3 10;color: grey;border-top: 3px transparent; border-bottom: 3px transparent;border-right: 10px transparent;border-left: 10px transparent;}"); mix->setMinimumSize(50,50); connect(mix, SIGNAL(clicked()), this, SLOT(openmix())); layout2->addWidget(mix); resett = new QPushButton("Reset"); resett->setMinimumSize(50,50); resett->setStyleSheet(" QPushButton { border-image: url(C:/Users/Altair/Documents/Qt/Inversion/bouton.png) 3 10 3 10;color: grey;border-top: 3px transparent; border-bottom: 3px transparent;border-right: 10px transparent;border-left: 10px transparent;}"); connect(resett, SIGNAL(clicked()), this, SLOT(openreset())); layout2->addWidget(resett); edit = new QPushButton("Edit"); edit->setMinimumSize(50,50); edit->setStyleSheet(" QPushButton { border-image: url(C:/Users/Altair/Documents/Qt/Inversion/bouton.png) 3 10 3 10;color: grey;border-top: 3px transparent; border-bottom: 3px transparent;border-right: 10px transparent;border-left: 10px transparent;}"); edit->setCheckable(true); connect(edit, SIGNAL(clicked()), this, SLOT(openedit())); connect(edit, SIGNAL(clicked()), this, SLOT(clik1())); layout2->addWidget(edit); hel = new QPushButton("Help"); hel->setMinimumSize(50,50); hel->setStyleSheet(" QPushButton { border-image: url(C:/Users/Altair/Documents/Qt/Inversion/bouton.png) 3 10 3 10;color: grey;border-top: 3px transparent; border-bottom: 3px transparent;border-right: 10px transparent;border-left: 10px transparent;}"); connect(hel, SIGNAL(clicked()), this, SLOT(openhelp())); layout2->addWidget(hel); boutonQuitter = new QPushButton("Quit"); boutonQuitter->setMinimumSize(50,50); boutonQuitter->setStyleSheet(" QPushButton { border-image: url(C:/Users/Altair/Documents/Qt/Inversion/bouton.png) 3 10 3 10;color: grey;border-top: 3px transparent; border-bottom: 3px transparent;border-right: 10px transparent;border-left: 10px transparent;}"); QWidget::connect(boutonQuitter, SIGNAL(clicked()), this, SLOT(openquit())); layout2->addWidget(boutonQuitter); layoutPrincipal->addLayout(layout2); layoutPrincipal->addLayout(layout4); this->resize(1370,600); setLayout(layoutPrincipal); gameTimer = new QTimer(); gameTimer->setInterval(1000); gameTimer->start(); connect(gameTimer,SIGNAL(timeout()),this,SLOT(gameTimer_timeout())); refreshScore(); }