source: trunk/OpenYahtzee/src/MainFrame.h @ 37

Last change on this file since 37 was 37, checked in by guyru, 7 years ago

cleaned up the post scoring code

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.5 KB
Line 
1// $Header$
2/***************************************************************************
3 *   Copyright (C) 2006 by Guy Rutenberg   *
4 *   guyrutenberg@gmail.com   *
5 *                                                                         *
6 *   This program is free software; you can redistribute it and/or modify  *
7 *   it under the terms of the GNU General Public License as published by  *
8 *   the Free Software Foundation; either version 2 of the License, or     *
9 *   (at your option) any later version.                                   *
10 *                                                                         *
11 *   This program is distributed in the hope that it will be useful,       *
12 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14 *   GNU General Public License for more details.                          *
15 *                                                                         *
16 *   You should have received a copy of the GNU General Public License     *
17 *   along with this program; if not, write to the                         *
18 *   Free Software Foundation, Inc.,                                       *
19 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
20 ***************************************************************************/
21/**\file MainFrame.h
22 *\brief Header file for MainFrame class.
23 *
24 * This File contains the declaration of the class MainFrame
25*/
26
27#include "SettingsDB.h"
28#include "HighScoreTableDB.h"
29#ifndef MAINFRAME_INC
30#define MAINFRAME_INC
31
32/// MainFrame class - the main window
33/**
34The Main Frame class is a derieved class from wxFrame which is responsible to
35the main window of the application. This class also hold all the functions
36that process the dice and handles the gameplay. This function are called as
37event handlers.
38*/
39class MainFrame : public wxFrame
40{
41public:
42        // Constructor
43        MainFrame(const wxString& title,  const wxSize& size, long style);
44
45        // Event handlers
46        void OnQuit(wxCommandEvent& event);
47        void OnAbout(wxCommandEvent& event);
48        void OnNewGame (wxCommandEvent& event);
49        void OnUndo (wxCommandEvent& event);
50        void OnShowHighscore (wxCommandEvent& event);
51        void OnSettings (wxCommandEvent& event);
52
53        void OnRollButton (wxCommandEvent& event);
54        void OnUpperButtons (wxCommandEvent& event);
55        void On3ofakindButton (wxCommandEvent& event);
56        void On4ofakindButton (wxCommandEvent& event); 
57        void OnFullHouseButton (wxCommandEvent& event);
58        void OnSmallSequenceButton (wxCommandEvent& event);
59        void OnLargeSequenceButton (wxCommandEvent& event);
60        void OnYahtzeeButton (wxCommandEvent& event);
61        void OnChanceButton (wxCommandEvent& event);
62
63       
64
65private:
66        void ClearDiceHash();
67        void ResetRolls();
68        void YahtzeeBonus();
69        void EndofGame();
70        void HighScoreHandler(int score);
71        inline void EnableUndo(int id);
72        void PostScore(int id);
73
74        //pointers to hold bitmap data for the dices
75        wxBitmap *bitmap_dices[6];
76
77        short int dice[5];      //holds the dices score
78        short int dicehash[6];  //the dice hash
79        short int m_rolls;      //holds how many rolls left
80        short int m_numofplaysleft; //holds how many times the user got to score untill the end of the game
81        bool m_yahtzee;
82
83        short int m_lastmove; //stores the ID of the last button pressed.
84        short int m_rollsundo; //holds the number of remaining rolls for use with the undo option
85
86        SettingsDB *m_settingsdb; //handles the settings database
87        HighScoreTableDB *m_highscoredb; //handles the highscore database managment
88
89};
90#endif
Note: See TracBrowser for help on using the repository browser.