📄 letter.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 + -