Frames from imagesheet and fonts don't render

Well, this is weird, since I’ve already testes this project once on an iphone, and it worked, so something strange is going on…

To make a long story short, I’m working on a game platform for iphone4/4s/5 and android, and I’m using an imagesheet for my interface, keeping all parts of the interface in it (buttons, titles, avatars, logos).

When I work on my PC, everything works just fine, the fonts render like I want them, my graphic work, when I export it to my android, no problems there, it works find.

When I copy my work to my MAC, and run the simulator, the fonts render strangly, and part of the interface do not render all, when I built the project and install it on my iphone 4s, the fonts don’t render at all, and parts of the interface don’t show up.

I’ve kept my imagesheet size to 2048x2048, to be sure it will work on all my intended devices, but something is clearly not working here.

When I run the project in the simulator, it does not give me any error messages, when I compile the project on my MAC, I get a lot of error messages, all of them related to the fonts, where it can’t index the event in all my functions that control any text input, but it still compile the file to be used, but like I said, the fonts (and not just for input, but any dynamic font I use, and I do use a custom font that has been tested) and parts of the interface do not render.

Any ideas why this is happening??

I am not sure if this is your problem regarding the fonts, however, I have custom fonts I use in my game and I had to install the fonts on both platforms (PC and mac as well) for them to behave correctly on the device / simulator.

Not sure on the image sheet issues…

Your fonts have to be installed on the PC or Mac for Corona to use them.  For iOS devices, you have to have the right settings in your build.settings file for the device to pick up any custom fonts.  If you are getting errors from the fonts it could be preventing your image sheets to load correctly.

problem solved:

it would seem the font name (not file name, but actually the font name inside the file) was different from PC and mac, on PC it was “MuseoSans_500” while on mac it was “MuseoSans-500”. Nice way to make us break our heads over nothing, bill and jobs!

But… fixing the fonts problem did nothing to the image sheet problem, again, on my PC and android, it work perfectly, on my mac simulator and iPhone, it does not. some of my graphic objects gets rendered, no problem, some of them not.

Hi @formatc,

I assume there are no “weird” characters or spaces in the image sheet file names? And they’re not residing in some external module? As a test, can you build a new project with just this basic image sheet declared in main.lua, with the image sheets in the base directory, and then output some of the frames to the screen?

Thanks,

Brent

Sure, I will try that, and yeah, no special name or characters in the file name.

I did move the file from the base folder to another folder, do you think that is an issue? I mean, if I map it to its position, and it works on the pc and on android, any reason it should work partially on mac and iPhone?

Well, putting the files back in the base folder had no effect what so ever.

Hi @formatc,

Can you show me some code where you declare these images? And also tell me what pixel dimensions one of these “bad” images is?

Thanks,

Brent

Well, the image size is nothing special, nothing too large or small, but the point is, I made a new project file, and I’ve made a simple function that will display each image from the imagesheet on the stage, 2 buttons to flip front and back, and I can say this works just fine on my pc, my android, my mac and my iphone, so it would seem the image is not the problem in this case.

I can think of no reason why this file should work in one project, and not the other, if I’m using exactly the same file, and the code.

it’s a large png file, with, as of now, 113 elements in it, and in my test project they work just fine, as I’ve just said, but on my original project, for some reason, a few of the images do not render. what I’m going to try next is actually using now the same functions from my test project in my actual project, and see what happens.

UPDATE:

I’ve tried the old file in the old project, with the new function to see all the images in turn that I’ve used in my test project, and all the parts are rendered correctly, so I guess what I should do now it devise some debugging mechanism and see if I can spot some hidden error in the code where I’m parsing the imagesheet where the images I need to not render, will keep updating.

UPDATE:

OK, I’ve traced the location and size of my image on all devices, the location and sizes printed are just fine on all devices, so my next step was to change the problematic image, and try to render a different image and see what happens, since I have other images in my imagesheet that have the exact same size as my “bad” image, and in this case, the mac and iPhone still refuse to render the image, so I can say that it’s not a problem of my specific frame in my imagesheet.

Also, it would seem that for all practical purposes, the project acts as if the images are there, since the problematic image is a button out of a set of buttons, where I position each button according to the position of the last button, the elements after the problematic button are rendered in their intended location, so the project can “see” and “feel” the image where it should be, but it does not show it.

UPDATE:

I’ve user the “bad” button frame instead of a different button I have on the same screen which had the same size, and it worked, so it’s not a problem of not rendering the imagesheet specific frame, but it’s somehow related to the position I’m rendering in…

LAST UPDATE, AND SOLUTION:

So I finally found a solution, even though the problem is still a mystery…

I have some buttons, titles and graphics I set on the screen, and off screen, then I insert them all into a display group, as I should, at the ends of my placing all the items, so I could drag and scroll that group as I’d like.

