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

📄 ball.h

📁 游戏开发中的数学与物理基础一书的随书光盘。很好的说明了物理和数学在游戏开发当中的广泛应用。
💻 H
字号:
// Ball.h //////////////////////////////////////////////////////////////////////// The Ball class contains all of the variables and methods needed to show// a ball on the screen, move it around the screen, and check for a collision// with a wall or another ball.////////////////////////////////////////////////////////////////////////////////#ifndef _BALL_H_#define _BALL_H_#include <windows.h>class Ball{	private:		int diameter;	// The size of the ball		RECT bounds;	// Bounding rectangle for the ball		SIZE vector;	// The direction the ball is traveling	public:		// Constructor for the ball		// Initialize the bounding rectangle and the vector of the ball		Ball();		// Move the ball based on the vector of the ball		void move();		// Draw the ball on the screen		//		// In : hDC - The handle to the device context		void show(HDC hDC);		// Check for a collision with the wall		void checkWallCollision();		// Check for a collision with another ball		//		// In : ball2 - the ball to check collision with		//		// Return : True if there was a collision with another ball		bool checkBallCollision(Ball &ball2);				// The Destructor		virtual ~Ball() {}};#endif

⌨️ 快捷键说明

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