• Skip to content
  • Skip to link menu
KDE 4.2 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 
00072     bool startedOK() {return (startupOK);}
00073 
00074 protected:
00079     void saveProperties (KConfigGroup &);
00080 
00086     void readProperties (const KConfigGroup &);
00087 
00089     bool queryClose();
00090 
00091 private slots:
00092     // An extension of the constructor.  Gives us two scans of the event queue.
00093     void KGoldrunner_2();
00094 
00095     // Slot to pause or restart the game.
00096     void stopStart();
00097 
00098     // Slot to change the graphics theme.
00099     void changeTheme (const QString & themeFilepath);
00100 
00101     // Local slots to create or edit game information.
00102     void createGame();
00103     void editGameInfo();
00104 
00105     // Local slots to set mouse/keyboard control of the hero.
00106     void setMouseMode();
00107     void setKeyBoardMode();
00108 
00109     // Local slots to set game speed.
00110     void normalSpeed();
00111     void beginSpeed();
00112     void champSpeed();
00113     void incSpeed();
00114     void decSpeed();
00115 
00116     // Slots to set Traditional or KGoldrunner rules.
00117     void setTradRules();
00118     void setKGrRules();
00119 
00120     // Local slots for hero control keys.
00121     void goUp();
00122     void goR();
00123     void goDown();
00124     void goL();
00125     void stop();
00126     void digR();
00127     void digL();
00128 
00129     void setKey (KBAction movement);
00130 
00131     // Local slots for authors' debugging aids.
00132     void showEnemy0();
00133     void showEnemy1();
00134     void showEnemy2();
00135     void showEnemy3();
00136     void showEnemy4();
00137     void showEnemy5();
00138     void showEnemy6();
00139 
00140     // void optionsShowToolbar();
00141     // void optionsShowStatusbar();
00142     void optionsConfigureKeys();
00143     // void optionsConfigureToolbars();
00144     // void optionsPreferences();
00145     // void newToolbarConfig();
00146 
00147     void changeStatusbar (const QString& text);
00148     void changeCaption (const QString& text);
00149 
00150     void showLevel (int);       // Show the current level number.
00151     void showLives (long);      // Show how many lives are remaining.
00152     void showScore (long);      // Show the player's score.
00153     void gameFreeze (bool);     // Status feedback on freeze/unfreeze.
00154 
00155     void adjustHintAction (bool);   // Enable/disable "Hint" action.
00156     void markRuleType (char ruleType);  // Check game's rule type in the menu.
00157     void setEditMenu (bool on_off); // Enable/disable "Save Edits" action.
00158     void setEditIcon (const QString & actionName, const char iconType);
00159     void viewFullScreen (bool activation);
00160 
00161     QSize sizeHint() const;
00162 
00163 private:
00164     void setupActions();
00165     void initStatusBar();
00166     void setupEditToolbarActions();
00167     void setupThemes();
00168 
00169 private:
00170     bool startupOK;
00171 
00172     KGrCanvas * view;
00173     KGrGame *   game;
00174 
00175     bool getDirectories();      // Get directory paths, as below.
00176     QString systemHTMLDir;      // Where the manual is stored.
00177     QString systemDataDir;      // Where the system levels are stored.
00178     QString userDataDir;        // Where the user levels are stored.
00179 
00180     QAction *       saveGame;   // Save game, level, lives and score.
00181 
00182     // A KAction is needed here, to get access to KShortcut::setAlternate().
00183     KAction *       myPause;    // Pause or resume the game.
00184     QString     pauseKeys;  // Keystroke names to put in status bar.
00185 
00186     QAction *       hintAction; // Display a hint, if available.
00187     QAction *       killHero;   // Kill hero (disabled during edits).
00188     QAction *       highScore;  // High scores (disabled during edits).
00189 
00190     QAction *       saveEdits;  // Save a level that has been edited.
00191 
00192     KToggleFullScreenAction *fullScreen; // Show Full Screen Mode on menu.
00193     KToggleAction * setMouse;   // Show mouse/keyboard mode on menu.
00194     KToggleAction * setKeyboard;    // Show mouse/keyboard mode on menu.
00195 
00196     KToggleAction * tradRules;  // Set Traditional rules.
00197     KToggleAction * kgrRules;   // Set KGoldrunner rules.
00198 
00199     KToggleAction * setSounds;  // enable/disable sound effects.
00200 
00201     KGrHero *   hero;           // Pointer to the hero.
00202 
00203     // KToggleAction *  m_toolbarAction;
00204     // KToggleAction *  m_statusbarAction;
00205 
00206     KToolBar *      editToolbar;    // Toolbar for creating/editing levels.
00207     KToggleAction *     m_defaultEditAct;
00208 private slots:
00209     void freeSlot();            // Set editObj to Free Space.
00210     void edheroSlot();          // Set editObj to Hero.
00211     void edenemySlot();         // Set editObj to Enemy.
00212     void brickSlot();           // Set editObj to Brick.
00213     void betonSlot();           // Set editObj to Concrete.
00214     void fbrickSlot();          // Set editObj to Fall-through Brick.
00215     void ladderSlot();          // Set editObj to Ladder.
00216     void hladderSlot();         // Set editObj to Hidden Ladder.
00217     void poleSlot();            // Set editObj to Pole (or Bar).
00218     void nuggetSlot();          // Set editObj to Gold Nugget.
00219     void defaultEditObj();      // Set editObj to default (brick).
00220 };
00221 
00222 #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