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 );}
So know that we have the function go to your file that render the menu, on the present
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
Almost ending, just for finish I will put as attachment the FileToByteArray program