CYBERMIX | FORUM

Hello, Guest !

We would like to invite you to join our community.

Register & Login now Smile

( " We are currently recruiting forum staffs " )
CYBERMIX | FORUM

Hello, Guest !

We would like to invite you to join our community.

Register & Login now Smile

( " We are currently recruiting forum staffs " )
. Login Register
CYBERMIX | FORUM

WE POST EVERYTHING YOU NEED


You are not connected. Please login or register

Like this topic? Then share our topic !

URL Direct
BBcode
HTML
How to Draw Sprite Menu

View previous topic View next topic Go down  Message [Page 1 of 1]

Post: #1Wed Feb 11, 2015 11:50 pm

Anonymous

Guest

Guest
1:Include This Code
Code:
[You must be registered and logged in to see this link.] "Sprite.h"
2: Create xdefine.h and paste this
Code:
//[Sprite] :

//Sprites Definitions
//Body
LPDIRECT3DTEXTURE9 txBody;
LPD3DXSPRITE spBody;
//Header
LPDIRECT3DTEXTURE9 txHeader;
LPD3DXSPRITE spHeader;
//Footer
LPDIRECT3DTEXTURE9 txFooter;
LPD3DXSPRITE spFooter;
//Halloween
LPDIRECT3DTEXTURE9 txHalloween; // just do same
LPD3DXSPRITE spHalloween;


/*Sprite Credit Box*/
LPDIRECT3DTEXTURE9 txCredits;
LPD3DXSPRITE spCredits;

//Some Declarations
D3DXVECTOR3 pHeader;
D3DXVECTOR3 pBody;
D3DXVECTOR3 pHalloween;
D3DXVECTOR3 pFooter;
3:Create New Folder Name:xSprites and Paste This
Code:
[You must be registered and logged in to see this link.] _CSPRITES_H
[You must be registered and logged in to see this link.] _CSPRITES_H

BYTE _cHeader[] = { };

BYTE _cBody[] = { };

BYTE _cFooter[] = { };
4:Source to Work:
Code:
void RebuildMenu(LPDIRECT3DDEVICE9 pDevice)

{


pMenu->ecc..


D3DXCreateTextureFromFileInMemoryEx(pDevice
,&_cBody,sizeof(_cBody),337,R3dLine->Mmax * 18,D3DX_DEFAULT,0,D3DFMT_UNKNOWN
,D3DPOOL_MANAGED,D3DX_DEFAULT,D3DX_DEFAULT,0,NULL,NULL,&txBody);
pFooter.x=30.0f; pFooter.y=R3dLine->Mmax * 18 + 119.0; pFooter.z=0.0f;


} // close
5:Under Paste This
Code:
void CreateSprite(LPDIRECT3DDEVICE9 pDevice)
{
pHeader.x=10.0f; pHeader.y=-1.0f; pHeader.z=0.0f;
pBody.x=10.0f; pBody.y=120.0f; pBody.z=0.0f;


if(txBody == NULL)D3DXCreateTextureFromFileInMemoryEx(pDevice
,&_cBody,sizeof(_cBody),337,310,D3DX_DEFAULT,0,D3DFMT_UNKNOWN
,D3DPOOL_MANAGED,D3DX_DEFAULT,D3DX_DEFAULT,0,NULL,NULL,&txBody);
if(spBody == NULL)D3DXCreateSprite(pDevice, &spBody);

if(txFooter == NULL)D3DXCreateTextureFromFileInMemoryEx(pDevice
,&_cFooter,sizeof(_cFooter),/*Size*/315,/*Size*/80,D3DX_DEFAULT,0,D3DFMT_UNKNOWN
,D3DPOOL_MANAGED,D3DX_DEFAULT,D3DX_DEFAULT,0,NULL,NULL,&txFooter);
if(spFooter == NULL)D3DXCreateSprite(pDevice, &spFooter);

if(txHeader == NULL)D3DXCreateTextureFromFileInMemoryEx(pDevice
,&_cHeader,sizeof(_cHeader),353,125,D3DX_DEFAULT,0,D3DFMT_UNKNOWN
,D3DPOOL_MANAGED,D3DX_DEFAULT,D3DX_DEFAULT,0,NULL,NULL,&txHeader);
if(spHeader == NULL)D3DXCreateSprite(pDevice, &spHeader);
}
6: In DrawMenu Paste THis Source:
Code:
spHeader->Begin(D3DXSPRITE_ALPHABLEND);
spHeader->Draw(txHeader, NULL, NULL, &pHeader, 0xFFFFFFFF);
spHeader->End();

spFooter->Begin(D3DXSPRITE_ALPHABLEND);
spFooter->Draw(txFooter, NULL, NULL, &pFooter, 0xFFFFFFFF);
spFooter->End();

spBody->Begin(D3DXSPRITE_ALPHABLEND);
spBody->Draw(txBody, NULL, NULL, &pBody, 0xFFFFFFFF);
spBody->End();
7: Paste This Source in Present
Code:
BOOL Create;

if( !Create )
{
R3dLine->FontCreate(pDevice);
CreateSprite(pDevice);
Create = true;
}
8: Paste This in Reset
Code:
spBody->OnLostDevice();
spBody->OnResetDevice();

spHeader->OnLostDevice();
spHeader->OnResetDevice();

spFooter->OnLostDevice();
spFooter->OnResetDevice();
For Converted image in Byte use File2Array..

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum