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

📄 victorddraw8.h

📁 一个小游戏程序!! 大家可以来
💻 H
字号:
//---------------------------------------------------------------------------

#ifndef VictorDDraw8H
#define VictorDDraw8H
//---------------------------------------------------------------------------
#ifndef STRICT
#  define STRICT
#endif
//---------------------------------------------------------------------------
#include <vcl.h>
#include <SysUtils.hpp>
#include <Classes.hpp>
#include <forms.hpp>
#include "TDDrawBase.h"
//---------------------------------------------------------------------------
class PACKAGE TCustomDDraw8:public TComponent
{
public:
  __fastcall TCustomDDraw8(TComponent* AOwner);
  __fastcall ~TCustomDDraw8();

  __property int ScreenWidth  = { read = _ScrWidth  , write = fSetScrWidth  };
  __property int ScreenHeight = { read = _ScrHeight , write = fSetScrHeight };
  __property int ScreenBpp    = { read = _ScrBpp    , write = fSetScrBpp    };

  __property bool          Active   = { read = fGetActive, write = fSetActive       };
  __property bool          Windowed = { read = _bWindowedMode, write = fSetWindowed };
  __property TDDrawDisplay *Display = { read = _Display };

  __property LPDIRECTDRAW7        DirectDraw  = { read = fGetDirectDraw  };
  __property LPDIRECTDRAWSURFACE7 FrontBuffer = { read = fGetFrontBuffer };
  __property LPDIRECTDRAWSURFACE7 BackBuffer  = { read = fGetBackBuffer  };

  void __fastcall RefreshDisplay(void);
  void __fastcall UpdateBounds(void) { _Display->UpdateBounds(); } //window size or position changed

  __property void __fastcall (__closure *OnDispFrame)(TCustomDDraw8 *Sender) = { read = lpfnDispFrame, write = lpfnDispFrame };
  __property void __fastcall (__closure *OnRestoreFrame)(TCustomDDraw8 *Sender) = { read = lpfnRestFrame, write = lpfnRestFrame };

protected:
  virtual void __fastcall EvDisplayFrame(void);
  virtual void __fastcall EvRestoreSurfaces(void);

private:
  inline void __fastcall fSetScrWidth(int w)  { _ScrWidth  = w; }
  inline void __fastcall fSetScrHeight(int h) { _ScrHeight = h; }
  inline void __fastcall fSetScrBpp(int b)    { _ScrBpp    = b; }

  inline LPDIRECTDRAW7        __fastcall fGetDirectDraw (void) { return _Display->DirectDraw;  }
  inline LPDIRECTDRAWSURFACE7 __fastcall fGetFrontBuffer(void) { return _Display->FrontBuffer; }
  inline LPDIRECTDRAWSURFACE7 __fastcall fGetBackBuffer (void) { return _Display->BackBuffer;  }

  bool __fastcall fGetActive(void)     { return _Display!=NULL;                    }
  void __fastcall fSetActive(bool b)   { b?fInitDDraw():fUninitDDraw();            }
  void __fastcall fSetWindowed(bool b) { _bWindowedMode=b; if(Active)fInitDDraw(); }
  void __fastcall fInitDDraw(void);
  void __fastcall fUninitDDraw(void);

  TDDrawDisplay *_Display; //must prevent SC_MONITORPOWER in full-screen mode
  int _ScrWidth, _ScrHeight, _ScrBpp;
  TForm *_Form;
  bool _bWindowedMode;

  void __fastcall (__closure *lpfnDispFrame)(TCustomDDraw8 *Sender);
  void __fastcall (__closure *lpfnRestFrame)(TCustomDDraw8 *Sender);
};
//---------------------------------------------------------------------------

class PACKAGE TVictorDDraw8 : public TCustomDDraw8
{
__published:
  __property ScreenWidth;
  __property ScreenHeight;
  __property ScreenBpp;

  __property Windowed;

  __property OnDispFrame;
  __property OnRestoreFrame;

public:
  __fastcall TVictorDDraw8(TComponent* Owner);
};
//---------------------------------------------------------------------------
#endif

⌨️ 快捷键说明

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