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

📄 letter.cs

📁 Beginning C# Game Programming 的源代码
💻 CS
字号:
namespace SpaceWar {
	using System;
	using System.Drawing;
	using System.Collections;
	using Microsoft.DirectX;
	using Microsoft.DirectX.DirectDraw;

	public enum LetterState {
		Bouncing,
		Normal,
		Exploding,
		Dead,
	}

	/// <summary>
	///    Summary description for Letter.
	/// </summary>
	public class Letter {
		char letter;
		LetterVector[] vectors;
		Point lastLocation;

		public Letter(char letter) {
			this.letter = letter;
		}

		public void SetLetter(float scale) {
			vectors = FontDraw.GetLetter(letter, scale);
		}

		public void Draw(Surface surface, int color, Point location) {
			if (vectors == null)
				return; 

			if (location != lastLocation) {
				foreach (LetterVector vector in vectors) {
					vector.Offset = location;
				}
				lastLocation = location;
			}

			surface.ForeColor = Color.FromArgb(color);
			foreach (LetterVector vector in vectors) {
				vector.Draw(surface);
			}
		}
	}
}

⌨️ 快捷键说明

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