bgame.h

来自「用VC++及DirectX实现的SuperMario小游戏」· C头文件 代码 · 共 60 行

H
60
字号
/*
Author: Bear

This source is free to anybody.
If you have any problem with this or some advice to me, please:
    mailto: heyang22118952.student@sina.com
        or  yang45249.student@sina.com
or you can contact me through my QQ:     261570581

Welcome to discuss game programming techniques with me :)
And I like to play games!
*/
#pragma once

#include "BHeader.h"
#include "BBitmap.h"
#include "BDirectDraw.h"
#include "BDirectDrawSurface.h"
#include "BDirectDrawClipper.h"
#include "BDirectDrawPalette.h"
#include "BDirectInput.h"
#include "BWaveFile.h"
#include "BDirectSound.h"
#include "BDirectSoundBuffer.h"
#include "BMidiFile.h"
#include "BDirectMusic.h"
#include "BPolygon.h"
#include "BTimer.h"

class BDLL_API BGame
{
public:
	BGame(void);
	virtual ~BGame(void);
	virtual int Initialize(HINSTANCE hInstance, HWND hwndMain, bool windowMode, int screenWidth, int screenHeight, int screenBpp);
	virtual int ShutDown(void);
	int Run(void);
	void CloseWindow(void);
protected:
	virtual bool ProcessInput(void) = 0;
	virtual bool RunGameLogic(void) = 0;
	virtual bool DrawScreen(void) = 0;
protected:
	HWND m_hwndMain;
	HINSTANCE m_hInstance;
	bool wndClosed;
	//directx variables
	BDirectDraw dd;
	BDirectDrawSurface* pddsPrimary;
	BDirectDrawSurface* pddsBack;
	BDirectDrawPalette* pddp;
	BDirectDrawClipper* pddc;
	BTimer timer;
	BDirectInput di;
	//BDirectSound ds;
	//BDirectSoundBuffer *pdsbSample = NULL;
private:
	bool initialized;
};

⌨️ 快捷键说明

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