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

📄 tennisfield.h

📁 C人工智能游戏开发的一些实例源代码 C Game development in artificial intelligence source code of some examples
💻 H
字号:
//----------------------------------------------------------------------------------------------
// Sequential Prediction Demo: The positioning pattern
// 
// Author:  Fri Mommersteeg
// Date:    10-09-2001
// File:    TennisField.h
//----------------------------------------------------------------------------------------------

#ifndef __TENNISFIELD_H
#define __TENNISFIELD_H

//----------------------------------------------------------------------------------------------
// Include files
//----------------------------------------------------------------------------------------------

#include "paddle.h"
#include "ball.h"
#include "observer.h"

//----------------------------------------------------------------------------------------------
// Defined constants
//----------------------------------------------------------------------------------------------

#define PLAYER1    0
#define PLAYER2    1
#define NET_WIDTH  5
#define NET_HEIGHT 0 // disable net

//----------------------------------------------------------------------------------------------
// CTennisField: Manages the game objects
//----------------------------------------------------------------------------------------------

class CTennisField : public CObserver {

public:

	void			SetupField(LPRECT pField, CPaddle * Player1, CPaddle * Player2, CTennisBall * Ball);
	void			Update();
	BOOL			Notify(int msg, DWORD param);
	void			SetupService(int ServicePlayer);
	void			NetCollision();
	void			Start() { StartTime = timeGetTime()-1000; nFrameCount = DEFAULT_SPEED; }

protected:
	BOOL			BallInField(int index, POINT pt);
	void			PlayerScores(int index);
	void			ShowPlayerScore(HDC dc, int x, int y, int PlayerId);
	void			ShowFPS(HDC dc, int x, int y);

protected:

	HWND			hWnd;
	RECT			field;
	CPaddle *		player[2];	
	CTennisBall *	ball;
	DWORD			StartTime;
	DWORD			nFrameCount;
};

//----------------------------------------------------------------------------------------------
#endif // __TENNISFIELD_H

⌨️ 快捷键说明

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