Hey Guys!
I wonder how to put a texture on a specific position in DirectX.
for example: I want a function that allows to set a Texture on an 2D Position and set the width and height like this pseudo funktion:

                     x   y   w    h
DrawTexture(pDevice, 25, 25, 200, 100); 

Well, some Code:

LPDIRECT3DTEXTURE9 texture = NULL;

DWORD color = D3DCOLOR_XRGB(16, 16, 16);

const BYTE Image[64] = {color,color,color,color,color,color,color,color,
                        color,color,color,color,color,color,color,color,
                        color,color,color,color,color,color,color,color,
                        color,color,color,color,color,color,color,color,
                        color,color,color,color,color,color,color,color,
                        color,color,color,color,color,color,color,color,
                        color,color,color,color,color,color,color,color,
                        color,color,color,color,color,color,color,color};

void DrawTexture(LPDIRECT3DDEVICE9 pDevice, int x, int y, int w, int h){
    D3DXCreateTextureFromFileInMemory(pDevice, &Image[64], sizeof(Image), &texture);

    //Some Magic :(

    pDevice->SetTexture(0, texture);
}

does someone has an idea?

Yours vedel

That's a good one. I'm looking it up for you. Because the DrawTexture variable can sometimes cause some weird effects if your not careful. Here is a tutorial that I found useful and I hope that you can find some use in it as well. I don't know at what level of computing expertise you are but I hope you can find some information that is useful. http://www.drunkenhyena.com/cgi-bin/view_cpp_article.pl?chapter=2;article=30

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.