|
Source listing: echo $file; ?>. Return to
the main page
/* -*- C++ -*-
*******************************************************************
*
*
* Shisen-Sho for Windows
*
* frame.h - Declaration of the Frame class
*
*
*******************************************************************
*
* A japanese game similar to mahjongg
*
*******************************************************************
*
* Created 2000-12-28 by Jim Mason <jmason@sirius.com>
*
* Game engine ported from Mario Weilguni's <mweilguni@sime.com>
* original game for KDE, KSHISEN. If you are interested in the
* KDE version of the game, see http://www.kde.org/kdegames/
*
*******************************************************************
*
* 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, 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; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*******************************************************************
*/
#ifndef _FRAME_H_
#define _FRAME_H_
#include "wndcore.h"
#include "board.h"
#include "StdString.h"
struct HighScore {
char name[32];
int seconds;
int x, y;
time_t date;
int gravity;
};
const unsigned HIGHSCORE_MAX = 10;
class Frame : public Window {
// Construction
public:
Frame();
// Implementation
public:
~Frame();
protected:
void BeginWaitCursor();
void EndWaitCursor();
void UpdateScore();
void SetCheatMode(BOOL bCheat);
protected:
void OnGetMinMaxInfo(LPMINMAXINFO lpMMI);
void OnSize(UINT nType, int cx, int cy);
void OnTimer(UINT nIDEvent);
void OnUndo();
void OnRedo();
void OnGetHint();
void OnNewGame();
void OnRestartGame();
void OnPauseGame();
void OnIsSolvable();
void OnHallOfFame();
void OnFinish();
void OnSolvable();
void OnGravity();
void OnLevelChange(UINT nID);
void OnSizeChange(UINT nID);
void OnSpeedChange(UINT nID);
void OnSelectTileset();
void OnInitMenuPopup(HMENU hMenu, UINT nIndex, BOOL bSysMenu);
void OnUpdateMenu(HMENU hMenu, UINT nID);
void OnAppAbout();
LRESULT OnEndOfGame(WPARAM wParam, LPARAM lParam);
public:
void LoadDefaults();
CStdString GetPlayerName();
static int GetScore(HighScore &hs);
BOOL IsBetter(HighScore &hs, HighScore &than);
int InsertHighscore(HighScore &hs);
void ReadHighscore();
void WriteHighscore();
void ShowHighscore(int focusitem = -1);
// Overrides
protected:
BOOL PreCreateWindow(CREATESTRUCT &cs);
LRESULT WndProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
int OnCreate(LPCREATESTRUCT lpCreateStruct);
void OnDestroy();
BOOL OnCommand(UINT nID, UINT nEvent, HWND hSource);
protected:
std::vector<HighScore> m_highscore;
protected:
UINT m_nTimer;
HCURSOR m_hWait, m_hArrow;
CStdString m_szStatus;
Board m_board;
HWND m_hStatus;
};
#endif // ndef _FRAME_H_
<< Back to Shisen-Sho
|
|