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

📄 perimenu.cpp

📁 游戏是我在3月5日离职后花3周时间做的。主要目的是验证自己在游戏上相关的编程能力
💻 CPP
字号:
#include "perimenu.h"

PeriMenu::PeriMenu()
{

}
PeriMenu::~PeriMenu()
{

}
ID3DXFont *font=NULL;
BOOL PeriMenu::ShowPMenu()
{

	TexSurface.Blt(&BJ,NULL,GESUR_INTERIOR);
font->DrawText(
    Menu1, // String to draw.
    -1, // Null terminating string.
    &rectm1, // Rectangle to draw the string in.
    DT_TOP | DT_LEFT, // Draw in top-left corner of rect.
    D3DCOLOR_XRGB(255,255,255)); // Black.

font->DrawText(
    Menu2, // String to draw.
    -1, // Null terminating string.
    &rectm2, // Rectangle to draw the string in.
    DT_TOP | DT_LEFT, // Draw in top-left corner of rect.
    D3DCOLOR_XRGB(255,255,255)); // Black.


	return TRUE;
}

BOOL PeriMenu::InitPMenu(LPDIRECT3DDEVICE8 &g_pD3DDevice)
{
	rectm1.bottom = 280;
	rectm1.left = 380;
	rectm1.right = 530;
	rectm1.top = 200;

	rectm2.bottom = 400;
	rectm2.left = 380;
	rectm2.right = 530;
	rectm2.top = 340;

	rectsm1.bottom = 400;
	rectsm1.left = 380;
	rectsm1.right = 530;
	rectsm1.top = 340;

	rectip.bottom = 280;
	rectip.left = 180;
	rectip.right = 630;
	rectip.top = 200;

	BJ.bottom = 640;
	BJ.left = 0;
	BJ.right = 800;
	BJ.top = 0;

    LOGFONT lf;
ZeroMemory(&lf, sizeof(LOGFONT));
lf.lfHeight = 21; // in logical units
lf.lfWidth = 13; // in logical units
lf.lfWeight = 500; // boldness, range 0(light) - 1000(bold)
lf.lfItalic = FALSE;
lf.lfUnderline = FALSE;
lf.lfStrikeOut = FALSE;
lf.lfCharSet = DEFAULT_CHARSET;
strcpy(lf.lfFaceName, "Times New Roman"); // font style

D3DXCreateFontIndirect(g_pD3DDevice, &lf, &font);
TexSurface.CreFileToTex(g_pD3DDevice,"background.bmp",
                		0,D3DFMT_A1R5G5B5,GESYSMEM,0xff000000);

	return TRUE;
}

int PeriMenu::PtInRectPMenu(int x, int y)
{
	POINT pt;
	pt.x = x;
	pt.y = y;
    if (PtInRect(&rectm1,pt))
		return 1;
	else if(PtInRect(&rectm2,pt))
		return 2;
	return 0;
}

BOOL PeriMenu::ShowServerPMenu()
{
		TexSurface.Blt(&BJ,NULL,GESUR_INTERIOR);
font->DrawText(
    ServerMenu1, // String to draw.
    -1, // Null terminating string.
    &rectsm1, // Rectangle to draw the string in.
    DT_TOP | DT_LEFT, // Draw in top-left corner of rect.
    0xffff0000); // Black.

font->DrawText(
    ip, // String to draw.
    -1, // Null terminating string.
    &rectip, // Rectangle to draw the string in.
    DT_TOP | DT_LEFT, // Draw in top-left corner of rect.
    0xffff00ff); // Black.
	return TRUE;
}

void PeriMenu::SetIp(TCHAR *IP)
{
	sprintf(ip,"你的主机IP为:%s",IP);
}

⌨️ 快捷键说明

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