/* 点击玩家枚举 */
typedef enum _ClickPlayer {
ClickPlayer_Player1 = 0x00000001, // 玩家1
ClickPlayer_Player2 = 0x00000002 // 玩家2
}ClickPlayer;
/* 游戏结局 */
typedef enum _GameOverType {
GameOverType_Tie = 0x00000001, // 平局
GameOverType_Player1 = 0x00000002, // 玩家1
GameOverType_Player2 = 0x00000004 // 玩家2
}GameOverType;
VOID TicTacToe_Init(HWND hWnd)
{
/* 游戏初始化 */
g_game.Init(hWnd);
/* 创建兼容DC和兼容位图 */
Util::CreateDoubleBuffer(hWnd, g_mdc, g_bitmap);
::SelectObject(g_mdc, g_bitmap);
}
void Game::Init(HWND hWnd)
{
/* 游戏初始化 */
m_bIsGameOver = false;
m_hWnd = hWnd;
/* 初始化棋盘 */
m_board.Init(hWnd);
}
void Board::Init(HWND hWnd)
{
/* 设定玩家1为开始玩家*/
m_cur_click = ClickPlayer::ClickPlayer_Player1;
::GetClientRect(hWnd, &m_rect);
/* 初始化九个格子 m_ppPreces不为NULL则为上局棋子 */
if (m_ppPreces != NULL) {
delete m_ppPreces;
m_ppPreces = NULL;
}
m_ppPreces = new Prece*[9];
/* 两边余量 */
int x_margin = 20;
int y_margin = 20;
/* 设定棋盘矩形大小 */
m_rect.left += x_margin;
m_rect.top += y_margin;
m_rect.right -= x_margin;
m_rect.bottom -= y_margin;
/* 棋盘宽高 */
int width = m_rect.right - m_rect.left;
int height = m_rect.bottom - m_rect.top;
/* 棋盘左上角(x, y) 以及棋子的宽和高 */
int x_start = m_rect.left;
int y_start = m_rect.top;
int w_distance = width / 3;
int h_distance = height / 3;
for (int c = 0, col = 3; c < col; ++c)
{
for (int r = 0, row = 3; r < row; ++r)
{
/* 创建棋盘格子,并保存到棋盘中 */
m_ppPreces[c * 3 + r] = new Prece(x_start + (r * w_distance), y_start + (c * h_distance), w_distance, h_distance, c * 3 + r);
}
}
}
/* 设定玩家1为开始玩家 */
m_cur_click = ClickPlayer::ClickPlayer_Player1;
/* 初始化九个格子 m_ppPreces不为NULL则为上局棋子 */
if (m_ppPreces != NULL) {
delete m_ppPreces;
m_ppPreces = NULL;
}
m_ppPreces = new Prece*[9];
/* 两边余量 */
int x_margin = 20;
int y_margin = 20;
/* 设定棋盘矩形大小 */
m_rect.left += x_margin;
m_rect.top += y_margin;
m_rect.right -= x_margin;
m_rect.bottom -= y_margin;
/* 棋盘宽高 */
int width = m_rect.right - m_rect.left;
int height = m_rect.bottom - m_rect.top;
/* 棋盘左上角(x, y) 以及棋子的宽和高 */
int x_start = m_rect.left;
int y_start = m_rect.top;
int w_distance = width / 3;
int h_distance = height / 3;
for (int c = 0, col = 3; c < col; ++c)
{
for (int r = 0, row = 3; r < row; ++r)
{
/* 创建棋盘格子,并保存到棋盘中 */
m_ppPreces[c * 3 + r] = new Prece(x_start + (r * w_distance), y_start + (c * h_distance), w_distance, h_distance, c * 3 + r);
}
}
new Prece(x_start + (r * w_distance), y_start + (c * h_distance), w_distance, h_distance, c * 3 + r)
Prece::Prece(int x, int y, int w, int h, int index)
{
/* 格子初始化 */
m_x = x;
m_y = y;
m_w = w;
m_h = h;
m_index = index;
m_bIsClick = false;
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
······
case WM_LBUTTONDOWN:
/* 井字游戏鼠标点击消息处理 */
TicTacToe_MouseDown(LOWORD(lParam), HIWORD(lParam));
break;
······
}
return ((LRESULT)0);
}
VOID TicTacToe_MouseDown(int x, int y)
{
/* 游戏鼠标处理 */
g_game.MouseDown(x, y);
}
void Game::MouseDown(int x, int y)
{
if (m_bIsGameOver)
{
/* 如果游戏结束,点击重新开始 */
Init(m_hWnd);
return;
}
/* 游戏鼠标点击消息处理 */
m_board.MouseDown(x, y);
/* 检测是否游戏结束 */
CheckGameOver();
}
if (m_bIsGameOver)
{
/* 如果游戏结束,点击重新开始 */
Init(m_hWnd);
return;
}
/* 游戏鼠标点击消息处理 */
m_board.MouseDown(x, y);
/* 检测是否游戏结束 */
CheckGameOver();
void Board::MouseDown(int x, int y)
{
/* 检测是否点击到格子 */
for (int i = 0, count = 9; i < 9; ++i)
{
if (m_ppPreces[i]->CheckClick(x, y))
{
/* 设定棋子被当前落棋玩家点击 */
m_ppPreces[i]->Click(m_cur_click);
/* 点击到格子,则切换玩家下棋 */
m_cur_click = (m_cur_click == ClickPlayer::ClickPlayer_Player1 ?
ClickPlayer::ClickPlayer_Player2 :
ClickPlayer::ClickPlayer_Player1);
}
}
}
if (m_ppPreces[i]->CheckClick(x, y))
/* 设定棋子被当前落棋玩家点击 */
m_ppPreces[i]->Click(m_cur_click);
/* 点击到格子,则切换玩家下棋 */
m_cur_click = (m_cur_click == ClickPlayer::ClickPlayer_Player1 ?
ClickPlayer::ClickPlayer_Player2 :
ClickPlayer::ClickPlayer_Player1);
bool Prece::CheckClick(int x, int y)
{
/* 判断鼠标点击的位置是否在格子内 */
return (!m_bIsClick) && (x <= m_x + m_w && y <= m_y + m_h && x >= m_x && y >= m_y);
}
void Prece::Click(ClickPlayer sender)
{
/* 格子被点击 */
m_bIsClick = true;
/* 设定点击玩家 */
m_click_player = sender;
}
VOID TicTacToe_Render(HWND hWnd)
{
if (g_mdc == NULL)
return;
HDC hdc = ::GetDC(hWnd);
RECT clientRect;
::GetClientRect(hWnd, &clientRect);
int width = clientRect.right - clientRect.left;
int height = clientRect.bottom - clientRect.top;
/* 游戏绘制 */
g_game.Render(g_mdc);
/* 将兼容DC绘制到设备DC中 */
::BitBlt(hdc, 0, 0, width, height, g_mdc, 0, 0, SRCCOPY);
::ReleaseDC(hWnd, hdc);
}
/* 游戏绘制 */
g_game.Render(g_mdc);
void Game::Render(HDC hdc)
{
/* 绘制游戏背景 */
DrawBackground(hdc);
/* 绘制棋盘 */
m_board.Render(hdc);
/* 绘制游戏结束 */
DrawGameOver(hdc);
}
void Game::DrawBackground(HDC hdc)
{
/* 创建背景颜色画刷 */
HBRUSH brush = ::CreateSolidBrush(RGB(22, 22, 22));
RECT rect;
::GetClientRect(m_hWnd, &rect);
/* 填充背景颜色 */
::FillRect(hdc, &rect, brush);
::DeleteObject(brush); brush = NULL;
}
void Game::DrawGameOver(HDC hdc)
{
/* 绘制游戏结束信息 */
if (m_bIsGameOver)
{
LPCWSTR lpszTitle = _T("游戏结束");
LPCWSTR lpszBody = NULL;
LPCWSTR lpszTips = _T("点击屏幕重新开始游戏");
/* 设置显示消息 */
if (m_over_type == GameOverType::GameOverType_Tie)
lpszBody = _T(" 平局");
else if (m_over_type == GameOverType::GameOverType_Player1)
lpszBody = _T("玩家1获胜");
else
lpszBody = _T("玩家2获胜");
// 设置绘制的文字字体
HFONT hFont, hOldFont;
Util::CreateLogFont(hFont, 45);
hOldFont = (HFONT)SelectObject(hdc, hFont);
/* 文字背景为透明 */
::SetBkMode(hdc, TRANSPARENT);
/* 绘制标题 */
::SetTextColor(hdc, RGB(197, 31, 31));
::TextOut(hdc, 150, 100, lpszTitle, lstrlen(lpszTitle));
/* 绘制信息 */
::SetTextColor(hdc, RGB(87, 105, 60));
::TextOut(hdc, 150, 225, lpszBody, lstrlen(lpszBody));
/* 绘制提示消息 */
::SetTextColor(hdc, RGB(91, 74, 66));
::TextOut(hdc, 0, 350, lpszTips, lstrlen(lpszTips));
::SelectObject(hdc, hOldFont);
::DeleteObject(hFont); hFont = NULL;
}
}
if (m_bIsGameOver)
LPCWSTR lpszTitle = _T("游戏结束");
LPCWSTR lpszBody = NULL;
LPCWSTR lpszTips = _T("点击屏幕重新开始游戏");
/* 设置显示消息 */
if (m_over_type == GameOverType::GameOverType_Tie)
lpszBody = _T(" 平局");
else if (m_over_type == GameOverType::GameOverType_Player1)
lpszBody = _T("玩家1获胜");
else
lpszBody = _T("玩家2获胜");
// 设置绘制的文字字体
HFONT hFont, hOldFont;
Util::CreateLogFont(hFont, 45);
hOldFont = (HFONT)SelectObject(hdc, hFont);
/* 文字背景为透明 */
::SetBkMode(hdc, TRANSPARENT);
/* 绘制标题 */
::SetTextColor(hdc, RGB(197, 31, 31));
::TextOut(hdc, 150, 100, lpszTitle, lstrlen(lpszTitle));
/* 绘制信息 */
::SetTextColor(hdc, RGB(87, 105, 60));
::TextOut(hdc, 150, 225, lpszBody, lstrlen(lpszBody));
/* 绘制提示消息 */
::SetTextColor(hdc, RGB(91, 74, 66));
::TextOut(hdc, 0, 350, lpszTips, lstrlen(lpszTips));
::SelectObject(hdc, hOldFont);
::DeleteObject(hFont); hFont = NULL;
void Board::Render(HDC hdc)
{
/* 绘制"井" */
DrawBoard(hdc);
/* 绘制棋子 */
for (int i = 0, count = 9; i < 9; ++i)
{
m_ppPreces[i]->Render(hdc);
}
}
void Board::DrawBoard(HDC hdc)
{
/* 创建画笔 */
HPEN hPen = ::CreatePen(PS_SOLID, 3, RGB(0, 0, 0));
HPEN hOldPen = (HPEN)::SelectObject(hdc, hPen);
/* 棋盘宽高 */
int width = m_rect.right - m_rect.left;
int height = m_rect.bottom - m_rect.top;
int x_left_top = m_rect.left;
int y_left_top = m_rect.top;
int w_distance = width / 3;
int h_distance = height / 3;
/* "井"四标边 */
int points[4][4];
/* 竖线第一条 */
points[0][0] = x_left_top + w_distance;
points[0][1] = y_left_top;
points[0][2] = x_left_top + w_distance;
points[0][3] = y_left_top + height;
/* 竖线第二条 */
points[1][0] = x_left_top + 2 * w_distance;
points[1][1] = y_left_top;
points[1][2] = x_left_top + 2 * w_distance;
points[1][3] = y_left_top + height;
/* 横线第一条 */
points[2][0] = x_left_top;
points[2][1] = y_left_top + h_distance;
points[2][2] = x_left_top + width;
points[2][3] = y_left_top + h_distance;
/* 横线第二条 */
points[3][0] = x_left_top;
points[3][1] = y_left_top + 2 * h_distance;
points[3][2] = x_left_top + width;
points[3][3] = y_left_top + 2 * h_distance;
Util::DrawLine(hdc, points[0]);
Util::DrawLine(hdc, points[1]);
Util::DrawLine(hdc, points[2]);
Util::DrawLine(hdc, points[3]);
::SelectObject(hdc, hOldPen);
::DeleteObject(hPen); hPen = NULL;
}
/* 创建画笔 */
HPEN hPen = ::CreatePen(PS_SOLID, 3, RGB(0, 0, 0));
HPEN hOldPen = (HPEN)::SelectObject(hdc, hPen);
/* 棋盘宽高 */
int width = m_rect.right - m_rect.left;
int height = m_rect.bottom - m_rect.top;
int x_left_top = m_rect.left;
int y_left_top = m_rect.top;
int w_distance = width / 3;
int h_distance = height / 3;
/* "井"四标边 */
int points[4][4];
/* 竖线第一条 */
points[0][0] = x_left_top + w_distance;
points[0][1] = y_left_top;
points[0][2] = x_left_top + w_distance;
points[0][3] = y_left_top + height;
/* 竖线第二条 */
points[1][0] = x_left_top + 2 * w_distance;
points[1][1] = y_left_top;
points[1][2] = x_left_top + 2 * w_distance;
points[1][3] = y_left_top + height;
/* 横线第一条 */
points[2][0] = x_left_top;
points[2][1] = y_left_top + h_distance;
points[2][2] = x_left_top + width;
points[2][3] = y_left_top + h_distance;
/* 横线第二条 */
points[3][0] = x_left_top;
points[3][1] = y_left_top + 2 * h_distance;
points[3][2] = x_left_top + width;
points[3][3] = y_left_top + 2 * h_distance;
Util::DrawLine(hdc, points[0]);
Util::DrawLine(hdc, points[1]);
Util::DrawLine(hdc, points[2]);
Util::DrawLine(hdc, points[3]);
::SelectObject(hdc, hOldPen);
::DeleteObject(hPen); hPen = NULL;
void Prece::Render(HDC hdc)
{
/* 绘制标记 */
DrawGraphics(hdc);
}
void Prece::DrawGraphics(HDC hdc)
{
/* 判断棋子是否被玩家点击 */
if (!m_bIsClick)
return;
if (m_click_player == ClickPlayer::ClickPlayer_Player1)
{
/* 绘制玩家1图形 */
DrawPlayer1Graphics(hdc);
}
else
{
/* 绘制玩家2图形 */
DrawPlayer2Graphics(hdc);
}
}
/* 判断棋子是否被玩家点击 */
if (!m_bIsClick)
return;
if (m_click_player == ClickPlayer::ClickPlayer_Player1)
{
/* 绘制玩家1图形 */
DrawPlayer1Graphics(hdc);
}
else
{
/* 绘制玩家2图形 */
DrawPlayer2Graphics(hdc);
}
void Prece::DrawPlayer1Graphics(HDC hdc)
{
// 棋子中心点坐标
int x_center = m_x + (m_w / 2);
int y_center = m_y + (m_h / 2);
/* 绘制 "×" */
double len = m_w / 3.0;
float angles[] = {
45, 135, 225, 315
};
int points[2][4];
float rad = 3.1415926f / 180.0f;
/* 第一条 */
int x_lt = (int)(x_center + len * cos(angles[0] * rad));
int y_lt = (int)(y_center + len * sin(angles[0] * rad));
int x_rd = (int)(x_center + len * cos(angles[2] * rad));
int y_rd = (int)(y_center + len * sin(angles[2] * rad));
/* 第二条 */
int x_rt = (int)(x_center + len * cos(angles[1] * rad));
int y_rt = (int)(y_center + len * sin(angles[1] * rad));
int x_ld = (int)(x_center + len * cos(angles[3] * rad));
int y_ld = (int)(y_center + len * sin(angles[3] * rad));
points[0][0] = x_lt;
points[0][1] = y_lt;
points[0][2] = x_rd;
points[0][3] = y_rd;
points[1][0] = x_rt;
points[1][1] = y_rt;
points[1][2] = x_ld;
points[1][3] = y_ld;
HPEN hPen = ::CreatePen(PS_SOLID, 3, RGB(153, 77, 82));
HPEN hOldPen = (HPEN)::SelectObject(hdc, hPen);
/* 绘制 */
Util::DrawLine(hdc, points[0]);
Util::DrawLine(hdc, points[1]);
::SelectObject(hdc, hOldPen);
::DeleteObject(hPen); hPen = NULL;
}
// 棋子中心点坐标
int x_center = m_x + (m_w / 2);
int y_center = m_y + (m_h / 2);
double len = m_w / 3.0;
float angles[] = {
45, 135, 225, 315
};
int points[2][4];
float rad = 3.1415926f / 180.0f;
/* 第一条 */
int x_lt = (int)(x_center + len * cos(angles[0] * rad));
int y_lt = (int)(y_center + len * sin(angles[0] * rad));
int x_rd = (int)(x_center + len * cos(angles[2] * rad));
int y_rd = (int)(y_center + len * sin(angles[2] * rad));
/* 第二条 */
int x_rt = (int)(x_center + len * cos(angles[1] * rad));
int y_rt = (int)(y_center + len * sin(angles[1] * rad));
int x_ld = (int)(x_center + len * cos(angles[3] * rad));
int y_ld = (int)(y_center + len * sin(angles[3] * rad));
points[0][0] = x_lt;
points[0][1] = y_lt;
points[0][2] = x_rd;
points[0][3] = y_rd;
points[1][0] = x_rt;
points[1][1] = y_rt;
points[1][2] = x_ld;
points[1][3] = y_ld;
HPEN hPen = ::CreatePen(PS_SOLID, 3, RGB(153, 77, 82));
HPEN hOldPen = (HPEN)::SelectObject(hdc, hPen);
/* 绘制 */
Util::DrawLine(hdc, points[0]);
Util::DrawLine(hdc, points[1]);
::SelectObject(hdc, hOldPen);
::DeleteObject(hPen); hPen = NULL;
void Prece::DrawPlayer2Graphics(HDC hdc)
{
/* 棋子中心点坐标 */
int x_center = m_x + (m_w / 2);
int y_center = m_y + (m_h / 2);
/* "○"半径 */
int r = m_w / 3;
/* 绘制 "○" */
HPEN hPen = ::CreatePen(PS_SOLID, 3, RGB(64, 116, 52));
HPEN hOldPen = (HPEN)::SelectObject(hdc, hPen);
HBRUSH hBrush = (HBRUSH)::GetStockObject(NULL_BRUSH);
HBRUSH bOldBrush = (HBRUSH)::SelectObject(hdc, hBrush);
::Ellipse(hdc, x_center - r, y_center - r, x_center + r, y_center + r);
::SelectObject(hdc, bOldBrush);
::SelectObject(hdc, hOldPen);
::DeleteObject(hBrush); hBrush = NULL;
::DeleteObject(hPen); hPen = NULL;
}
/* 棋子中心点坐标 */
int x_center = m_x + (m_w / 2);
int y_center = m_y + (m_h / 2);
/* "○"半径 */
int r = m_w / 3;
HPEN hPen = ::CreatePen(PS_SOLID, 3, RGB(64, 116, 52));
HPEN hOldPen = (HPEN)::SelectObject(hdc, hPen);
HBRUSH hBrush = (HBRUSH)::GetStockObject(NULL_BRUSH);
HBRUSH bOldBrush = (HBRUSH)::SelectObject(hdc, hBrush);
::Ellipse(hdc, x_center - r, y_center - r, x_center + r, y_center + r);
::SelectObject(hdc, bOldBrush);
::SelectObject(hdc, hOldPen);
::DeleteObject(hBrush); hBrush = NULL;
::DeleteObject(hPen); hPen = NULL;
void Game::CheckGameOver()
{
/* 获取棋盘格子 */
Prece** ppPreces = m_board.GetPreces();
/* 获取玩家点击了的格子 */
int p1[9];
int p2[9];
memset((void*)p1, -1, sizeof(p1));
memset((void*)p2, -1, sizeof(p2));
int index1 = 0;
int index2 = 0;
for (int i = 0, count = 9; i < count; ++i)
{
if (ppPreces[i] != NULL && ppPreces[i]->IsClick())
{
ppPreces[i]->GetClickPlayer() == ClickPlayer::ClickPlayer_Player1 ?
p1[index1++] = ppPreces[i]->GetIndex() :
p2[index2++] = ppPreces[i]->GetIndex();
}
}
/* 不足3个取消比较 */
if (index1 < 3 && index2 < 3)
return;
/* 8种获胜结果集合 */
int win_set[8][3] = {
{0, 1, 2},
{3, 4, 5},
{6, 7, 8},
{0, 3, 6},
{1, 4, 7},
{2, 5, 8},
{0, 4, 8},
{2, 4, 6}
};
/* 进行比较 */
int nP1Match = 0;
int nP2Match = 0;
for (int i = 0; i < 8; ++i)
{
nP1Match = 0;
nP2Match = 0;
for (int j = 0; j < 3; ++j)
{
for (int k = 0; k < index1; ++k)
{
if (p1[k] == win_set[i][j])
++nP1Match;
else if (p2[k] == win_set[i][j])
++nP2Match;
if (nP1Match == 3)
{
m_over_type = GameOverType::GameOverType_Player1;
m_bIsGameOver = true;
return;
}
else if (nP2Match == 3)
{
m_over_type = GameOverType::GameOverType_Player2;
m_bIsGameOver = true;
return;
}
}
}
}
/* 9个为平局 */
if (index1 + index2 >= 9)
{
m_over_type = GameOverType::GameOverType_Tie;
m_bIsGameOver = true;
}
}
/* 获取棋盘格子 */
Prece** ppPreces = m_board.GetPreces();
/* 获取玩家点击了的格子 */
int p1[9];
int p2[9];
memset((void*)p1, -1, sizeof(p1));
memset((void*)p2, -1, sizeof(p2));
int index1 = 0;
int index2 = 0;
for (int i = 0, count = 9; i < count; ++i)
{
if (ppPreces[i] != NULL && ppPreces[i]->IsClick())
{
ppPreces[i]->GetClickPlayer() == ClickPlayer::ClickPlayer_Player1 ?
p1[index1++] = ppPreces[i]->GetIndex() :
p2[index2++] = ppPreces[i]->GetIndex();
}
}
/* 不足3个取消比较 */
if (index1 < 3 && index2 < 3)
return;
/* 8种获胜结果集合 */
int win_set[8][3] = {
{0, 1, 2},
{3, 4, 5},
{6, 7, 8},
{0, 3, 6},
{1, 4, 7},
{2, 5, 8},
{0, 4, 8},
{2, 4, 6}
};
int nP1Match = 0;
int nP2Match = 0;
for (int i = 0; i < 8; ++i)
{
nP1Match = 0;
nP2Match = 0;
for (int j = 0; j < 3; ++j)
{
for (int k = 0; k < index1; ++k)
{
......
}
}
}
if (p1[k] == win_set[i][j])
++nP1Match;
else if (p2[k] == win_set[i][j])
++nP2Match;
if (nP1Match == 3)
{
m_over_type = GameOverType::GameOverType_Player1;
m_bIsGameOver = true;
return;
}
else if (nP2Match == 3)
{
m_over_type = GameOverType::GameOverType_Player2;
m_bIsGameOver = true;
return;
}
/* 9个为平局 */
if (index1 + index2 >= 9)
{
m_over_type = GameOverType::GameOverType_Tie;
m_bIsGameOver = true;
}
static void DrawLine(HDC, int[4]); // 绘制一条直线
static void CreateDoubleBuffer(HWND, HDC &, HBITMAP &); // 创建创缓冲
static void CreateLogFont(HFONT &, int); // 创建逻辑字体
void Util::DrawLine(HDC hdc, int points[4])
{
/* *
* int[4] 表示两个点的 (x, y)
* 第一个点为 (points[0], points[1])
* 第二个点为 (points[2], points[3])
* */
::MoveToEx(hdc, points[0], points[1], NULL);
::LineTo(hdc, points[2], points[3]);
}
void Util::CreateDoubleBuffer(HWND hWnd, HDC &mdc, HBITMAP &bitmap)
{
/* *
* 创建双缓冲
* 也就是: 兼容DC和兼容位图
* */
HDC hdc = ::GetDC(hWnd);
RECT clientRect;
::GetClientRect(hWnd, &clientRect);
mdc = ::CreateCompatibleDC(hdc);
bitmap = ::CreateCompatibleBitmap(hdc, clientRect.right - clientRect.left, clientRect.bottom - clientRect.top);
::ReleaseDC(hWnd, hdc);
}
void Util::CreateLogFont(HFONT &hFont, int nFontHeight)
{
/* *
* 创建逻辑字体
* */
LOGFONT logfont;
ZeroMemory(&logfont, sizeof(LOGFONT));
logfont.lfCharSet = GB2312_CHARSET;
logfont.lfHeight = nFontHeight;
hFont = ::CreateFontIndirect(&logfont);
}