diff options
author | gregory guy <[email protected]> | 2020-11-25 15:16:40 +0100 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2020-12-02 19:51:38 +0100 |
commit | d607668c5a772823d6cf59df205b7aa6d2ac2130 (patch) | |
tree | 7f8b4d8c5b0f26fed9bc870bea548cac766099a0 | |
parent | cc192fd9396098134f6aa1369d63c4b270cddfe9 (diff) | |
download | tdegames-d607668c5a772823d6cf59df205b7aa6d2ac2130.tar.gz tdegames-d607668c5a772823d6cf59df205b7aa6d2ac2130.zip |
Turn into a TDE application.
The game is renamed TDEFifteen (original name: q15).
Add icons (Public Domaine, https://commons.wikimedia.org/wiki/File:15-puzzle.svg).
Signed-off-by: gregory guy <[email protected]>
(cherry picked from commit e33e8edb80936f8dd04729d70c0c991612340d5e)
25 files changed, 178 insertions, 166 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3631385f..760ddcb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,7 @@ option( BUILD_KTRON "Build ktron" ${BUILD_ALL} ) option( BUILD_KTUBERLING "Build ktuberling" ${BUILD_ALL} ) option( BUILD_LSKAT "Build lskat" ${BUILD_ALL} ) option( BUILD_TWIN4 "Build twin4" ${BUILD_ALL} ) -option( BUILD_Q15 "Build q15" ${BUILD_ALL} ) +option( BUILD_TDEFIFTEEN "Build tdefifteen" ${BUILD_ALL} ) ##### configure checks @@ -161,7 +161,7 @@ tde_conditional_add_subdirectory( BUILD_KTRON ktron ) tde_conditional_add_subdirectory( BUILD_KTUBERLING ktuberling ) tde_conditional_add_subdirectory( BUILD_LSKAT lskat ) tde_conditional_add_subdirectory( BUILD_TWIN4 twin4 ) -tde_conditional_add_subdirectory( BUILD_Q15 q15 ) +tde_conditional_add_subdirectory( BUILD_TDEFIFTEEN tdefifteen ) if( BUILD_KSIRTET OR BUILD_KFOULEGGS OR BUILD_KLICKETY ) add_subdirectory( libksirtet ) diff --git a/q15/CMakeLists.txt b/q15/CMakeLists.txt deleted file mode 100644 index 0b719487..00000000 --- a/q15/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ - -add_subdirectory( src ) diff --git a/q15/README b/q15/README deleted file mode 100644 index 7ecc7015..00000000 --- a/q15/README +++ /dev/null @@ -1 +0,0 @@ -Fifteen puzzle game diff --git a/q15/src/main.cpp b/q15/src/main.cpp deleted file mode 100644 index 849a4ee6..00000000 --- a/q15/src/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * $Id: main.cpp,v 0.1 2005/08/14 11:21:13 denis Exp $ - * - * Author: Denis Kozadaev ([email protected]) - * Description: - * - * See also: style(9) - * - * Hacked by: - */ - -#include <stdlib.h> - -#include <tqapplication.h> - -#include "mainwindow.h" - - -const int XSize = 640, YSize = 480; - -int -main(int argc, char *argv[]) -{ - TQApplication *app; - MainWindow *mw; - int result; - - app = new TQApplication(argc, argv); - mw = new MainWindow(NULL); - - mw->resize(XSize, YSize); - mw->show(); - mw->setMinimumSize(mw->size()); - mw->setMaximumSize(mw->size()); - result = app->exec(); - - delete mw; - delete app; - - return (result); -} diff --git a/q15/src/mainwindow.cpp b/q15/src/mainwindow.cpp deleted file mode 100644 index 593b0fc9..00000000 --- a/q15/src/mainwindow.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id: mainwindow.cpp,v 0.1 2005/08/14 11:25:03 denis Exp $ - * - * Author: Denis Kozadaev ([email protected]) - * Description: - * - * See also: style(9) - * - * Hacked by: - */ - -#include <tqapplication.h> - -#include "mainwindow.h" - -MainWindow::MainWindow(TQWidget *parent, const char *name) - :TQMainWindow(parent, name) -{ - file = new TQPopupMenu(this); - file->insertItem(tr("New"), this, SLOT(newGame()), TQt::CTRL + TQt::Key_N); - file->insertItem(tr("Load an image"), this, SLOT(loadImage()), - TQt::CTRL + TQt::Key_L); - file->insertItem(tr("Quit"), tqApp, SLOT(quit()), TQt::CTRL + TQt::Key_Q); - - menuBar()->insertItem(tr("File"), file); - - gb = new GameBoard(this); - setCentralWidget(gb); -} - -MainWindow::~MainWindow() -{ - delete gb; - delete file; -} - - -void -MainWindow::newGame() -{ - gb->newGame(); -} - - -void -MainWindow::loadImage() -{ - gb->loadImage(); -} - -#include "mainwindow.moc" diff --git a/q15/src/mainwindow.h b/q15/src/mainwindow.h deleted file mode 100644 index 2b898f7e..00000000 --- a/q15/src/mainwindow.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * $Id: mainwindow.h,v 0.1 2005/08/14 11:25:03 denis Exp $ - * - * Author: Denis Kozadaev ([email protected]) - * Description: - * - * See also: style(9) - * - * Hacked by: - */ - -#ifndef __MAIN_WINDOW_H__ -#define __MAIN_WINDOW_H__ - -#include <stdlib.h> - -#include <tqmainwindow.h> -#include <tqmenubar.h> -#include <tqpopupmenu.h> - -#include "gameboard.h" - -class MainWindow:public TQMainWindow -{ - Q_OBJECT - -public: - MainWindow(TQWidget *parent = NULL, const char *name = NULL); - ~MainWindow(); - -private: - TQPopupMenu *file; - GameBoard *gb; - -private slots: - void newGame(); - void loadImage(); -}; - -#endif /* __MAIN_WINDOW_H__ */ diff --git a/tdefifteen/AUTHORS b/tdefifteen/AUTHORS new file mode 100644 index 00000000..c9b6db11 --- /dev/null +++ b/tdefifteen/AUTHORS @@ -0,0 +1 @@ +Denis Kozadaev ([email protected]) diff --git a/tdefifteen/CMakeLists.txt b/tdefifteen/CMakeLists.txt new file mode 100644 index 00000000..d08a5117 --- /dev/null +++ b/tdefifteen/CMakeLists.txt @@ -0,0 +1,2 @@ + +tde_auto_add_subdirectories() diff --git a/tdefifteen/COPYRIGHT b/tdefifteen/COPYRIGHT new file mode 100644 index 00000000..60896343 --- /dev/null +++ b/tdefifteen/COPYRIGHT @@ -0,0 +1,15 @@ +Copyright (c) 2017-2020 Denis Kozadaev + +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. + +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. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/tdefifteen/README b/tdefifteen/README new file mode 100644 index 00000000..94a13563 --- /dev/null +++ b/tdefifteen/README @@ -0,0 +1,7 @@ +TDEFifteen is a sliding puzzle that consists of a frame of numbered +square tiles in random order with one tile missing. + +This kind of puzzle have many names such as: Gem Puzzle, Boss Puzzle, +Game of Fifteen... + +For more information: https://en.wikipedia.org/wiki/15_puzzle diff --git a/tdefifteen/icons/CMakeLists.txt b/tdefifteen/icons/CMakeLists.txt new file mode 100644 index 00000000..f9a2c11b --- /dev/null +++ b/tdefifteen/icons/CMakeLists.txt @@ -0,0 +1,3 @@ +##### icons + +tde_install_icons( tdefifteen ) diff --git a/tdefifteen/icons/hi128-app-tdefifteen.png b/tdefifteen/icons/hi128-app-tdefifteen.png Binary files differnew file mode 100644 index 00000000..244a3a7c --- /dev/null +++ b/tdefifteen/icons/hi128-app-tdefifteen.png diff --git a/tdefifteen/icons/hi16-app-tdefifteen.png b/tdefifteen/icons/hi16-app-tdefifteen.png Binary files differnew file mode 100644 index 00000000..8dcf6383 --- /dev/null +++ b/tdefifteen/icons/hi16-app-tdefifteen.png diff --git a/tdefifteen/icons/hi22-app-tdefifteen.png b/tdefifteen/icons/hi22-app-tdefifteen.png Binary files differnew file mode 100644 index 00000000..8c303f97 --- /dev/null +++ b/tdefifteen/icons/hi22-app-tdefifteen.png diff --git a/tdefifteen/icons/hi32-app-tdefifteen.png b/tdefifteen/icons/hi32-app-tdefifteen.png Binary files differnew file mode 100644 index 00000000..6e63339d --- /dev/null +++ b/tdefifteen/icons/hi32-app-tdefifteen.png diff --git a/tdefifteen/icons/hi48-app-tdefifteen.png b/tdefifteen/icons/hi48-app-tdefifteen.png Binary files differnew file mode 100644 index 00000000..477ebb02 --- /dev/null +++ b/tdefifteen/icons/hi48-app-tdefifteen.png diff --git a/tdefifteen/icons/hi64-app-tdefifteen.png b/tdefifteen/icons/hi64-app-tdefifteen.png Binary files differnew file mode 100644 index 00000000..3ad3668b --- /dev/null +++ b/tdefifteen/icons/hi64-app-tdefifteen.png diff --git a/q15/src/CMakeLists.txt b/tdefifteen/src/CMakeLists.txt index 9a71c1fd..796747d9 100644 --- a/q15/src/CMakeLists.txt +++ b/tdefifteen/src/CMakeLists.txt @@ -24,16 +24,22 @@ link_directories( ) -##### (executable) q15 +##### (executable) tdefifteen -tde_add_executable( q15 AUTOMOC +tde_add_executable( tdefifteen AUTOMOC SOURCES gameboard.cpp main.cpp mainwindow.cpp LINK - tqt-mt + tdeui-shared + tdecore-shared DESTINATION ${BIN_INSTALL_DIR} ) + + +###### other data + +tde_create_translated_desktop( tdefifteen.desktop ) diff --git a/q15/src/cat.xpm b/tdefifteen/src/cat.xpm index e0e2645f..e0e2645f 100644 --- a/q15/src/cat.xpm +++ b/tdefifteen/src/cat.xpm diff --git a/q15/src/gameboard.cpp b/tdefifteen/src/gameboard.cpp index 51767064..7fb1c041 100644 --- a/q15/src/gameboard.cpp +++ b/tdefifteen/src/gameboard.cpp @@ -1,17 +1,9 @@ -/* - * $Id: gameboard.cpp,v 0.1 2005/08/14 12:10:05 denis Exp $ - * - * Author: Denis Kozadaev ([email protected]) - * Description: - * - * See also: style(9) - * - * Hacked by: - */ - -#include <stdlib.h> - -#include <tqapplication.h> +// Author: Denis Kozadaev - (c) 2017-2020 + + +#include <cstdlib> + +#include <tdeapplication.h> #include <tqpainter.h> #include <tqcursor.h> #include <tqmessagebox.h> @@ -251,7 +243,7 @@ GameBoard::startMoving(int i, int t) dx = step(xt, map[n]->x()); dy = step(yt, map[n]->y()); tmr->start(DELAY); - TQApplication::setOverrideCursor(TQCursor(TQt::WaitCursor)); + TDEApplication::setOverrideCursor(TQCursor(TQt::WaitCursor)); } @@ -305,7 +297,7 @@ GameBoard::moveItem() xt = yt = -1; dx = dy = 0; tmr->stop(); - TQApplication::restoreOverrideCursor(); + TDEApplication::restoreOverrideCursor(); checkEndGame(); } } diff --git a/q15/src/gameboard.h b/tdefifteen/src/gameboard.h index 8150acb6..55b25e29 100644 --- a/q15/src/gameboard.h +++ b/tdefifteen/src/gameboard.h @@ -1,13 +1,5 @@ -/* - * $Id: gameboard.h,v 0.1 2005/08/14 12:10:05 denis Exp $ - * - * Author: Denis Kozadaev ([email protected]) - * Description: - * - * See also: style(9) - * - * Hacked by: - */ +// Author: Denis Kozadaev - (c) 2017-2020 + #ifndef __GAME_BOARD_H__ #define __GAME_BOARD_H__ diff --git a/tdefifteen/src/main.cpp b/tdefifteen/src/main.cpp new file mode 100644 index 00000000..d9d5c989 --- /dev/null +++ b/tdefifteen/src/main.cpp @@ -0,0 +1,45 @@ +// Author: Denis Kozadaev - (c) 2017-2020 + + +#include "mainwindow.h" + +#include <tdeaboutdata.h> +#include <tdeapplication.h> +#include <tdecmdlineargs.h> +#include <tdelocale.h> + + +const int XSize = 640, YSize = 480; +static const char description[] = I18N_NOOP("TDEFifteen is a sliding puzzle\n" + "that consists of a frame of numbered square tiles\n" + "in random order with one tile missing."); + + +int main(int argc, char *argv[]) +{ + TDEAboutData about( "tdefifteen", // program name used internally + I18N_NOOP("TDEFifteen"), // displayable program name + "14.0.10", // program version string + description, // short description + TDEAboutData::License_GPL, // licence type + I18N_NOOP("(c) 2017-2020 Denis Kozadaev"), // copyright statement + 0, // text - any information + "http://trinitydesktop.org", // home page address + 0); // bug email address + + about.addAuthor( "Denis Kozadaev", "Author", "[email protected]" ); + + TDECmdLineArgs::init(argc, argv, &about); + TDEApplication app; + MainWindow* mainWin = new MainWindow(); + + mainWin->resize(XSize, YSize); + mainWin->setMinimumSize( mainWin->size() ); + mainWin->setMaximumSize( mainWin->size() ); + + app.setMainWidget( mainWin ); + app.miniIcon(); + mainWin->show(); + + return app.exec(); +} diff --git a/tdefifteen/src/mainwindow.cpp b/tdefifteen/src/mainwindow.cpp new file mode 100644 index 00000000..258b0220 --- /dev/null +++ b/tdefifteen/src/mainwindow.cpp @@ -0,0 +1,45 @@ +// Author: Denis Kozadaev - (c) 2017-2020 + + +#include "mainwindow.h" + +#include <tdeactionclasses.h> +#include <tdemenubar.h> + +#include <kiconloader.h> + + +MainWindow::MainWindow(TQWidget* parent, const char* name) : TDEMainWindow(parent, name) +{ + TDEAction* actionQuit = KStdAction::quit(this, SLOT(close()), 0); + TDEAction* actionNew = new TDEAction( "&New Game", "reload", TQt::CTRL + TQt::Key_N, this, SLOT(newGame()), this, "New Game"); + + mMenu = new TDEPopupMenu(this); + mMenu->insertItem(SmallIcon("images_display"), "Load an image", this, SLOT(loadImage()), TQt::CTRL + TQt::Key_L); + mMenu->insertSeparator(); + + actionNew->plug(mMenu); + actionQuit->plug(mMenu); + menuBar()->insertItem(tr("Menu"), mMenu); + + mBoard = new GameBoard(this); + setCentralWidget(mBoard); +} + +MainWindow::~MainWindow() +{ + delete mBoard; + delete mMenu; +} + +void MainWindow::newGame() +{ + mBoard->newGame(); +} + +void MainWindow::loadImage() +{ + mBoard->loadImage(); +} + +#include "mainwindow.moc" diff --git a/tdefifteen/src/mainwindow.h b/tdefifteen/src/mainwindow.h new file mode 100644 index 00000000..46391c73 --- /dev/null +++ b/tdefifteen/src/mainwindow.h @@ -0,0 +1,30 @@ +// Author: Denis Kozadaev - (c) 2017-2020 + + +#ifndef __MAIN_WINDOW_H__ +#define __MAIN_WINDOW_H__ + +#include <tdemainwindow.h> +#include <tdepopupmenu.h> + +#include "gameboard.h" + + +class MainWindow : public TDEMainWindow +{ + Q_OBJECT + +public: + MainWindow(TQWidget* parent = 0, const char* name = 0); + ~MainWindow(); + +private: + TDEPopupMenu* mMenu; + GameBoard* mBoard; + +private slots: + void newGame(); + void loadImage(); +}; + +#endif /* __MAIN_WINDOW_H__ */ diff --git a/tdefifteen/src/tdefifteen.desktop b/tdefifteen/src/tdefifteen.desktop new file mode 100644 index 00000000..e3409b4f --- /dev/null +++ b/tdefifteen/src/tdefifteen.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=TDEFifteen +GenericName=Puzzle-solving game +Exec=tdefifteen +Comment=Sliding puzzle with one missing tile +Icon=tdefifteen +Terminal=false +Type=Application +Categories=Qt;TDE;Game;BoardGame; |