bpolygon.h

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

H
49
字号
/*
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 "BDirectDrawSurface.h"


struct Vertex {
	float x,y;
};

class BDLL_API BPolygon
{
public:
	//vertices must be sequenced
	BPolygon(int cx, int cy, int numVerts, Vertex* vList, int color);
	~BPolygon(void);
	bool Draw(BDirectDrawSurface* dest);
	bool Fill(BDirectDrawSurface* dest, int color);
	bool Rotate(int degree);
	bool Move(int dx, int dy);
	bool MoveTo(int x, int y);
	bool Zoom(float scaleX, float scaleY);
	bool HitTest(BPolygon* another);
private:
	int m_color;
	int numVertices;
	Vertex* m_vList;
	Vertex* m_vListCur;
	Vertex* m_vListSorted;
	int m_degree;
	float m_scaleX, m_scaleY;
	int centerX, centerY;
	RECT rcBound;
	void Sort(void);
	void FindBoundRect(void);
};

⌨️ 快捷键说明

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