0

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

Edited by vedel.bajic

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by BigInNYC
0

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

Edited by BigInNYC: Gramatical Errors

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.