30 files changed, 980 insertions, 372 deletions
diff --git a/noncore/games/kcheckers/checkers.h b/noncore/games/kcheckers/checkers.h index bd2be08..2592fb1 100644 --- a/noncore/games/kcheckers/checkers.h +++ b/noncore/games/kcheckers/checkers.h @@ -31,3 +31,4 @@ class Checkers void setLevel(int i) {levelmax=i;}; - int getBoard(int i) {return board[i];}; + + int board[54]; @@ -41,3 +42,2 @@ class Checkers int to; - int board[54]; int bestboard[54]; diff --git a/noncore/games/kcheckers/echeckers.h b/noncore/games/kcheckers/echeckers.h index 5ca3ecc..c3f7075 100644 --- a/noncore/games/kcheckers/echeckers.h +++ b/noncore/games/kcheckers/echeckers.h @@ -4,3 +4,3 @@ -#include <checkers.h> +#include "checkers.h" diff --git a/noncore/games/kcheckers/field.cpp b/noncore/games/kcheckers/field.cpp index 0755008..aacfc1c 100644 --- a/noncore/games/kcheckers/field.cpp +++ b/noncore/games/kcheckers/field.cpp @@ -5,8 +5,15 @@ -Field::Field(QWidget *parent,int i):QWidget(parent) + +Field::Field(QWidget* parent,int i):QWidget(parent) { pixmap=new QPixmap(SIZE,SIZE); + CHECK_PTR(pixmap); number=i; + + pattern=NULL; + picture=NULL; + frame=NULL; } + void Field::paintEvent(QPaintEvent*) @@ -16,2 +23,3 @@ void Field::paintEvent(QPaintEvent*) + void Field::mousePressEvent(QMouseEvent* mouseevent) @@ -22,3 +30,4 @@ void Field::mousePressEvent(QMouseEvent* mouseevent) -void Field::draw(QImage *image) + +void Field::draw() { @@ -26,3 +35,16 @@ void Field::draw(QImage *image) paint.begin(pixmap); - paint.drawImage(0,0,*image); + + if(pattern) paint.drawImage(0,0,*pattern); + + if(label.length()) + { + paint.setPen(white); + paint.setFont(QFont(font().family(),10)); + paint.drawText(2,11,label); + } + + if(picture) paint.drawImage(0,0,*picture); + + if(frame) paint.drawImage(0,0,*frame); + paint.end(); @@ -31 +53,30 @@ void Field::draw(QImage *image) + +void Field::setFrame(QImage* image) +{ + frame=image; + draw(); +} + + +void Field::setPicture(QImage* image) +{ + picture=image; + draw(); +} + + +void Field::setPattern(QImage* image) +{ + pattern=image; + draw(); +} + + +void Field::setLabel(const QString & string) +{ + label=string; + draw(); +} + + diff --git a/noncore/games/kcheckers/field.h b/noncore/games/kcheckers/field.h index d929e49..297d94e 100644 --- a/noncore/games/kcheckers/field.h +++ b/noncore/games/kcheckers/field.h @@ -14,5 +14,11 @@ class Field:public QWidget Field(QWidget*,int); - void draw(QImage*); + + void setFrame(QImage*); + void setPicture(QImage*); + void setPattern(QImage*); + void setLabel(const QString &); + signals: void click(int); + protected: @@ -20,4 +26,15 @@ class Field:public QWidget void mousePressEvent(QMouseEvent*); + private: + void draw(); + int number; + + // pixmap = pattern + label + picture + frame; + + QImage* frame; + QImage* picture; + QImage* pattern; + QString label; + QPixmap *pixmap; diff --git a/noncore/games/kcheckers/kcheckers.cpp b/noncore/games/kcheckers/kcheckers.cpp index 3df744e..c2eba0d 100644 --- a/noncore/games/kcheckers/kcheckers.cpp +++ b/noncore/games/kcheckers/kcheckers.cpp @@ -5,3 +5,6 @@ #include <qmenubar.h> +#include <qtoolbar.h> +#include <qpe/config.h> #include <qwhatsthis.h> +#include <qtoolbutton.h> #include <qmessagebox.h> @@ -13,4 +16,6 @@ -#include "pics/exit.xpm" #include "pics/logo.xpm" +#include "pics/undo.xpm" +#include "pics/exit.xpm" +#include "pics/help.xpm" #include "pics/wood1.xpm" @@ -18,2 +23,5 @@ #include "pics/wood3.xpm" +#include "pics/green1.xpm" +#include "pics/green2.xpm" +#include "pics/green3.xpm" #include "pics/marble1.xpm" @@ -29,2 +37,5 @@ +QString KCheckers::enNumeration="1 2 3 4 5 6 7 8 9 1011121314151617181920212223242526272829303132"; +QString KCheckers::ruNumeration="B8D8F8H8A7C7E7G7B6D6F6H6A5C5E5G5B4D4F4H4A3C3E3G3B2D2F2H2A1C1E1G1"; + const int KCheckers::t[]={6,7,8,9,11,12,13,14,17,18,19,20,22,23, @@ -32,2 +43,3 @@ const int KCheckers::t[]={6,7,8,9,11,12,13,14,17,18,19,20,22,23, + KCheckers::KCheckers():QMainWindow(0,0,WStyle_DialogBorder) @@ -35,63 +47,104 @@ KCheckers::KCheckers():QMainWindow(0,0,WStyle_DialogBorder) setCaption("KCheckers"); - setIcon(QPixmap(biglogo)); - showMaximized(); + setIcon(QPixmap(biglogo_xpm)); + + setToolBarsMovable(false); + + // Make a menubar + + gameMenu=new QPopupMenu; + CHECK_PTR(gameMenu); - QPopupMenu* gameMenu=new QPopupMenu; - gameMenu->insertItem(QPixmap(logo),tr("New"),this,SLOT(newGame())); + gameMenu->insertItem(QPixmap(logo_xpm),tr("&New"),this,SLOT(newGame()),CTRL+Key_N); gameMenu->insertSeparator(); - gameMenu->insertItem(QPixmap(exit),tr("Quit"),qApp,SLOT(quit())); + undoID=gameMenu->insertItem(QPixmap(undo_xpm),tr("&Undo Move"),this,SLOT(undoMove()),CTRL+Key_Z); + gameMenu->insertSeparator(); + gameMenu->insertItem(QPixmap(exit_xpm),tr("&Quit"),qApp,SLOT(closeAllWindows()),CTRL+Key_Q); skillMenu=new QPopupMenu; + CHECK_PTR(skillMenu); - skillMenu->insertItem(tr("Beginner"),this,SLOT(setSkillBeginner()),0,BEGINNER); - skillMenu->insertItem(tr("Novice"), this,SLOT(setSkillNovice()), 0,NOVICE); - skillMenu->insertItem(tr("Average"), this,SLOT(setSkillAverage()), 0,AVERAGE); - skillMenu->insertItem(tr("Good"), this,SLOT(setSkillGood()), 0,GOOD); - skillMenu->insertItem(tr("Expert"), this,SLOT(setSkillExpert()), 0,EXPERT); - skillMenu->insertItem(tr("Master"), this,SLOT(setSkillMaster()), 0,MASTER); + skillMenu->insertItem(tr("&Beginner"),this,SLOT(setSkillBeginner()),CTRL+Key_1,BEGINNER); + skillMenu->insertItem(tr("&Novice"), this,SLOT(setSkillNovice()), CTRL+Key_2,NOVICE); + skillMenu->insertItem(tr("&Average"), this,SLOT(setSkillAverage()), CTRL+Key_3,AVERAGE); + skillMenu->insertItem(tr("&Good"), this,SLOT(setSkillGood()), CTRL+Key_4,GOOD); + skillMenu->insertItem(tr("&Expert"), this,SLOT(setSkillExpert()), CTRL+Key_5,EXPERT); + skillMenu->insertItem(tr("&Master"), this,SLOT(setSkillMaster()), CTRL+Key_6,MASTER); optionsMenu=new QPopupMenu; + CHECK_PTR(optionsMenu); - optionsMenu->insertItem(tr("English Rules"),this,SLOT(setRulesEnglish()),0,ENGLISH); - optionsMenu->insertItem(tr("Russian Rules"),this,SLOT(setRulesRussian()),0,RUSSIAN); + numID=optionsMenu->insertItem(tr("&Show Numeration"),this,SLOT(showNumeration())); + optionsMenu->insertSeparator(); + optionsMenu->insertItem(tr("&English Rules"),this,SLOT(setRulesEnglish()),0,ENGLISH); + optionsMenu->insertItem(tr("&Russian Rules"),this,SLOT(setRulesRussian()),0,RUSSIAN); optionsMenu->insertSeparator(); - optionsMenu->insertItem(tr("Marble Board"),this,SLOT(setPatternMarble()),0,MARBLE); - optionsMenu->insertItem(tr("Wooden Board"),this,SLOT(setPatternWood()), 0,WOOD); + optionsMenu->insertItem(tr("&Green Board"), this,SLOT(setPatternGreen()), 0,GREEN); + optionsMenu->insertItem(tr("&Marble Board"),this,SLOT(setPatternMarble()),0,MARBLE); + optionsMenu->insertItem(tr("&Wooden Board"),this,SLOT(setPatternWooden()),0,WOODEN); QPopupMenu* helpMenu=new QPopupMenu; + CHECK_PTR(helpMenu); - helpMenu->insertItem(QPixmap(contexthelp),tr("What's This"),this,SLOT(whatsThis())); + helpMenu->insertItem(QPixmap(contexthelp_xpm),tr("What's This"),this,SLOT(whatsThis()),SHIFT+Key_F1); + helpMenu->insertItem(QPixmap(help_xpm),tr("&Rules of Play"),this,SLOT(help()),Key_F1); helpMenu->insertSeparator(); - helpMenu->insertItem(QPixmap(logo),tr("About KCheckers"),this,SLOT(about())); + helpMenu->insertItem(QPixmap(logo_xpm),tr("&About KCheckers"),this,SLOT(about())); helpMenu->insertItem(tr("About &Qt"),this,SLOT(aboutQt())); - menuBar()->insertItem(tr("Game"), gameMenu); - menuBar()->insertItem(tr("Skill"), skillMenu); - menuBar()->insertItem(tr("Options"),optionsMenu); - menuBar()->insertItem(tr("Help"), helpMenu); + QToolBar* menuToolBar=new QToolBar(this); + CHECK_PTR(menuToolBar); + QMenuBar* menuBar=new QMenuBar(menuToolBar); + CHECK_PTR(menuBar); - skill=NOVICE; - skillMenu->setItemChecked(skill,true); + menuBar->insertItem(tr("&Game"), gameMenu); + menuBar->insertItem(tr("&Skill"), skillMenu); + menuBar->insertItem(tr("&Options"),optionsMenu); + menuBar->insertItem(tr("&Help"), helpMenu); - rules=ENGLISH; + // Restore a settings + + readConfig(); + + skillMenu->setItemChecked(skill,true); optionsMenu->setItemChecked(rules,true); + optionsMenu->setItemChecked(numID,false); - pattern=WOOD; - optionsMenu->setItemChecked(pattern,true); + // Make a toolbar + + QToolBar* emptyToolBar=new QToolBar(this); + emptyToolBar->setHorizontalStretchable(true); + + QToolBar* toolBar=new QToolBar(this); + CHECK_PTR(toolBar); + + QSize buttonSize(24,24); + + QToolButton* gameButton=new QToolButton(QPixmap(logo_xpm),tr(" New Game ") ,"",this,SLOT(newGame()),toolBar); + CHECK_PTR(gameButton); + gameButton->setMinimumSize(buttonSize); + + undoButton=new QToolButton(QPixmap(undo_xpm),tr(" Undo Move "),"",this,SLOT(undoMove()),toolBar); + CHECK_PTR(undoButton); + undoButton->setMinimumSize(buttonSize); - imageMan1=new QImage(man_black); - imageMan2=new QImage(man_white); - imageKing1=new QImage(king_black); - imageKing2=new QImage(king_white); + QToolButton* helpButton=new QToolButton(QPixmap(help_xpm),tr(" Rules of Play "),"",this,SLOT(help()),toolBar); + CHECK_PTR(helpButton); + helpButton->setMinimumSize(buttonSize); - imageWood1=new QImage(wood1); - imageWood2=new QImage(wood2); - imageWood3=new QImage(wood3); - imageMarble1=new QImage(marble1); - imageMarble2=new QImage(marble2); - imageMarble3=new QImage(marble3); + // Make a checkers board - imagePat1=imageWood1; - imagePat2=imageWood2; - imageFrame=imageWood3; + imageMan1=new QImage(man_black_xpm); CHECK_PTR(imageMan1); + imageMan2=new QImage(man_white_xpm); CHECK_PTR(imageMan2); + imageKing1=new QImage(king_black_xpm); CHECK_PTR(imageKing1); + imageKing2=new QImage(king_white_xpm); CHECK_PTR(imageKing2); + + imageWood1=new QImage(wood1_xpm); CHECK_PTR(imageWood1); + imageWood2=new QImage(wood2_xpm); CHECK_PTR(imageWood2); + imageWood3=new QImage(wood3_xpm); CHECK_PTR(imageWood3); + imageGreen1=new QImage(green1_xpm); CHECK_PTR(imageGreen1); + imageGreen2=new QImage(green2_xpm); CHECK_PTR(imageGreen2); + imageGreen3=new QImage(green3_xpm); CHECK_PTR(imageGreen3); + imageMarble1=new QImage(marble1_xpm); CHECK_PTR(imageMarble1); + imageMarble2=new QImage(marble2_xpm); CHECK_PTR(imageMarble2); + imageMarble3=new QImage(marble3_xpm); CHECK_PTR(imageMarble3); @@ -101,2 +154,3 @@ KCheckers::KCheckers():QMainWindow(0,0,WStyle_DialogBorder) QFrame* frame=new QFrame(centralWidget); + CHECK_PTR(frame); frame->setFrameStyle(QFrame::Box|QFrame::Plain); @@ -104,11 +158,21 @@ KCheckers::KCheckers():QMainWindow(0,0,WStyle_DialogBorder) + statusLabel = new QLabel(centralWidget); + statusLabel->setAlignment(Qt::AlignHCenter); + QVBoxLayout* vlayout=new QVBoxLayout(centralWidget); - vlayout->addWidget(frame); - statusLabel = new QLabel(centralWidget); + vlayout->addStretch(); + vlayout->addWidget(frame); + vlayout->addStretch(); vlayout->addWidget(statusLabel); + vlayout->addStretch(); - for(int i=0;i<64;i++) field[i]=new Field(frame,i); + for(int i=0;i<64;i++) + { + field[i]=new Field(frame,i); + CHECK_PTR(field[i]); + } QGridLayout* grid=new QGridLayout(frame,8,8,1,0); + CHECK_PTR(grid); @@ -128,2 +192,8 @@ KCheckers::KCheckers():QMainWindow(0,0,WStyle_DialogBorder) + selected=false; + + setPattern(pattern); + + QWhatsThis::add(frame,"A checkers board"); + userFirst=false; @@ -135,2 +205,54 @@ KCheckers::KCheckers():QMainWindow(0,0,WStyle_DialogBorder) +void KCheckers::readConfig() +{ + Config config("KCheckers"); + config.setGroup("KCheckers"); + QString entry; + + entry=config.readEntry("skill","novice"); + if(entry=="beginner") skill=BEGINNER; + else if(entry=="average") skill=AVERAGE; + else if(entry=="good") skill=GOOD; + else if(entry=="expert") skill=EXPERT; + else if(entry=="master") skill=MASTER; + else skill=NOVICE; + + entry=config.readEntry("rules","english"); + if(entry=="russian") rules=RUSSIAN; + else rules=ENGLISH; + + entry=config.readEntry("theme","wooden"); + if(entry=="green") pattern=GREEN; + else if(entry=="marble") pattern=MARBLE; + else pattern=WOODEN; +} + + +void KCheckers::closeEvent(QCloseEvent* event) +{ + Config config("KCheckers"); + config.setGroup("KCheckers"); + QString entry; + + if(skill==BEGINNER) entry="beginner"; + if(skill==NOVICE) entry="novice"; + if(skill==AVERAGE) entry="average"; + if(skill==GOOD) entry="good"; + if(skill==EXPERT) entry="expert"; + if(skill==MASTER) entry="master"; + config.writeEntry("skill",entry); + + if(rules==ENGLISH) entry="english"; + if(rules==RUSSIAN) entry="russian"; + config.writeEntry("rules",entry); + + if(pattern==GREEN) entry="green"; + if(pattern==MARBLE) entry="marble"; + if(pattern==WOODEN) entry="wooden"; + config.writeEntry("theme",entry); + + event->accept(); +} + + void KCheckers::setSkill(int set) @@ -167,2 +289,7 @@ void KCheckers::setPattern(int set) { + case GREEN: + imagePat1=imageGreen1; + imagePat2=imageGreen2; + imageFrame=imageGreen3; + break; case MARBLE: @@ -172,3 +299,3 @@ void KCheckers::setPattern(int set) break; - case WOOD: + case WOODEN: imagePat1=imageWood1; @@ -178,5 +305,92 @@ void KCheckers::setPattern(int set) - drawBoard(); + for(int i=0; i<32;i++) field[i]->setPattern(imagePat2); + for(int i=32;i<64;i++) field[i]->setPattern(imagePat1); + + if(selected) field[from]->setFrame(imageFrame); +} + - if(selected) field[from]->draw(imageFrame); +void KCheckers::showNumeration() +{ + if(optionsMenu->isItemChecked(numID)) + { + optionsMenu->setItemChecked(numID,false); + for(int i=0;i<32;i++) field[i]->setLabel(""); + } + else + { + optionsMenu->setItemChecked(numID,true); + drawNumeration(); + } +} + + +void KCheckers::drawNumeration() +{ + if(rules==ENGLISH) + { + if(userFirst) + for(int i=0;i<32;i++) + field[i]->setLabel(enNumeration.mid(i*2,2)); + else + for(int i=0;i<32;i++) + field[i]->setLabel(enNumeration.mid(62-i*2,2)); + } + else + { + if(userFirst) + for(int i=0;i<32;i++) + field[i]->setLabel(ruNumeration.mid(i*2,2)); + else + for(int i=0;i<32;i++) + field[i]->setLabel(ruNumeration.mid(62-i*2,2)); + } +} + + +void KCheckers::drawBoard(int i) +{ + switch(game->board[t[i]]) + { + case MAN1: + field[i]->setPicture(imageMan1); + break; + case MAN2: + field[i]->setPicture(imageMan2); + break; + case KING1: + field[i]->setPicture(imageKing1); + break; + case KING2: + field[i]->setPicture(imageKing2); + break; + default: + field[i]->setPicture(NULL); + } +} + + +void KCheckers::help() +{ + QMessageBox::information(this,"Rules of Play", + "In the beginning of game you have\n" + "12 checkers (men).\n" + "The men move forward only.\n" + "The men can capture:\n" + "- by jumping forward only (english\n" + " rules);\n" + "- by jumping forward or backward\n" + " (russian rules).\n" + "A man which reaches the far side of\n" + "the board becomes a king.\n" + "The kings move forward or\n" + "backward:\n" + "- to one square only (english rules);\n" + "- to any number of squares (russian\n" + " rules).\n" + "The kings capture by jumping\n" + "forward or backward.\n" + "Whenever a player is able to make a\n" + "capture he must do so.", + QMessageBox::Ok|QMessageBox::Default); } @@ -186,12 +400,13 @@ void KCheckers::about() { - QMessageBox::about(this, "About", - "KCheckers, a board game. Ver 0.2\n" - "(C) 2002, A. Peredri <andi@ukr.net>\n\n" - "http://kcheckers.tuxfamily.org\n\n" - "Opie version by S.Prud'homme\n" - "<prudhomme@laposte.net>\n\n" - "http://opie.handhelds.org\n\n" - "This program is distributed under the\n" - "terms of the GNU General Public\n" - "License."); + QMessageBox::about(this,"About KCheckers", + "KCheckers, a board game. Ver 0.3\n" + "(C) 2002, A. Peredri <andi@ukr.net>\n\n" + "http://kcheckers.tuxfamily.org\n\n" + "Contributors:\n" + "S. Rosen <srosen@erols.com>\n\n" + "Qtopia version: S.Prud'homme\n" + "<prudhomme@laposte.net>\n\n" + "This program is distributed under the\n" + "terms of the GNU General Public\n" + "License."); } @@ -207,7 +422,3 @@ void KCheckers::newGame() { - if(game) - { - delete game; - QWhatsThis::remove(this); - } + if(game) delete game; @@ -217,34 +428,20 @@ void KCheckers::newGame() game=new ECheckers(skill); - QWhatsThis::add(this, - "<b>Rules of English Checkers</b>" - "<ul>" - "<li>In the beginning of game you have<br>12 checkers (men)." - "<li>Men move forward only." - "<li>Men capture by jumping forward only." - "<li>A man which reaches the far side of<br>the board becomes a king." - "<li>Kings move forward or backward to<br>one square." - "<li>Kings capture by jumping forward or<br>backward." - "<li>Whenever a player is able to make<br> a capture he must do so." - "</ul>"); + CHECK_PTR(game); break; + case RUSSIAN: game=new RCheckers(skill); - QWhatsThis::add(this, - "<b>Rules of Russian Checkers</b>" - "<ul>" - "<li>In the beginning of game you have<br> 12 checkers (men)." - "<li>Men move forward only." - "<li>Men capture by jumping forward or<br>backward." - "<li>A man which reaches the far side of<br> the board becomes a king." - "<li>Kings move forward or backward to<br>any number of squares." - "<li>Kings capture by jumping forward or<br>backward." - "<li>Whenever a player is able to make<br> a capture he must do so." - "</ul>"); + CHECK_PTR(game); } - selected=false; + unselect(); gameOver=false; + gameMenu->setItemEnabled(undoID,false); + undoButton->setEnabled(false); + colorChange(); - drawBoard(); + + for(int i=0;i<32;i++) drawBoard(i); + if(optionsMenu->isItemChecked(numID)) drawNumeration(); @@ -256,2 +453,22 @@ void KCheckers::newGame() +// Undo the last computer and user moves + +void KCheckers::undoMove() +{ + for(int i=0;i<32;i++) + { + game->board[t[i]]=undoBoard[i]; + drawBoard(i); + } + + unselect(); + gameOver=false; + + gameMenu->setItemEnabled(undoID,false); + undoButton->setEnabled(false); + + statusLabel->setText(tr("Go!")); +} + + void KCheckers::colorChange() @@ -270,15 +487,6 @@ void KCheckers::colorChange() -void KCheckers::drawBoard() +void KCheckers::unselect() { - // Drawing of start position - for(int i=0;i<32;i++) - { - field[i]->draw(imagePat2); - if(game->getBoard(t[i])==MAN1) field[i]->draw(imageMan1); - else if(game->getBoard(t[i])==MAN2) field[i]->draw(imageMan2); - else if(game->getBoard(t[i])==KING1) field[i]->draw(imageKing1); - else if(game->getBoard(t[i])==KING2) field[i]->draw(imageKing2); - } - - for(int i=32;i<64;i++) field[i]->draw(imagePat1); + if(selected) field[from]->setFrame(NULL); + selected=false; } @@ -289,3 +497,3 @@ void KCheckers::click(int fieldNumber) if(gameOver) return; - switch(game->getBoard(t[fieldNumber])) + switch(game->board[t[fieldNumber]]) { @@ -298,3 +506,3 @@ void KCheckers::click(int fieldNumber) selected=true; - field[fieldNumber]->draw(imageFrame); + field[fieldNumber]->setFrame(imageFrame); return; @@ -304,7 +512,5 @@ void KCheckers::click(int fieldNumber) { - field[from]->draw(imagePat2); - if(game->getBoard(t[from])==MAN1) field[from]->draw(imageMan1); - else field[from]->draw(imageKing1); + field[from]->setFrame(NULL); from=fieldNumber; - field[fieldNumber]->draw(imageFrame); + field[fieldNumber]->setFrame(imageFrame); return; @@ -315,3 +521,4 @@ void KCheckers::click(int fieldNumber) if(!userGo(fieldNumber)) return; - selected=false; + + unselect(); @@ -342,3 +549,3 @@ void KCheckers::compGo() int save[32]; - for(int i=0;i<32;i++) save[i]=game->getBoard(t[i]); + for(int i=0;i<32;i++) save[i]=game->board[t[i]]; @@ -348,8 +555,4 @@ void KCheckers::compGo() { - if(game->getBoard(t[i])==save[i]) continue; - field[i]->draw(imagePat2); - if(game->getBoard(t[i])==MAN1) field[i]->draw(imageMan1); - else if(game->getBoard(t[i])==MAN2) field[i]->draw(imageMan2); - else if(game->getBoard(t[i])==KING1) field[i]->draw(imageKing1); - else if(game->getBoard(t[i])==KING2) field[i]->draw(imageKing2); + if(game->board[t[i]]==save[i]) continue; + drawBoard(i); } @@ -361,3 +564,3 @@ bool KCheckers::userGo(int to) int save[32]; - for(int i=0;i<32;i++) save[i]=game->getBoard(t[i]); + for(int i=0;i<32;i++) save[i]=game->board[t[i]]; @@ -369,11 +572,12 @@ bool KCheckers::userGo(int to) + for(int i=0;i<32;i++) undoBoard[i]=save[i]; + gameMenu->setItemEnabled(undoID,true); + undoButton->setEnabled(true); + for(int i=0;i<32;i++) { - if(game->getBoard(t[i])==save[i]) continue; - field[i]->draw(imagePat2); - if(game->getBoard(t[i])==MAN1) field[i]->draw(imageMan1); - else if(game->getBoard(t[i])==MAN2) field[i]->draw(imageMan2); - else if(game->getBoard(t[i])==KING1) field[i]->draw(imageKing1); - else if(game->getBoard(t[i])==KING2) field[i]->draw(imageKing2); + if(game->board[t[i]]==save[i]) continue; + drawBoard(i); } + return true; diff --git a/noncore/games/kcheckers/kcheckers.h b/noncore/games/kcheckers/kcheckers.h index e86524f..ccf5bae 100644 --- a/noncore/games/kcheckers/kcheckers.h +++ b/noncore/games/kcheckers/kcheckers.h @@ -10,4 +10,5 @@ -#define WOOD 1 -#define MARBLE 2 +#define WOODEN 1 +#define GREEN 2 +#define MARBLE 3 @@ -18,6 +19,8 @@ #define NOVICE 4 -#define AVERAGE 5 -#define GOOD 6 -#define EXPERT 7 -#define MASTER 8 +#define AVERAGE 6 +#define GOOD 7 +#define EXPERT 8 +#define MASTER 9 + +class QToolButton; @@ -30,3 +33,8 @@ class KCheckers:public QMainWindow + protected: + void closeEvent(QCloseEvent*); + private slots: + + void help(); void about(); @@ -34,3 +42,5 @@ class KCheckers:public QMainWindow void newGame(); - void click(int); // Processes the mouse clics on fields + void undoMove(); + void click(int); + void showNumeration(); @@ -43,3 +53,4 @@ class KCheckers:public QMainWindow - void setPatternWood() {setPattern(WOOD);}; + void setPatternWooden() {setPattern(WOODEN);}; + void setPatternGreen() {setPattern(GREEN);}; void setPatternMarble() {setPattern(MARBLE);}; @@ -50,2 +61,3 @@ class KCheckers:public QMainWindow private: + void compGo(); @@ -53,4 +65,7 @@ class KCheckers:public QMainWindow - void drawBoard(); + void drawBoard(int); + void drawNumeration(); void colorChange(); + void unselect(); + void readConfig(); @@ -64,2 +79,7 @@ class KCheckers:public QMainWindow int pattern; + + int numID; // Show Numeration + int undoID; // Undo Move + int undoBoard[32]; + bool gameOver; @@ -77,2 +97,5 @@ class KCheckers:public QMainWindow QImage* imageWood3; + QImage* imageGreen1; + QImage* imageGreen2; + QImage* imageGreen3; QImage* imageMarble1; @@ -86,6 +109,11 @@ class KCheckers:public QMainWindow - Checkers* game; - QPopupMenu* skillMenu; - QPopupMenu* optionsMenu; - QLabel* statusLabel; + Checkers* game; + QPopupMenu* gameMenu; + QPopupMenu* skillMenu; + QPopupMenu* optionsMenu; + QToolButton* undoButton; + QLabel* statusLabel; + + static QString enNumeration; + static QString ruNumeration; diff --git a/noncore/games/kcheckers/kcheckers.pro b/noncore/games/kcheckers/kcheckers.pro index bdbb46e..5892d3c 100644 --- a/noncore/games/kcheckers/kcheckers.pro +++ b/noncore/games/kcheckers/kcheckers.pro @@ -14,4 +14,3 @@ SOURCES = checkers.cpp \ INTERFACES = -INCLUDEPATH += . \ - $(OPIEDIR)/include +INCLUDEPATH += $(OPIEDIR)/include LIBS += -lqpe diff --git a/noncore/games/kcheckers/main.cpp b/noncore/games/kcheckers/main.cpp index ac86271..b8dd620 100644 --- a/noncore/games/kcheckers/main.cpp +++ b/noncore/games/kcheckers/main.cpp @@ -13,3 +13,3 @@ int main(int argc, char *argv[]) app.setMainWidget(&kcheckers); - kcheckers.show(); + kcheckers.showMaximized(); diff --git a/noncore/games/kcheckers/opie-kcheckers.control b/noncore/games/kcheckers/opie-kcheckers.control index 30ee336..a1b0503 100644 --- a/noncore/games/kcheckers/opie-kcheckers.control +++ b/noncore/games/kcheckers/opie-kcheckers.control @@ -6,3 +6,3 @@ Maintainer: leseb <prudhomme@laposte.net> Architecture: arm -Version: 0.2-$SUB_VERSION +Version: 0.3-$SUB_VERSION Depends: opie-base ($QPE_VERSION) diff --git a/noncore/games/kcheckers/pics/biglogo.xpm b/noncore/games/kcheckers/pics/biglogo.xpm index 6570d88..1ca8ab1 100644 --- a/noncore/games/kcheckers/pics/biglogo.xpm +++ b/noncore/games/kcheckers/pics/biglogo.xpm @@ -1,10 +1,9 @@ /* XPM */ -static const char *biglogo[]={ -"32 32 6 1", +static const char *biglogo_xpm[]={ +"32 32 5 1", ". c None", "# c #000000", -"a c #303030", -"d c #d7d7d7", -"c c #eaeaea", -"b c #ffffff", +"c c #d7d7d7", +"b c #eaeaea", +"a c #ffffff", "................................", @@ -14,24 +13,24 @@ static const char *biglogo[]={ "....########################....", -"....#aaaaaaaaaaaaaaaaaaaaaa#....", -"....#abbbbbbbbbb##########a#....", -"....#abbbbbbbcbc##########a#....", -"....#abbbbbbbbbb##########a#....", -"....#abbbbbcbcbc##########a#....", -"....#abbbbbbbbbb##########a#....", -"....#abbbcbcbcbc##########a#....", -"....#abbbbbbbbbc##########a#....", -"....#abcbcbcbbcc##########a#....", -"....#abbbbbbbccc##########a#....", -"....#abcbcbccccc##########a#....", -"....#a##########cccccccccca#....", -"....#a##########cccccccccca#....", -"....#a##########ccccccccdca#....", -"....#a##########cccccccccca#....", -"....#a##########ccccccdcdca#....", -"....#a##########cccccccccca#....", -"....#a##########ccccdcdcdca#....", -"....#a##########cccccccccda#....", -"....#a##########ccdcdcdcdca#....", -"....#a##########cccccccdcda#....", -"....#aaaaaaaaaaaaaaaaaaaaaa#....", +"....########################....", +"....##aaaaaaaaaa############....", +"....##aaaaaaabab############....", +"....##aaaaaaaaaa############....", +"....##aaaaababab############....", +"....##aaaaaaaaaa############....", +"....##aaabababab############....", +"....##aaaaaaaaab############....", +"....##abababaabb############....", +"....##aaaaaaabbb############....", +"....##abababbbbb############....", +"....############bbbbbbbbbb##....", +"....############bbbbbbbbbb##....", +"....############bbbbbbbbcb##....", +"....############bbbbbbbbbb##....", +"....############bbbbbbcbcb##....", +"....############bbbbbbbbbb##....", +"....############bbbbcbcbcb##....", +"....############bbbbbbbbbc##....", +"....############bbcbcbcbcb##....", +"....############bbbbbbbcbc##....", +"....########################....", "....########################....", diff --git a/noncore/games/kcheckers/pics/contexthelp.xpm b/noncore/games/kcheckers/pics/contexthelp.xpm index 9447207..bc455e2 100644 --- a/noncore/games/kcheckers/pics/contexthelp.xpm +++ b/noncore/games/kcheckers/pics/contexthelp.xpm @@ -1,4 +1,4 @@ /* XPM */ -static const char *contexthelp[]={ -"14 14 3 1", +static const char *contexthelp_xpm[]={ +"16 16 3 1", ". c None", @@ -6,15 +6,17 @@ static const char *contexthelp[]={ "# c #ffffff", -"##............", -"#a#...........", -"#aa#.....aaaa.", -"#aaa#...aa..aa", -"#aaaa#......aa", -"#aaaaa#.....aa", -"#aaaaaa#...aa.", -"#aaaaaaa#.aa..", -"#aaaa###..aa..", -"#a##a#........", -"##..#a#...aa..", -"....#a#.......", -".....#........", -".............."}; +"................", +".##.............", +".#a#............", +".#aa#.....aaaa..", +".#aaa#...aa..aa.", +".#aaaa#......aa.", +".#aaaaa#.....aa.", +".#aaaaaa#...aa..", +".#aaaaaaa#.aa...", +".#aaaa###..aa...", +".#a##a#.........", +".##..#a#...aa...", +".....#a#........", +"......#.........", +"................", +"................"}; diff --git a/noncore/games/kcheckers/pics/exit.xpm b/noncore/games/kcheckers/pics/exit.xpm index 6fe404e..e4a31dc 100644 --- a/noncore/games/kcheckers/pics/exit.xpm +++ b/noncore/games/kcheckers/pics/exit.xpm @@ -1,4 +1,4 @@ /* XPM */ -static const char *exit[]={ -"14 14 4 1", +static const char *exit_xpm[]={ +"16 16 4 1", ". c None", @@ -7,15 +7,17 @@ static const char *exit[]={ "b c #757575", -"..............", -"......##......", -"......##......", -"...#..##..#...", -"..a##.##.##a..", -".b##..##..##b.", -".a#b..##..b#a.", -".##...##...##.", -".##...##...##.", -".a#b..##..b#a.", -".b##......##b.", -"..a##b..b##a..", -"...a######a...", -"....ba##ab...."}; +"................", +".......##.......", +".......##.......", +"....#..##..#....", +"...a##.##.##a...", +"..b##..##..##b..", +"..a#b..##..b#a..", +"..##...##...##..", +"..##...##...##..", +"..a#b..##..b#a..", +"..b##......##b..", +"...a##b..b##a...", +"....a######a....", +".....ba##ab.....", +"................", +"................"}; diff --git a/noncore/games/kcheckers/pics/green1.xpm b/noncore/games/kcheckers/pics/green1.xpm new file mode 100644 index 0000000..208bdfb --- a/dev/null +++ b/noncore/games/kcheckers/pics/green1.xpm @@ -0,0 +1,62 @@ +/* XPM */ +static const char *green1_xpm[]={ +"32 32 27 1", +"y c #6db06d", +"v c #70b370", +"s c #71b471", +"x c #73b673", +"w c #74b774", +"j c #76b976", +"l c #77ba77", +"c c #79ba79", +"o c #7abb7a", +"m c #7bbe7b", +"d c #7cbf7c", +"i c #7ebf7e", +"a c #7fc07f", +"e c #80c180", +"k c #81c281", +"b c #82c382", +"# c #84c584", +". c #85c685", +"f c #86c786", +"g c #88c788", +"n c #88c988", +"r c #89ca89", +"q c #8bca8b", +"u c #8dcc8d", +"p c #8ecd8e", +"t c #90cd90", +"h c #91ce91", +".#a.abcacdefghabijgbf.ajdkbb.fgl", +"abadadbamefffnadaijfffkcjoeka..l", +"keaiaoakm#ggagpabaoaakabkmdammba", +"mmmdmjijmebgifqadbfjdaik#mddbaak", +"aamaajaoliab.brradgmcbambabaakba", +"baadaaaksmae.bgttpgaoakijff.fdak", +"g.bcabaaakabk.gnpnnkomdaobb#f.bl", +"f.#adakabaik#b.ggggf.#ammgmk..fl", +"f#kkkijadbambae.abfgfamaebaake#l", +"ff#.baoaoaklekkbadffaboakijojobl", +"ggk#bbakomdadeaak.nnadeicaocmegl", +"gngkgggf.#aakabkiabunnabavldmaij", +"fgabaffbdwjdaik#aadggfkaklmxjxao", +"ffkakgfbaomcbaabaa.ffbaaemiocmak", +"gfkbf#bakkaoakkejabaawcmdmiididl", +"rgkk..gbebkomdadbadmlwbalmmdekay", +"nbadbb.#abf.#ammakbaojaijjijkbba", +"qfkjaak#kak.baijijaijcjaojaooaak", +"ng.jomaakabkfbaoaoaaowwlmcxbamij", +"qggawljdaik#.ffijaksbaoakajbaijo", +"ug.bcamcbambgijijfaxakoekkaakaol", +"ufff#baoaklegaoaorfmbajaaaaajakl", +"gng.gkkomdadbqnuprfbabaljloadiol", +".b#fngf.#amijanpqgg.iaijbajmab#l", +"iik#.b.fkkxaockqu.iakaaoakmebfgl", +"gggbaiakkawbajabgfjdaik#baabnqab", +"fijakakabkeakbaaekmcbambakafnpad", +"baoggdaikijbaakijwaoaklewbaeijao", +"ijfffcbamaoakaaaobkomdadjakbaohl", +"aobgfoaklecijjdaikf.#ammbajafrij", +"aobakomdadkaomcbambbababakijefao", +"llakf.#ammlllaoakleakakaklaoluul"}; diff --git a/noncore/games/kcheckers/pics/green2.xpm b/noncore/games/kcheckers/pics/green2.xpm new file mode 100644 index 0000000..4ecfdd5 --- a/dev/null +++ b/noncore/games/kcheckers/pics/green2.xpm @@ -0,0 +1,107 @@ +/* XPM */ +static const char * green2_xpm[] = { +"32 32 72 1", +" c None", +". c #349034", +"+ c #348D34", +"@ c #338433", +"# c #306630", +"$ c #306B30", +"% c #317931", +"& c #328632", +"* c #349334", +"= c #359635", +"- c #369C36", +"; c #36A436", +"> c #369F36", +", c #35A735", +"' c #36A136", +") c #36A636", +"! c #369A36", +"~ c #359935", +"{ c #359B35", +"] c #328032", +"^ c #306E30", +"/ c #359135", +"( c #338A33", +"_ c #328332", +": c #338233", +"< c #359435", +"[ c #327D32", +"} c #2F632F", +"| c #317731", +"1 c #327832", +"2 c #338C33", +"3 c #338733", +"4 c #2E612E", +"5 c #2C5C2C", +"6 c #348834", +"7 c #327B32", +"8 c #327332", +"9 c #35A035", +"0 c #338F33", +"a c #316A31", +"b c #2F672F", +"c c #317431", +"d c #348B34", +"e c #317231", +"f c #328B32", +"g c #327532", +"h c #307030", +"i c #2E642E", +"j c #348634", +"k c #316F31", +"l c #337C33", +"m c #2C5F2C", +"n c #2B5B2B", +"o c #254D25", +"p c #2F692F", +"q c #359E35", +"r c #358C35", +"s c #36A936", +"t c #38A338", +"u c #295429", +"v c #2D602D", +"w c #2E5F2E", +"x c #337F33", +"y c #337933", +"z c #306730", +"A c #2F652F", +"B c #285528", +"C c #337233", +"D c #326E32", +"E c #2F6A2F", +"F c #348334", +"G c #358A35", +".+@#$%&*=--;>,'),'>''>!.~->{*]^/", +"(_:__(+.~!>'>';'>>!>>-=+{{!<+[}|", +"1$&++23]*-->'>'>>-----~.!-~.]456", +"11+==.78/{>>>>>>9--{!~==!=0@abc>", +"b1/==dee+=>-'-!!-9!!!=*../7bb]]'", +"b1.=*+11+=!!!!==!>>===+7&3[c1@]~", +"11+**+1&+.*~-~!=!!==++((+=.f6&@~", +"_(++33d&f.=<==*0./+2+0...=(]]]6*", +"(]11|(f@+++==+@133@32+**.*0]7&=*", +"71g7(.=<==.+=(h10g|]]@(f+0+33.==", +"6@3*<~--!.6@+]11gh|h4i%]3+&+++*+", +"@1@*~->!<+]j~=+@k@][e5}kc&@l[]3~", +"6^(=!{=~~{-!!~/]11]7cmnoi$|chk@!", +"/+/=-=+==>>>>>*1p^k|[]c7]2+*<==>", +"==~=->{~>>'>-=d1|@(&++*.=<->>'>{", +"!-->>!*{{---!<f&f+.+*{~==->''';=", +"!-9-'-*=-~-q~+@(+.*=-!!<r->)'))~", +"-==>'{<=<~-!*&k]+/*~-{;'-;>',;)*", +"--~<9{~~-<**fl|]3(*!!-->>''s)t;f", +"-q=~<->>=<//3iu[fd=~===>-'',,''3", +"><=<~>''>!!<@vv%3.2.+d**<~9>''-@", +"<6@==>''>--!+]7w3++]]%6@@(+=!{!+", +"f(++=>''-{=!<+]@:@@x$bbx:81_**f@", +"====!>'>-!==.*fy%h[|zv5AAia%@@|]", +"--{<{'''-==<.+f6]_]36i5$$$hechc*", +"{!-!<=~{*/+(+f+((ff(g}nzc8%]|c3+", +"-!!<+++(_7[(3+/*~.(3@lBB1]@_^[@3", +"==+d+$Ca}e_3f.~{~=.(6:z$7@3@]&(f", +".+&heD$:|]@@+=!~~=<+3:]7@&3+&2=+", +"+f&:_6|:7%%f+<=!==*+&:]:]j[+==-+", +"2__+2_[7@@@&+=<=<++37^b[@j/{->-+", +"1cc71|||cc1^g7l77c|cE5Ec77FGGrG["}; diff --git a/noncore/games/kcheckers/pics/green3.xpm b/noncore/games/kcheckers/pics/green3.xpm new file mode 100644 index 0000000..f9aa154 --- a/dev/null +++ b/noncore/games/kcheckers/pics/green3.xpm @@ -0,0 +1,33 @@ +/* XPM */ +static const char *green3_xpm[]={ +"32 32 2 1", +"# c None", +". c #00f100", +"............................", +"............................", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"..########################..", +"............................", +"............................"}; diff --git a/noncore/games/kcheckers/pics/help.xpm b/noncore/games/kcheckers/pics/help.xpm new file mode 100644 index 0000000..49d24b0 --- a/dev/null +++ b/noncore/games/kcheckers/pics/help.xpm @@ -0,0 +1,74 @@ +/* XPM */ +static const char *help_xpm[]={ +"16 16 55 1", +". c None", +"e c #000000", +"W c #010101", +"j c #040404", +"w c #383838", +"# c #393939", +"a c #3f3f3f", +"k c #404040", +"o c #494949", +"x c #4a4a4a", +"C c #4d4d4d", +"p c #4e4e4e", +"0 c #4f4f4f", +"T c #6b6b6b", +"Y c #6d6d6d", +"E c #8c8c8c", +"N c #999999", +"Z c #a2a2a2", +"U c #a8a8a8", +"i c #b5b5b5", +"d c #bababa", +"R c #c0c0c0", +"V c #c4c4c4", +"X c #cacaca", +"S c #cbcbcb", +"O c #cecece", +"M c #d1d1d1", +"b c #d3d3d3", +"Q c #d5d5d5", +"c c #d9d9d9", +"D c #dadada", +"P c #dbdbdb", +"f c #dddddd", +"K c #dedede", +"H c #e3e3e3", +"l c #e5e5e5", +"J c #e6e6e6", +"L c #e7e7e7", +"g c #e8e8e8", +"q c #eaeaea", +"I c #ebebeb", +"h c #ececec", +"G c #ededed", +"y c #eeeeee", +"F c #f0f0f0", +"A c #f2f2f2", +"B c #f3f3f3", +"v c #f4f4f4", +"u c #f5f5f5", +"r c #f6f6f6", +"m c #f7f7f7", +"z c #f8f8f8", +"t c #fafafa", +"s c #fbfbfb", +"n c #fcfcfc", +"......###.......", +".....abcdee.....", +".....afghcije...", +".....klmnnmciop.", +".....oqrstuvpwpe", +".....xyzzzABpCDe", +"....#EBrrFyGeee.", +"....kHFBBIJKj...", +"....#JgyLHDMe...", +".###NMOPccQRe...", +"#nzSTTURVSRW....", +"#icnzXYTZUUe....", +".eeicnmSp0Ne....", +"...eeicpwpe.....", +".....eeppDe.....", +".......eee......"}; diff --git a/noncore/games/kcheckers/pics/king_black.xpm b/noncore/games/kcheckers/pics/king_black.xpm index 382ee71..c5e6703 100644 --- a/noncore/games/kcheckers/pics/king_black.xpm +++ b/noncore/games/kcheckers/pics/king_black.xpm @@ -1,3 +1,3 @@ /* XPM */ -static const char *king_black[]={ +static const char *king_black_xpm[]={ "28 28 8 1", diff --git a/noncore/games/kcheckers/pics/king_white.xpm b/noncore/games/kcheckers/pics/king_white.xpm index 30932e8..f1e4257 100644 --- a/noncore/games/kcheckers/pics/king_white.xpm +++ b/noncore/games/kcheckers/pics/king_white.xpm @@ -1,3 +1,3 @@ /* XPM */ -static const char *king_white[]={ +static const char *king_white_xpm[]={ "28 28 8 1", diff --git a/noncore/games/kcheckers/pics/logo.xpm b/noncore/games/kcheckers/pics/logo.xpm index a47d3de..e6cc0a0 100644 --- a/noncore/games/kcheckers/pics/logo.xpm +++ b/noncore/games/kcheckers/pics/logo.xpm @@ -1,4 +1,4 @@ /* XPM */ -static const char *logo[]={ -"14 14 6 1", +static const char *logo_xpm[]={ +"16 16 6 1", ". c None", @@ -9,15 +9,17 @@ static const char *logo[]={ "a c #ffffff", -"..............", -".############.", -".#aaaab######.", -".#aaaaa######.", -".#aabab######.", -".#aaabb######.", -".#babbb######.", -".######bcbbc#.", -".######bbbbd#.", -".######bbcdd#.", -".######bcddd#.", -".######cdddd#.", -".############.", -".............."}; +"................", +"................", +"..############..", +"..#aaaab######..", +"..#aaaaa######..", +"..#aabab######..", +"..#aaabb######..", +"..#babbb######..", +"..######bcbbc#..", +"..######bbbbd#..", +"..######bbcdd#..", +"..######bcddd#..", +"..######cdddd#..", +"..############..", +"................", +"................"}; diff --git a/noncore/games/kcheckers/pics/man_black.xpm b/noncore/games/kcheckers/pics/man_black.xpm index e40a265..c07b1d6 100644 --- a/noncore/games/kcheckers/pics/man_black.xpm +++ b/noncore/games/kcheckers/pics/man_black.xpm @@ -1,3 +1,3 @@ /* XPM */ -static const char *man_black[]={ +static const char *man_black_xpm[]={ "28 28 8 1", diff --git a/noncore/games/kcheckers/pics/man_white.xpm b/noncore/games/kcheckers/pics/man_white.xpm index b0968db..59556fe 100644 --- a/noncore/games/kcheckers/pics/man_white.xpm +++ b/noncore/games/kcheckers/pics/man_white.xpm @@ -1,3 +1,3 @@ /* XPM */ -static const char *man_white[]={ +static const char *man_white_xpm[]={ "28 28 10 1", diff --git a/noncore/games/kcheckers/pics/marble1.xpm b/noncore/games/kcheckers/pics/marble1.xpm index 124cbd2..087a024 100644 --- a/noncore/games/kcheckers/pics/marble1.xpm +++ b/noncore/games/kcheckers/pics/marble1.xpm @@ -1,4 +1,4 @@ /* XPM */ -static const char *marble1[]={ -"28 28 209 2", +static const char *marble1_xpm[]={ +"32 32 209 2", "#Y c #cbcee3", @@ -239,2 +239,6 @@ static const char *marble1[]={ "Qt.C.o.g.b.C.e.F.C.B#cbd.l#a#a.c.#.Q.l#5.6.6.K#6.u.y.M.ybe.5.a#g", -".C.i#w#w.dau.e.c.b.Q#c#daZ.5.c.e.e#g.i#X#j.w.0af#Hbf#m.q#X#a#e.i"}; +".C.i#w#w.dau.e.c.b.Q#c#daZ.5.c.e.e#g.i#X#j.w.0af#Hbf#m.q#X#a#e.i", +"#w.#bg.j#v.F.i.d.d#y.f#O.5.3#P.3#ya0#q#s#u#k.O.qbhbi#.#Q#k.b.bbj", +"#f.C#w#w.F#e.B.b.lbk#Y.W##.6bbbl.O.w.L.A.l#q#y.B.H.h.#.B.##t.Mac", +".H.F.C#w.3.e.i.i.eaZad.W.0.y#t#m.z#k#l.c.d.E.b#i#8.a.d.##P.z.v.O", +"#V.i.h#f#e.i.e.e.e#Qbm.t.y#k.r.yaf#F#nbn.d.i.h#h#e#v.o#wbo.q#l#l"}; diff --git a/noncore/games/kcheckers/pics/marble2.xpm b/noncore/games/kcheckers/pics/marble2.xpm index f31ee0b..6348bb9 100644 --- a/noncore/games/kcheckers/pics/marble2.xpm +++ b/noncore/games/kcheckers/pics/marble2.xpm @@ -1,3 +1,3 @@ /* XPM */ -static const char *marble2[]={ +static const char *marble2_xpm[]={ "32 32 560 2", diff --git a/noncore/games/kcheckers/pics/marble3.xpm b/noncore/games/kcheckers/pics/marble3.xpm index 36c9b17..3b70b4f 100644 --- a/noncore/games/kcheckers/pics/marble3.xpm +++ b/noncore/games/kcheckers/pics/marble3.xpm @@ -1,3 +1,3 @@ /* XPM */ -static const char *marble3[]={ +static const char *marble3_xpm[]={ "28 28 2 1", diff --git a/noncore/games/kcheckers/pics/undo.xpm b/noncore/games/kcheckers/pics/undo.xpm new file mode 100644 index 0000000..313e1d0 --- a/dev/null +++ b/noncore/games/kcheckers/pics/undo.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static const char *undo_xpm[]={ +"16 16 5 1", +". c None", +"# c #000000", +"c c #a0a0a0", +"b c #dcdcdc", +"a c #ffffff", +"................", +"................", +".......#........", +"......##........", +".....#a#........", +"....#aa########.", +"...#aabaaaaaab#.", +"..#aabbbbbbbbc#.", +"...#abbccccccc#.", +"....#ac########.", +".....#a#........", +"......##........", +".......#........", +"................", +"................", +"................"}; diff --git a/noncore/games/kcheckers/pics/wood1.xpm b/noncore/games/kcheckers/pics/wood1.xpm index 866f8d9..eb2d71d 100644 --- a/noncore/games/kcheckers/pics/wood1.xpm +++ b/noncore/games/kcheckers/pics/wood1.xpm @@ -1,3 +1,3 @@ /* XPM */ -static const char *wood1[]={ +static const char *wood1_xpm[]={ "32 32 82 2", diff --git a/noncore/games/kcheckers/pics/wood2.xpm b/noncore/games/kcheckers/pics/wood2.xpm index c2ff364..b786bfb 100644 --- a/noncore/games/kcheckers/pics/wood2.xpm +++ b/noncore/games/kcheckers/pics/wood2.xpm @@ -1,114 +1,115 @@ /* XPM */ -static const char *wood2[]={ -"32 32 79 2", -"#k c #484c4d", -"#l c #484d47", -"#m c #494a46", -"#d c #4c4841", -"#j c #4c4c48", -".1 c #4e554d", -".9 c #4f483f", -"#e c #4f4c44", -".0 c #4f4f48", -".Z c #4f524d", -".2 c #4f564e", -".X c #515450", -".W c #51564e", -".V c #52574f", -"#. c #544e45", -".U c #545047", -".Y c #54524a", -".8 c #575046", -".T c #575248", -".7 c #57554c", -".t c #57564d", -".B c #575751", -".u c #58574f", -".a c #585950", -".A c #585d52", -".v c #5c584f", -".G c #5d564a", -".# c #5d5a54", -".Q c #5e5649", -".z c #5e5a4f", -".y c #5e5d51", -"Qt c #5e5e55", -".C c #5e5e57", -".E c #5f5a4f", -".x c #5f5e51", -".w c #5f5f54", -".b c #5f6056", -".3 c #615749", -".H c #615d4e", -".F c #615d54", -".n c #615f52", -".c c #615f56", -".S c #625a4d", -".o c #645f57", -".s c #646056", -".D c #646256", -".d c #646258", -".R c #655e4f", -".m c #655f50", -".e c #65675d", -".q c #666657", -".4 c #675d4e", -".l c #675f54", -".p c #676156", -".k c #676456", -".r c #67645a", -".P c #696054", -".j c #696456", -".5 c #69665c", -"#i c #696759", -".I c #6a6657", -".f c #6a675e", -"#h c #6c6a5d", -".L c #6d6152", -".O c #6f6758", -".i c #6f6759", -".h c #6f695d", -".g c #6f6c5e", -"#f c #6f6f62", -".N c #706250", -".M c #706757", -".J c #746c5c", -"## c #766756", -".K c #776f5f", -"#a c #796c57", -".6 c #7d6f5c", -"#g c #7d7462", -"#b c #85745e", -"#c c #8d7d67", -"QtQtQt.#.a.a.a.#Qt.b.c.c.d.d.d.e.f.f.g.h.i.i.i.j.k.l.m.n.o.o.p.p", -".b.b.b.b.c.c.c.c.d.d.d.d.d.d.c.d.q.r.s.s.s.s.s.k.s.s.n.d.d.r.r.r", -".t.u.v.v.#.#.#.#.#.w.x.y.y.z.y.z.z.v.u.a.a.A.y.y.y.yQt.c.c.bQtQt", -".o.o.cQt.#.c.c.c.o.q.d.d.s.s.y.z.z.v.u.B.a.a.aQtQtQt.CQt.y.A.a.A", -".o.o.o.o.o.z.z.x.x.s.s.s.s.D.n.x.x.E.a.a.a.u.u.t.t.u.u.u.v.v.z.a", -".F.F.n.s.s.p.p.s.s.G.z.E.E.E.H.m.l.j.j.I.h.g.g.g.h.h.i.h.J.J.J.K", -".j.j.p.p.p.h.h.h.h.h.h.h.h.g.h.h.h.i.L.L.M.M.M.L.L.L.L.L.N.L.L.L", -".i.i.I.I.j.i.i.h.h.i.i.i.h.h.i.O.O.I.P.L.L.P.P.I.M.M.M.M.M.M.M.M", -".E.E.Q.Q.Q.E.E.H.R.H.H.H.R.R.S.H.H.H.H.H.H.H.S.H.H.H.R.R.H.H.H.H", -".H.H.R.R.m.R.m.p.j.I.I.I.O.O.I.k.l.m.m.m.l.l.l.R.H.E.E.z.x.x.F.n", -".O.I.j.P.l.R.R.R.R.m.m.R.R.H.x.F.F.F.j.j.j.j.j.i.i.i.i.f.r.c.z.z", -".t.t.t.t.t.T.T.U.U.t.t.t.V.W.W.V.V.B.B.B.B.B.B.X.X.X.X.Y.U.U.U.U", -".c.c.w.y.u.a.u.u.t.Y.Y.Y.Z.0.Z.Z.Z.Z.1.1.1.1.1.2.2.2.2.t.u.v.z.x", -".Q.Q.3.H.R.S.S.R.m.P.P.P.l.p.l.l.l.p.s.s.s.s.s.q.q.q.q.o.o.o.c.c", -".4.4.4.4.4.L.L.M.M.J.J.J.J.J.O.M.M.h.O.O.O.O.O.I.I.I.I.5.5.r.o.o", -".M.M.J.K.K.K.K.6.6.6.6.6.K.J.K.K.K.K.K.K.J.J.h.M.O.j.P.F.F.F.F.F", -".G.G.7.T.8.9.9.9.9.9.9.9.9.9.9.9.9.9#..8.T.7.7.E.F.F.F.r.r.r.r.r", -".Q.G.G.8.8.G.8.8.8.Q.Q.3.3.Q.R.l.p.j.5.f.f.f.f.f.5.5.5.o.o.o.o.o", -".L.L.N#########a.6.6.6.6#a#a.L.4.4.4.3.Q.Q.8.8.H.S.S.3.s.o.o.o.o", -"#####a.6#a#a#a#a#a#b.6#b#c#b#b.6#a.N.m.m.R.H.x.x.v.7.T#..U.U.U.U", -"#a.6#b#b#b#b#b#b#b#b#b#b#b#a.N.4.4.S.R.H.E.E.v.z.v.a.B.z.z.v.v.v", -".4.4.N.N.N###a#a.6.N.N.N.4.3.3.3.3.4.3.Q.Q.T.T.8#.#d.9.9.9#e#e#e", -".j.L.O.M#a#a#a#a#a#b#b.6.6#b.6.6#a##.M.L.L.L.l.l.p.5.5.f.f#f#f#f", -".8.8.8.Q.3.4.4.N#a.6#a#a.N.N###a.6#b#b#b#g#g#g.M.P.H.E.E.v.t.T.T", -".M.M.M############.N.N.N.N.N.N.N.N.N.N.L.4.4.S.Q.Q.Q.Q.F.x.x.x.x", -".4.4.4.4.4.N.N.N##.N.N.N.N.N.N.L.L.L.4.4.4.4.l.l.p.p.p.r.d.o.n.n", -".j.j.j.O.M#########a##.M.L.L.O.5.O.j.P.l.R.H.E.F.x.v.v.z.v.t.T.T", -".f.f.5.p.l.R.4.4.4.3.3.Q.Q.Q.S.S.E.E.S.3.E.E.x.n.o.r.r#f#f.g.g.f", -".C.C.d.5.f.5.5.h.g.K.K.g.g.h#h#h#h#i.p.s.n.x.#.a.a.B.B.7.T.T.7.7", -".T.T.T.U.U#e#e.9.9#j#k#k#l#m.0.0.0.0.Z.Y.Y.W.W.B.B.B.B.y.z.z.z.z", -".P.P.l.l.R.R.R.R.S.c.c.o.c.c.x.n.c.s.r.5.r.r.p.p.p.p.p.r.r.r.r.r", -"###a#a.6.6#g#g.6.6.g.g#h.5.r.r.q.r.d.s.c.w.w.x.w.w.w.w.x.F.F.F.F"}; +static const char * wood2_xpm[] = { +"32 32 80 1", +" c None", +". c #4B4B3F", +"+ c #49453D", +"@ c #434438", +"# c #4C4E40", +"$ c #4F4C40", +"% c #535043", +"& c #555849", +"* c #5C584B", +"= c #645F4B", +"- c #645B49", +"; c #645844", +"> c #5B5340", +", c #585340", +"' c #584C3D", +") c #554C38", +"! c #4F4C3B", +"~ c #534C41", +"{ c #584F40", +"] c #565641", +"^ c #585345", +"/ c #534E40", +"( c #414035", +"_ c #434137", +": c #484337", +"< c #4C4C3D", +"[ c #4C4B3A", +"} c #4B493A", +"| c #4B4537", +"1 c #43493B", +"2 c #41413A", +"3 c #4B4B41", +"4 c #535040", +"5 c #4C4537", +"6 c #4F493D", +"7 c #494031", +"8 c #4F4936", +"9 c #5C5641", +"0 c #6C5F48", +"a c #71644C", +"b c #614F3B", +"c c #665841", +"d c #665038", +"e c #645843", +"f c #5B4E3D", +"g c #4B4030", +"h c #554B37", +"i c #504535", +"j c #413B2F", +"k c #3D382E", +"l c #3B4137", +"m c #3A4036", +"n c #3A3D38", +"o c #3D3B31", +"p c #373B35", +"q c #37372F", +"r c #363F35", +"s c #374036", +"t c #4F4130", +"u c #584936", +"v c #5B5648", +"w c #7B6448", +"x c #413F33", +"y c #41382D", +"z c #372F25", +"A c #3D362B", +"B c #6F5840", +"C c #745F41", +"D c #896C4B", +"E c #967B58", +"F c #332F27", +"G c #37332A", +"H c #646450", +"I c #7B6C50", +"J c #5F5C49", +"K c #5B5844", +"L c #33332F", +"M c #2F3335", +"N c #2F352E", +"O c #30312D", +"...+@@@+.#$$%%%&**=-;;;>,')!~~{{", +"####$$$$%%%%%%$%]^/////,//!%%^^^", +"(_::+++++<[}}|}||:_@@1}}}}.$$#..", +"~~$.+$$$~]%%//}||:_2@@@...3.}1@1", +"~~~~~||[[////4![[5@@@__((___::|@", +"66!//{{//7|5558)'>>9-===--;-000a", +">>{{{--------=---;bbcccbbbbbdbbb", +";;99>;;--;;;--;ee9fbbff9cccccccc", +"55ggg558h888hhi8888888i888hh8888", +"88hh)h){>999ee9,')))'''h855|[[6!", +"e9>f'hhhh))hh8[666>>>>>;;;;*^$||", +"(((((jjkk(((lmmll222222nnnnokkkk", +"$$<}_@__(ooopqpppprrrrrssss(_:|[", +"ggt8hiih)fff'{'''{/////]]]]~~~$$", +"uuuuubbcc00000ecc-eeeee9999vv^~~", +"cc0aaaawwwwwa0aaaaaa00-ce>f66666", +"77xjyzzzzzzzzzzzzzAyjxx5666^^^^^", +"g77yy7yyyggttgh'{>v*****vvv~~~~~", +"bbdBBBBCwwwwCCbuuutggyy8iit/~~~~", +"BBCwCCCCCDwDEDDwCd))h8[[:xjAkkkk", +"CwDDDDDDDDDDDCduuih855:|:@2||:::", +"uudddBCCwddduttttutggjjyAFzzzGGG", +">becCCCCCDDwwDwwCBcbbb''{vv**HHH", +"yyygtuudCwCCddBCwDDDIIIcf855:(jj", +"cccBBBBBBddddddddddbuuigggg6[[[[", +"uuuuudddBddddddbbbuuuu''{{{^%~!!", +">>>ecBBBBCBcbbeve>f'h856[::|:(jj", +"**v{'huuuttgggii55it55[!~^^HH==*", +"33%v*vv-=aa==-JJJK{/![+@@22xjjxx", +"jjjkkGGzzLMMNOqqqqpoomm2222}||||", +"ff''hhhhi$$~$$[!$/^v^^{{{{{^^^^^", +"BCCwwIIww==Jv^^]^%/$<<[<<<<[6666"}; diff --git a/noncore/games/kcheckers/pics/wood3.xpm b/noncore/games/kcheckers/pics/wood3.xpm index 5f4f7e2..6c919fa 100644 --- a/noncore/games/kcheckers/pics/wood3.xpm +++ b/noncore/games/kcheckers/pics/wood3.xpm @@ -1,6 +1,6 @@ /* XPM */ -static const char *wood3[]={ +static const char *wood3_xpm[]={ "28 28 2 1", "# c None", -". c #ff8c00", +". c #ff9900", "............................", diff --git a/noncore/games/kcheckers/rcheckers.h b/noncore/games/kcheckers/rcheckers.h index d44bfd1..01913a5 100644 --- a/noncore/games/kcheckers/rcheckers.h +++ b/noncore/games/kcheckers/rcheckers.h @@ -4,3 +4,3 @@ -#include <checkers.h> +#include "checkers.h" diff --git a/pics/kcheckers/KCheckers.xpm b/pics/kcheckers/KCheckers.xpm index 6570d88..1ca8ab1 100644 --- a/pics/kcheckers/KCheckers.xpm +++ b/pics/kcheckers/KCheckers.xpm @@ -1,10 +1,9 @@ /* XPM */ -static const char *biglogo[]={ -"32 32 6 1", +static const char *biglogo_xpm[]={ +"32 32 5 1", ". c None", "# c #000000", -"a c #303030", -"d c #d7d7d7", -"c c #eaeaea", -"b c #ffffff", +"c c #d7d7d7", +"b c #eaeaea", +"a c #ffffff", "................................", @@ -14,24 +13,24 @@ static const char *biglogo[]={ "....########################....", -"....#aaaaaaaaaaaaaaaaaaaaaa#....", -"....#abbbbbbbbbb##########a#....", -"....#abbbbbbbcbc##########a#....", -"....#abbbbbbbbbb##########a#....", -"....#abbbbbcbcbc##########a#....", -"....#abbbbbbbbbb##########a#....", -"....#abbbcbcbcbc##########a#....", -"....#abbbbbbbbbc##########a#....", -"....#abcbcbcbbcc##########a#....", -"....#abbbbbbbccc##########a#....", -"....#abcbcbccccc##########a#....", -"....#a##########cccccccccca#....", -"....#a##########cccccccccca#....", -"....#a##########ccccccccdca#....", -"....#a##########cccccccccca#....", -"....#a##########ccccccdcdca#....", -"....#a##########cccccccccca#....", -"....#a##########ccccdcdcdca#....", -"....#a##########cccccccccda#....", -"....#a##########ccdcdcdcdca#....", -"....#a##########cccccccdcda#....", -"....#aaaaaaaaaaaaaaaaaaaaaa#....", +"....########################....", +"....##aaaaaaaaaa############....", +"....##aaaaaaabab############....", +"....##aaaaaaaaaa############....", +"....##aaaaababab############....", +"....##aaaaaaaaaa############....", +"....##aaabababab############....", +"....##aaaaaaaaab############....", +"....##abababaabb############....", +"....##aaaaaaabbb############....", +"....##abababbbbb############....", +"....############bbbbbbbbbb##....", +"....############bbbbbbbbbb##....", +"....############bbbbbbbbcb##....", +"....############bbbbbbbbbb##....", +"....############bbbbbbcbcb##....", +"....############bbbbbbbbbb##....", +"....############bbbbcbcbcb##....", +"....############bbbbbbbbbc##....", +"....############bbcbcbcbcb##....", +"....############bbbbbbbcbc##....", +"....########################....", "....########################....", |