2 of these button did not render for some, still remain unknown, reason, they were not the first, or last, but somewhere in the middle.

The solution I found was to change order of the items in my display group, since I didn’t mind button 3 to be placed, visually, above button 2, since they will scroll the screen together and will never overlap, and this changing of the order is what made this work again. Do any other items don’t render well now they take up the old problematic buttons position in the hierarchy?? nope, they all render find, which is why I’m saying there is a solution, but I still don’t know what the problem is.

Hope this helps someone who have the same problem.

I am not sure if this is your problem regarding the fonts, however, I have custom fonts I use in my game and I had to install the fonts on both platforms (PC and mac as well) for them to behave correctly on the device / simulator.

Not sure on the image sheet issues…

Your fonts have to be installed on the PC or Mac for Corona to use them.  For iOS devices, you have to have the right settings in your build.settings file for the device to pick up any custom fonts.  If you are getting errors from the fonts it could be preventing your image sheets to load correctly.

problem solved:

it would seem the font name (not file name, but actually the font name inside the file) was different from PC and mac, on PC it was “MuseoSans_500” while on mac it was “MuseoSans-500”. Nice way to make us break our heads over nothing, bill and jobs!

But… fixing the fonts problem did nothing to the image sheet problem, again, on my PC and android, it work perfectly, on my mac simulator and iPhone, it does not. some of my graphic objects gets rendered, no problem, some of them not.

Hi @formatc,

I assume there are no “weird” characters or spaces in the image sheet file names? And they’re not residing in some external module? As a test, can you build a new project with just this basic image sheet declared in main.lua, with the image sheets in the base directory, and then output some of the frames to the screen?

Thanks,

Brent

Sure, I will try that, and yeah, no special name or characters in the file name.

I did move the file from the base folder to another folder, do you think that is an issue? I mean, if I map it to its position, and it works on the pc and on android, any reason it should work partially on mac and iPhone?

Well, putting the files back in the base folder had no effect what so ever.

Hi @formatc,

Can you show me some code where you declare these images? And also tell me what pixel dimensions one of these “bad” images is?

Thanks,

Brent

Well, the image size is nothing special, nothing too large or small, but the point is, I made a new project file, and I’ve made a simple function that will display each image from the imagesheet on the stage, 2 buttons to flip front and back, and I can say this works just fine on my pc, my android, my mac and my iphone, so it would seem the image is not the problem in this case.

I can think of no reason why this file should work in one project, and not the other, if I’m using exactly the same file, and the code.

it’s a large png file, with, as of now, 113 elements in it, and in my test project they work just fine, as I’ve just said, but on my original project, for some reason, a few of the images do not render. what I’m going to try next is actually using now the same functions from my test project in my actual project, and see what happens.

UPDATE:

I’ve tried the old file in the old project, with the new function to see all the images in turn that I’ve used in my test project, and all the parts are rendered correctly, so I guess what I should do now it devise some debugging mechanism and see if I can spot some hidden error in the code where I’m parsing the imagesheet where the images I need to not render, will keep updating.

UPDATE:

OK, I’ve traced the location and size of my image on all devices, the location and sizes printed are just fine on all devices, so my next step was to change the problematic image, and try to render a different image and see what happens, since I have other images in my imagesheet that have the exact same size as my “bad” image, and in this case, the mac and iPhone still refuse to render the image, so I can say that it’s not a problem of my specific frame in my imagesheet.

Also, it would seem that for all practical purposes, the project acts as if the images are there, since the problematic image is a button out of a set of buttons, where I position each button according to the position of the last button, the elements after the problematic button are rendered in their intended location, so the project can “see” and “feel” the image where it should be, but it does not show it.

UPDATE:

I’ve user the “bad” button frame instead of a different button I have on the same screen which had the same size, and it worked, so it’s not a problem of not rendering the imagesheet specific frame, but it’s somehow related to the position I’m rendering in…

LAST UPDATE, AND SOLUTION:

So I finally found a solution, even though the problem is still a mystery…

I have some buttons, titles and graphics I set on the screen, and off screen, then I insert them all into a display group, as I should, at the ends of my placing all the items, so I could drag and scroll that group as I’d like.

2 of these button did not render for some, still remain unknown, reason, they were not the first, or last, but somewhere in the middle.

The solution I found was to change order of the items in my display group, since I didn’t mind button 3 to be placed, visually, above button 2, since they will scroll the screen together and will never overlap, and this changing of the order is what made this work again. Do any other items don’t render well now they take up the old problematic buttons position in the hierarchy?? nope, they all render find, which is why I’m saying there is a solution, but I still don’t know what the problem is.

Hope this helps someone who have the same problem.