Can any one help me find the problem why my sprite texture does not resize with the window when I resize the window the sprite texture size or scale does not change according to the window size
directx does not scale sprites to the window size for you. if your window size changes, you must draw at new positions and scales to compensate.
getting your sprites to scale automatically with the window size is called "resolution independent graphics".
to do resolution independent graphics, you use a virtual coordinate system, such as 10,000x10,000, and make all your draw calls using those. then inside your drawing routines, you convert those to screen coordinates based on the current size of the window:
screen_x= (screen_width-1) * virtual_x / 9999 // i think i got that right.... <g>
screen_y= (screen_height-1) * virtual_y / 9999
so you say something like drawsprite(sprite_num,5000,5000,6000,6000) and it always draws the sprite with the upper left corner in the middle of the window, and the size of the sprite is always 1/10 the width and 1/10th the height of the window. 5000 to 6000 is 1000 virtual pixels, and 1000 is 1/10th of 10,000, the virtual width of the window.
"DirectX is like a belt fed machine gun, where every texture change is like hand loading in a new belt of ammo. worse, every mesh (vb) is a new belt of ammo, and a texture is like breaking the gun down, and setting it up again elsewhere, then loading it, then spraying triangles again. so you want to setup the gun once, string all your belts together, load it once, then just spray."
Rockland Software Productions
"Building PC games since 1988"
Sign up for the Caveman beta!