📄 myddraw.h
字号:
// MyDDraw.h: interface for the MyDDraw class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_MyDDraw_H__69E3E552_D52A_454E_9302_E9AD19A5A57C__INCLUDED_)
#define AFX_MyDDraw_H__69E3E552_D52A_454E_9302_E9AD19A5A57C__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <ddraw.h>
class MyDDraw
{
HDC hdc,hdc1; // hdc用来存储位图,hdc1代表幕后暂存区的DC
HBITMAP *bitmap;
LPDIRECTDRAW7 pDD7; //声明DirectDraw对象指针
LPDIRECTDRAWSURFACE7 pPSur; //声明主绘图页对象指针
LPDIRECTDRAWSURFACE7 pBBuf; //声明后缓冲区对象指针
LPDIRECTDRAWSURFACE7 *pOPlatemp; //声明暂存区对象指针
HRESULT result; //声明HRESULT类型变量
DDSURFACEDESC2 desc; //声明描述结构体变量
DDSCAPS2 caps; //声明DDSCAPS2结构体变量
DDCOLORKEY key; // 声明颜色键
DWORD fps;
DWORD t;
int i,j;
int px,py;
private:
void DrawStageBmp();
void DrawPauseBmp();
void DrawGameOver();
void DrawMainMenu();
void DrawDoop();
void DrawBomb(POINT start,int n);
void DrawThings(POINT ScreenXY,short kind);
void DrawGress();
POINT HitBomb[11]; //坦克爆炸点
void DrawHitBomb(POINT &p,int n);
void DrawBlood(POINT p,short &blood, short &way);
void DrawPlayerBullet(short way);
void DrawEnemyBullet(short way ,int n);
void DrawPlayer(POINT p ,bool flash);
void DrawWall();
void DrawText(char string[10],POINT p,
COLORREF crTransColor = RGB(255, 0, 255));
RECT Rect(int left,int top,int right,int bottom);
void DrawEnemy(POINT p ,bool flash, int n);
void DrawMap();
void DrawBack();
void BitToHdc();
bool LoadBmp();
void DrawRect(int &n);
void SetColorKey(DDCOLORKEY &ColorKey); //设置颜色键
public:
bool StartDoopTest;
POINT doops[20]; //地雷爆炸点
short PutDoop;
bool setdoop;
bool showdoop;
bool halfsecond;
bool flash; //1/15秒(2帧)
bool OneFps,OneSecond; //1帧、1秒
void Render(); //主绘制场景
bool InitDDraw(HWND ghWnd); //初始化DDRAW7
MyDDraw();
virtual ~MyDDraw();
};
#endif // !defined(AFX_MyDDraw_H__69E3E552_D52A_454E_9302_E9AD19A5A57C__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -