Drawing 2D Sprites in Menu!
Hey guys, In this thread I'll show how to draw sprites using DirectX
It's simple and easy.So lets to the code:
For first create a header file and put the bytes of your image:
Now go on your header file that you put your functions and write this:
So know that we have the function go to your file that render the menu, on the present
When you're showing menu put this:
Almost ending, just for finish I will put as attachment the FileToByteArray program
If you see any erros on post just tell me and I fix :D If you like prass the Thanks button :D
Good Luck :) Oh, almost forgeting
Credits to : Google , MPGH - MultiPlayer Game Hacking - Hacks, Cheats, Trainers, Downloads, Combat Arms Hacks, CrossFire Hacks, Medal of Honor Hacks, Black OPS Hacks, Project Blackout Hacks, WarRock Hacks, Soldier Front Hacks, Sudden Attack Hacks, Operation 7 Hacks, AVA H
Vir scans: VirusTotal - Free Online Virus, Malware and URL Scanner
FileToByteArray.rar - Verificador de malware do Jotti
It's simple and easy.So lets to the code:
For first create a header file and put the bytes of your image:
Code:
BYTE bMyImage[] = { //Bytes here :p };
Code:
//On includes
#include "MyHeader.h"
//Now the texture variable
LPDIRECT3DTEXTURE9 g_pDonutTexture;
void loadTexture( LPDIRECT3DDEVICE9 pDevice )
{
D3DXCreateTextureFromFileInMemoryEx(pDevice, //Our D3D9 DevicebMyImage, //Bytes to writesizeof(bMyImage), //Right size of data writen135, //Width100, //HeightD3DX_DEFAULT,/* number of mip-map levels to create 1 = just original texture */0, //Is used yo the driver know *how the data is intended to be used.*D3DFMT_UNKNOWN,//The format set unknow for dont have trouble with 16-bit/32-bit/64-bitD3DPOOL_MANAGED,// Is used to tell the driver where the data should be be stored.//The MANEGED means that the API will keep a copy of the resource in system memory so it can quicly restore the memory.*D3DX_DEFAULT, //If the primitive has a texture, Direct3D must use that texture to produce a color for each pixel in the primitive's 2D rendered image.*D3DX_DEFAULT, //Set the Direct3D minification mipmap filter.*0, //The color (ALPHA,RED,GREEN,BLUE) Leave zero for our texture nice color!NULL,//No infoNULL, //The color pallet :X*&g_pDonutTexture //Our texture :o ?);//Texture filtering-* * pDevice->SetSamplerState(0, D3DSAMP_MINFILTER, *D3DTEXF_ANISOTROPIC); pDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_ANISOTROPIC); pDevice->SetSamplerState( 0, D3DSAMP_MIPFILTER, *D3DTEXF_ANISOTROPIC );}
When you're showing menu put this:
Code:
//At Globals variables LPD3DXSPRITE g_pDonutSprite; D3DXVECTOR3 SpritePos; //On Present loadTexture(pDevice); //Load our function SpritePos.x = 100.0f; //X Position on screen SpritePos.y = 50.0f; //Y Position on screen SpritePos.z = 0.0f; //The Z Pos Leave zero its 2D D3DXCreateSprite( pDevice, &g_pDonutSprite ); //Create our sprite g_pDonutSprite->Begin( D3DXSPRITE_ALPHABLEND ); //Enables alpha-blending g_pDonutSprite->Draw ( g_pDonutTexture, //The texture for sprites 0, //Not using rect 0, //Blah &SpritePos,//Sprite pos D3DCOLOR_COLORVALUE(1.0f,1.0f,1.0f,1.0f) //Leave like this for dont loose colors of texture ); g_pDonutSprite->End(); //Our end too :D
If you see any erros on post just tell me and I fix :D If you like prass the Thanks button :D
Good Luck :) Oh, almost forgeting
Credits to : Google , MPGH - MultiPlayer Game Hacking - Hacks, Cheats, Trainers, Downloads, Combat Arms Hacks, CrossFire Hacks, Medal of Honor Hacks, Black OPS Hacks, Project Blackout Hacks, WarRock Hacks, Soldier Front Hacks, Sudden Attack Hacks, Operation 7 Hacks, AVA H
Vir scans: VirusTotal - Free Online Virus, Malware and URL Scanner
FileToByteArray.rar - Verificador de malware do Jotti

And I'm thinking "hoho Hassan approved it fast
, but no comments D:"