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

Last change on this file since 59 was 58, checked in by guyru, 6 years ago

calculate subtotal score

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 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        void OnCheckForUpdates (wxCommandEvent& event);
53        void OnSendComment (wxCommandEvent& event);
54
55        void OnRollButton (wxCommandEvent& event);
56        void OnUpperButtons (wxCommandEvent& event);
57        void On3ofakindButton (wxCommandEvent& event);
58        void On4ofakindButton (wxCommandEvent& event); 
59        void OnFullHouseButton (wxCommandEvent& event);
60        void OnSmallSequenceButton (wxCommandEvent& event);
61        void OnLargeSequenceButton (wxCommandEvent& event);
62        void OnYahtzeeButton (wxCommandEvent& event);
63        void OnChanceButton (wxCommandEvent& event);
64
65       
66
67private:
68        void ClearDiceHash();
69        void ResetRolls();
70        void YahtzeeBonus();
71        bool YahtzeeJoker();
72        void EndofGame();
73        void HighScoreHandler(int score);
74        inline void EnableUndo(int id);
75        void PostScore(int id);
76        void CalculateSubTotal();
77        void LaunchBrowser (wxString link);
78
79        //pointers to hold bitmap data for the dices
80        wxBitmap *bitmap_dices[6];
81
82        short int dice[5];      //holds the dices score
83        short int dicehash[6];  //the dice hash
84        short int m_rolls;      //holds how many rolls left
85        short int m_numofplaysleft; //holds how many times the user got to score untill the end of the game
86        bool m_yahtzee;
87        bool m_yahtzeebonus; //tells the undo if there is also an yahtzee bonus to undo
88
89        short int m_lastmove; //stores the ID of the last button pressed.
90        short int m_rollsundo; //holds the number of remaining rolls for use with the undo option
91
92        SettingsDB *m_settingsdb; //handles the settings database
93        HighScoreTableDB *m_highscoredb; //handles the highscore database managment
94
95        bool m_animate; //sets whether to animate the dice.
96        bool m_calculatesubtotal; //sets whether to calculate the subtotal after every score or not
97
98};
99#endif
Note: See TracBrowser for help on using the repository browser.