• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kgoldrunner

kgoldrunner.h

Go to the documentation of this file.
00001 /*
00002     Copyright 2002 Marco Krüger <grisuji@gmx.de>
00003     Copyright 2002 Ian Wadham <ianw2@optusnet.com.au>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #ifndef _KGOLDRUNNER_H_
00021 #define _KGOLDRUNNER_H_
00022 
00023 // Status bar
00024 const int ID_LIVES      = 0;            // Field IDs in KDE status bar.
00025 const int ID_SCORE      = 1;
00026 const int ID_LEVEL      = 2;
00027 const int ID_HINTAVL    = 3;
00028 const int ID_MSG        = 4;
00029 
00030 const int L_LIVES       = 15;       // Lengths of fields.
00031 const int L_SCORE       = 17;
00032 const int L_LEVEL       = 15;
00033 
00034 #include <kxmlguiwindow.h>
00035 #include <kstandarddirs.h>
00036 #include "kgrconsts.h"
00037 
00038 class QAction;
00039 class KAction;
00040 class KToggleAction;
00041 class KToggleFullScreenAction;
00042 
00043 class KGrGame;
00044 class KGrCanvas;
00045 class KGrHero;
00046 
00055 class KGoldrunner : public KXmlGuiWindow
00056 {
00057     Q_OBJECT
00058 public:
00062     KGoldrunner();
00063 
00067     virtual ~KGoldrunner();
00068 
00069     bool startedOK() {return (startupOK);}
00070 
00071 protected:
00076     void saveProperties(KConfigGroup &);
00077 
00083     void readProperties(const KConfigGroup &);
00084 
00085     bool queryClose ();     // To save edits before closing.
00086 
00087 private slots:
00088     // Slot to pause or restart the game.
00089     void stopStart();
00090 
00091     // Slot to change the graphics theme.
00092     void changeTheme (const QString & themeFilepath);
00093 
00094     // Local slots to create or edit game information.
00095     void createGame();
00096     void editGameInfo();
00097 
00098     // Local slots to set mouse/keyboard control of the hero.
00099     void setMouseMode();
00100     void setKeyBoardMode();
00101 
00102     // Local slots to set game speed.
00103     void normalSpeed();
00104     void beginSpeed();
00105     void champSpeed();
00106     void incSpeed();
00107     void decSpeed();
00108 
00109     // Slots to set Traditional or KGoldrunner rules.
00110     void setTradRules();
00111     void setKGrRules();
00112 
00113     // Local slots for hero control keys.
00114     void goUp();
00115     void goR();
00116     void goDown();
00117     void goL();
00118     void stop();
00119     void digR();
00120     void digL();
00121 
00122     void setKey (KBAction movement);
00123 
00124     // Local slots for authors' debugging aids.
00125     void showEnemy0();
00126     void showEnemy1();
00127     void showEnemy2();
00128     void showEnemy3();
00129     void showEnemy4();
00130     void showEnemy5();
00131     void showEnemy6();
00132 
00133     // void optionsShowToolbar();
00134     // void optionsShowStatusbar();
00135     void optionsConfigureKeys();
00136     // void optionsConfigureToolbars();
00137     // void optionsPreferences();
00138     // void newToolbarConfig();
00139 
00140     void changeStatusbar(const QString& text);
00141     void changeCaption(const QString& text);
00142 
00143     void showLevel (int);       // Show the current level number.
00144     void showLives (long);      // Show how many lives are remaining.
00145     void showScore (long);      // Show the player's score.
00146     void gameFreeze (bool);     // Status feedback on freeze/unfreeze.
00147 
00148     void adjustHintAction (bool);   // Enable/disable "Hint" action.
00149     void markRuleType (char ruleType);  // Check game's rule type in the menu.
00150     void setEditMenu (bool on_off); // Enable/disable "Save Edits" action.
00151     void setEditIcon (const QString & actionName, const char iconType);
00152     void viewFullScreen(bool activation);
00153 
00154     QSize sizeHint() const;
00155 
00156 private:
00157     void setupActions();
00158     void initStatusBar();
00159     void setupEditToolbarActions();
00160     void setupThemes();
00161 
00162 private:
00163     bool startupOK;
00164 
00165     KGrCanvas * view;
00166     KGrGame *   game;
00167 
00168     bool getDirectories();      // Get directory paths, as below.
00169     QString systemHTMLDir;      // Where the manual is stored.
00170     QString systemDataDir;      // Where the system levels are stored.
00171     QString userDataDir;        // Where the user levels are stored.
00172 
00173     QAction *       saveGame;   // Save game, level, lives and score.
00174 
00175     // A KAction is needed here, to get access to KShortcut::setAlternate().
00176     KAction *       myPause;    // Pause or resume the game.
00177     QString     pauseKeys;  // Keystroke names to put in status bar.
00178 
00179     QAction *       hintAction; // Display a hint, if available.
00180     QAction *       killHero;   // Kill hero (disabled during edits).
00181     QAction *       highScore;  // High scores (disabled during edits).
00182 
00183     QAction *       saveEdits;  // Save a level that has been edited.
00184 
00185     KToggleFullScreenAction *fullScreen; // Show Full Screen Mode on menu.
00186     KToggleAction * setMouse;   // Show mouse/keyboard mode on menu.
00187     KToggleAction * setKeyboard;    // Show mouse/keyboard mode on menu.
00188 
00189     KToggleAction * tradRules;  // Set Traditional rules.
00190     KToggleAction * kgrRules;   // Set KGoldrunner rules.
00191 
00192     KGrHero *   hero;           // Pointer to the hero.
00193 
00194     // KToggleAction *  m_toolbarAction;
00195     // KToggleAction *  m_statusbarAction;
00196 
00197     KToolBar *      editToolbar;    // Toolbar for creating/editing levels.
00198     KToggleAction *     m_defaultEditAct;
00199 private slots:
00200     void freeSlot();            // Set editObj to Free Space.
00201     void edheroSlot();          // Set editObj to Hero.
00202     void edenemySlot();         // Set editObj to Enemy.
00203     void brickSlot();           // Set editObj to Brick.
00204     void betonSlot();           // Set editObj to Concrete.
00205     void fbrickSlot();          // Set editObj to Fall-through Brick.
00206     void ladderSlot();          // Set editObj to Ladder.
00207     void hladderSlot();         // Set editObj to Hidden Ladder.
00208     void poleSlot();            // Set editObj to Pole (or Bar).
00209     void nuggetSlot();          // Set editObj to Gold Nugget.
00210     void defaultEditObj();      // Set editObj to default (brick).
00211 };
00212 
00213 #endif // _KGOLDRUNNER_H_

kgoldrunner

Skip menu "kgoldrunner"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal