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

📄 ellipseshape.cpp

📁 一个漂亮的万花筒游戏
💻 CPP
字号:
// EllipseShape.cpp: implementation of the EllipseShape class.
//
//////////////////////////////////////////////////////////////////////
#include <assert.h>
#include "ezwin.h"
#include "WindowObject.h"
#include "Shape.h"
#include "EllipseShape.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

EllipseShape::EllipseShape(SimpleWindow &Window,
 const Position &Center, const color &c, float w,
 float h) : Shape(Window, Center, c),
 Width(w), Height(h)  {
	// No code needed
}

float EllipseShape::GetWidth() const {
	return Width;
}

float EllipseShape::GetHeight() const {
	return Height;
}

void EllipseShape::GetSize(float &W, float &H) const {
	W = Width;
   H = Height;
   return;
}

void EllipseShape::Draw() {
	const Position Center = GetPosition();
	const float Width = GetWidth();
	const float Height = GetHeight();
	const Position UpperLeft = Center
	 + Position(-(.5f * Width), -(.5f * Height));
	const Position LowerRight = Center
	 + Position(.5f * Width, .5f * Height);
	GetWindow().RenderEllipse(UpperLeft, LowerRight,
	 GetColor(), HasBorder());
   return;
}

void EllipseShape::SetSize(float w, float h) {
	Width = w;
	Height = h;
   return;
}

void EllipseShape::Erase() {
	const Position Center = GetPosition();
	const float Width = GetWidth();
	const float Height = GetHeight();
	const Position UpperLeft = Center
	 + Position(-(.5f * Width), -(.5f * Height));
	const Position LowerRight = Center
	 + Position(.5f * Width, .5f * Height);
	GetWindow().RenderEllipse(UpperLeft, LowerRight,
	 White, HasBorder());
   return;
}

⌨️ 快捷键说明

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