Texture/Image size and Timing.

Monkey Targets Forums/iOS/Texture/Image size and Timing.

Amnesia(Posted 2011) [#1]
I'm having a couple of problems/limitations when building for it. I would like to know if anyone here can shed a bit of light over the exact solutions to these things as I'm a newcomer in the iOS arena.

Since my problems are only two very little things I'm keeping both on the same post. Making two topics would be a waste of forum space.

My first issue relates to restrictions when it comes to textures.
In my tests iOS failed to load a 640x360 image. When resized to 640x320 the picture was read and displayed with no problem at all.
I had no problem loading the original 640x360 file under Android and HTML5 though. It definitely looks like a size restriction thing. Multiple of 32 pixels perhaps?

My second question is about timing. Is there any simple way of getting the time in milliseconds? I prefer to control sprite animations with time intervals rather than relying on frame count. Even Diddy's implementation is useless for that purpose as it has a resolution of 1 second only.

I would greatly appreciate any input on either of those issues. As I said before, I'm a complete noob when it comes to iOS.
Thanks.


NoOdle(Posted 2011) [#2]
The display size of the iphone is 480x320. I have had a 640x480 image loaded and displayed on the iPhone with no problems so I'm not sure why you couldn't see yours... maybe try making the filename all lowercase?

Millisecs() is what you are after I believe :)


Amnesia(Posted 2011) [#3]
About the image it doesn't appear to be a limit issue (e.g: "It can't be larger than X in either width or height"), it's more like a specific condition (e.g: "Both dimensions must be power of 2").

It actually *looks* like it's forcing textures to be a multiple of 32 (in both your image and the one I successfully loaded that condition is met), however, I wanted to see if anyone here knows for sure what the exact requirement is.
I'll try to make more tests on iOS as soon as I have time.

About Millisecs(), thanks. I blindly assumed that such function was not present in the API. When I started browsing the forums I saw a few suggested implementations made by users. Even the Diddy module provides such a function. I just assumed it didn't exist already.

Thanks again. The image-size mystery remains though.


Amnesia(Posted 2011) [#4]
Ok, did a few more tests.

I kept the original size (640x360) but saved the file with the same program I used before for resizing (Seashore) and this time it worked. Perhaps the original image used a enconding or something not supported by iOS.

So, it seems like there's no such a thing as a restriction.

I hope this post remains useful for anyone experiencing problem with loading their images in iOS.

Bottom line: It's probably not a size issue but a format thing. Try saving your PNGs with a different software. In my case I used Seashore and that worked.

Both issues solved now then. :D!