LoadImage() vs LoadanimImage()
BlitzPlus Forums/BlitzPlus Programming/LoadImage() vs LoadanimImage()
| ||
@all, Something does not make sense. Why would I use LoadAnimImage() instead of LoadImage() ?? They both return a pointer to the graphics, and since DisplayImage() is used in BOTH cases to show ANY given frame, why is LoadAnimImage() better than simply LoadImage()?? I don't get it, someone please help? |
| ||
They both do essentially the same job, with the exception that you can specify a particular frame to draw with DrawImage if you use LoadAnimImage. As a general rule, use LoadImage for a single image, and use LoadAnimImage for a single image that is made up of multiple frames (like different states of a character running, for example). You would then be able to call DrawImage with a frame of 0, then 1, then 2, then 3 (for a 4-frame image) to simulate your character running. Alternatively, you could use LoadImage 4 times, then call DrawImage 4 times, but LoadAnimImage works better in loops and such (for the programmer). Did I thoroughly confuse you with my dodgy explanation? =) |
| ||
@Soja haha thanks a million for making this CLEAR to an idiot such as myself :-D |
| ||
@Soja Which file types do LoadImage() support? .BMP .PNG ? and what does LoadAnimImage() support?? When I use LoadImage() for a path for a file, it loads fine, when I change the command to LoadAnimImage() (but with same filename and path) I get a FILE NOT FOUND error!! ??? |
| ||
im pretty sure they support all the regular file types (not positive): bmp, png, jpg, gif |
| ||
LoadAnimImage will give errors if you are trying to read past the end of the image ie the number of frames you specified does not fit into the total dimensions of the image. |
| ||
@iumop ap!sdn w,I 'aw d|aH YOU are correct!! Because my filesize in incorrect (does not have 80 frames) and I try to use LoadAnimImage() with a value of 80 frames, the LoadAnimImage() *FAILS* - but it fails saying the file does not EXIST! @BlitzSupport Is this not an error? I mean, the file in question DOES indeed exist, but is of incorrect size according to the frame number. Should LoadAnimImage() not come up with another error message than "File does not exist" ??? such as "Incorrect number of frames specified" ?? |