Jpegs in Directx
You can just use the D3DX functions for loading them - D3DX supports them out-of-the-box. You can also save JPGs using D3DXSaveTextureToFile/D3DXSaveSurfaceToFile.
JPEGs don't contain animations.
You can, however, load a couple of JPEG files into different textures and just display them in order.
You can, however, load a couple of JPEG files into different textures and just display them in order.
Nope. You will have to do that manually, which isn't that hard to do.
You just create your animation as usual and either save the frames to single images (easier to do that first) or assemble them into a single image layout into rows and columns of single frames.
In your game you load this image (or the the single images) along with extra information about time to next frame (or just a single frame-rate).
In your render loop you would then get the time that elapsed since the last frame and add that to an animation timer. If this timer equals or exceeds your animation frame rate you would switch to the next image and reset your animation timer to zero.
The last frame of animation has then to be treated in a special way, e.g. keeping it for one-shot animations or simply setting the animation frame counter back to zero for loops, etc. - you'll figure that out once you get started with it.
You just create your animation as usual and either save the frames to single images (easier to do that first) or assemble them into a single image layout into rows and columns of single frames.
In your game you load this image (or the the single images) along with extra information about time to next frame (or just a single frame-rate).
In your render loop you would then get the time that elapsed since the last frame and add that to an animation timer. If this timer equals or exceeds your animation frame rate you would switch to the next image and reset your animation timer to zero.
The last frame of animation has then to be treated in a special way, e.g. keeping it for one-shot animations or simply setting the animation frame counter back to zero for loops, etc. - you'll figure that out once you get started with it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement