⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unittetris.h

📁 此为一简单的俄罗斯方块游戏
💻 H
字号:
//---------------------------------------------------------------------------

#ifndef UnitTetrisH
#define UnitTetrisH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "TetrisData.h"
#include <ExtCtrls.hpp>
#include <ActnList.hpp>
#include <Menus.hpp>
#include <AppEvnts.hpp>
//---------------------------------------------------------------------------
class TFormTetris : public TForm
{
__published:	// IDE-managed Components
    TPaintBox *PaintBox1;
    TMainMenu *MainMenu1;
    TActionList *ActionList1;
    TAction *AnNew;
    TAction *AnPause;
    TAction *AnHScore;
    TAction *AnExit;
    TPaintBox *PaintBox2;
    TTimer *Timer1;
    TMenuItem *MmFile;
    TMenuItem *New1;
    TMenuItem *Pause1;
    TMenuItem *HighScore1;
    TMenuItem *Exit1;
    TMenuItem *N1;
    TLabel *LabelLines;
    TLabel *LabelScore;
    TScrollBox *ScrollBox1;
    TApplicationEvents *ApplicationEvents1;
    TLabel *LabelHome;
    TLabel *Label2;
    TLabel *Label3;
    TLabel *Label4;
    TLabel *LabelHighScore;
    TMenuItem *H1;
    TAction *AnHelp;
    TAction *AnAbout;
    TMenuItem *AnHelp1;
    TMenuItem *AnAbout1;
    TLabel *Label1;
    void __fastcall PaintBox1Paint(TObject *Sender);
    void __fastcall FormKeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
    void __fastcall AnNewExecute(TObject *Sender);
    void __fastcall AnPauseExecute(TObject *Sender);
    void __fastcall AnHScoreExecute(TObject *Sender);
    void __fastcall AnExitExecute(TObject *Sender);
    void __fastcall PaintBox2Paint(TObject *Sender);
    void __fastcall Timer1Timer(TObject *Sender);
    void __fastcall ApplicationEvents1Deactivate(TObject *Sender);
    void __fastcall LabelHomeMouseEnter(TObject *Sender);
    void __fastcall LabelHomeMouseLeave(TObject *Sender);
    void __fastcall LabelHomeClick(TObject *Sender);
    void __fastcall AnHelpExecute(TObject *Sender);
    void __fastcall AnAboutExecute(TObject *Sender);
public:
    static const NumScores = 5;
    #pragma pack(push,1)
    typedef struct
     {
       int Score;
       char Name[32];
     } TScoreItem;
    typedef union
     {
       TScoreItem Scores[NumScores];
       char Buffer[512];
     } TTetrisParams;
    #pragma pack(pop)    
private:	// User declarations
    __property bool Paused = { read = _bPaused, write = SetPause };

    bool _bPaused;
    TBaseTetris Tetris;
    TTetrisParams TetrisParams;
    Graphics::TBitmap *TtBmp, *PsBmp, *OvBmp;

    void __fastcall SetPause(bool);
    void __fastcall CheckGameStatus(void);
    void __fastcall RefreshDisplay(void);

    void LoadParams(void);
    void SaveParams(void);
    void GetPlayerName(char *lpName);
    void ShowHighScores(void);
public:		// User declarations
    __fastcall TFormTetris(TComponent* Owner);
    __fastcall ~TFormTetris();
};
//---------------------------------------------------------------------------
extern PACKAGE TFormTetris *FormTetris;
//---------------------------------------------------------------------------
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -