drawboxrect.cpp
来自「国外网游源码....除工具源码缺少之外,其余程序都全...至于,什么游戏,因为国」· C++ 代码 · 共 127 行
CPP
127 行
#include "StdAfx.h"
#include "DrawBoxRect.h"
CMCDrawBox::CMCDrawBox(LPDIRECT3DDEVICE9 pd3dDevice, CDrawEx *pDrawEx)
:m_pDrawEx(pDrawEx)
{
m_pd3dDevice = pd3dDevice;
}
CMCDrawBox::~CMCDrawBox()
{
Release();
}
HRESULT CMCDrawBox::LoadBoxImage(char* FileName, BYTE Type)
{
char m_strTemp[43];
int m_iTempImageCount = 0;
char Expand[4];
int lll = strlen(FileName);
memcpy(Expand, &FileName[lll-3], 4);
if(!strcmp(Expand, "mca"))
{
//=======================================================================
char* m_strCode = "<Mirage Creator's Games><固扼陵农府俊捞磐>";
unsigned int length = 0; //png颇老狼 荤捞令甫 舅扁 困茄 函荐捞促.
char* TotalName = "";
char* TotalSaveName = "";
// PNG 颇老 菊俊 内靛 笼绢持扁 内靛绰 => <Mirage Creator's Games><固扼陵农府俊捞磐> = 42BYTE + Width[4byte] + Height[4byte]
// m_strCode = "<Mirage Creator's Games><固扼陵农府俊捞磐>";
FILE *fp;
fp = fopen(FileName,"rb");
if( fp == NULL )
{
char strMsg[128]={NULL,};
sprintf(&strMsg[0],"[Failed] %s 颇老捞 绝澜",FileName);
OutputDebugString(&strMsg[0]);
return E_FAIL;
}
fread(&m_strTemp, 1, 42, fp);
fread(&m_iTempImageCount, 1, sizeof(int), fp);
if(m_iTempImageCount != Type)
{
MessageBox(g_pApp->GetWindowHandle(),"BoxImage啊 葛磊福促.", "Error", MB_OK);
}
for(int i = 0; i < m_iTempImageCount; i++)
{
int TempDataSize = 0;
fread(&m_BoxImage[i].m_iWidth, 1, sizeof(int), fp);
fread(&m_BoxImage[i].m_iHeight, 1, sizeof(int), fp);
fread(&TempDataSize, 1, sizeof(unsigned int), fp);
BYTE *pData2 = new BYTE[TempDataSize];
fread((BYTE*)pData2, sizeof(BYTE), TempDataSize, fp);
if(FAILED( D3DXCreateTextureFromFileInMemoryEx(m_pd3dDevice,pData2,length-50,
D3DX_DEFAULT,D3DX_DEFAULT,D3DX_DEFAULT,0,
D3DFMT_UNKNOWN,MEMORY_POOL,
D3DX_FILTER_TRIANGLE|D3DX_FILTER_MIRROR,
D3DX_FILTER_TRIANGLE|D3DX_FILTER_MIRROR,D3DCOLOR_ARGB(255,255,0,255),
NULL, NULL, &(m_BoxImage[i].pTex))))
{
OutputDebugString("[角菩] 咆胶贸 肺爹 角菩");
return E_FAIL;
}
delete []pData2;
}
Image_Height = m_BoxImage[0].m_iHeight;
Image_Width = m_BoxImage[0].m_iWidth;
fclose(fp);
//=================================== metaljack 眠啊.
}
else
{
MessageBox(g_pApp->GetWindowHandle()," *.mca 颇老捞 绝促.", "Error", MB_OK);
}
return S_OK;
}
void CMCDrawBox::Release()
{
for(int i = 0 ; i < 9; i++)
{
if(m_BoxImage[i].pTex)
SAFE_RELEASE(m_BoxImage[i].pTex);
}
}
void CMCDrawBox::Draw_Box(int X, int Y, int Width, int Height,int Alpha)
{
m_pDrawEx->DrawSpriteEx( m_BoxImage[0], X, Y, Alpha);
m_pDrawEx->DrawSpriteEx( m_BoxImage[1], X + Image_Width, Y, Alpha, Width - 2*Image_Width);
m_pDrawEx->DrawSpriteEx( m_BoxImage[2], X + Width - Image_Width, Y, Alpha);
m_pDrawEx->DrawSpriteEx( m_BoxImage[3], X + Width - Image_Width, Y + Image_Height, Alpha, Image_Width, Height - 2*Image_Height);
m_pDrawEx->DrawSpriteEx( m_BoxImage[4], X + Width - Image_Width, Y + Height - Image_Height, Alpha);
m_pDrawEx->DrawSpriteEx( m_BoxImage[5], X + Image_Width, Y + Height - Image_Height, Alpha,Width - 2*Image_Width);
m_pDrawEx->DrawSpriteEx( m_BoxImage[6], X, Y + Height - Image_Height, Alpha);
m_pDrawEx->DrawSpriteEx( m_BoxImage[7], X, Y + Image_Height, Alpha, Image_Width, Height - 2*Image_Height);
m_pDrawEx->DrawSpriteEx( m_BoxImage[8], X + Image_Width/2, Y + Image_Height/2, Alpha, Width - Image_Width , Height - Image_Height );
}
void CMCDrawBox::Draw_Box(RECT rt,int Alpha)
{
Draw_Box(rt.left, rt.top, rt.right - rt.left, rt.bottom - rt.top, Alpha);
}
void CMCDrawBox::Draw_Box_Three_Image(int X, int Y, int Width, int Height, int Alpha)
{
m_pDrawEx->DrawSpriteEx( m_BoxImage[0], X, Y, 255);
m_pDrawEx->DrawSpriteEx( m_BoxImage[1], X, Y + m_BoxImage[0].m_iHeight, Alpha, Width, Height-m_BoxImage[0].m_iHeight-m_BoxImage[2].m_iHeight);
m_pDrawEx->DrawSpriteEx( m_BoxImage[2], X, Y + Height - m_BoxImage[2].m_iHeight, 255);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?