Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / AGK Text Appears Incorrectly on iOS Device

Author
Message
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 9th Jan 2012 07:03
Screenshot explains all:



Not quite sure how to fix this...

Hi there. My name is Dug. I have just met you, and I love you.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 9th Jan 2012 08:37
check the font .txt filename
iOS is case sensitive, make sure both font & font .txt are same case. to keep things simple, make everything lower case!
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 9th Jan 2012 08:54
Yup. "font.png" and "font subimages.txt" are both there, same case and everything.

Hi there. My name is Dug. I have just met you, and I love you.
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 9th Jan 2012 10:12
Also, I think your font image file needs to be a power of 2 in size. How big is it?
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 9th Jan 2012 10:21
Power of 2 size. 512 by 512

Hi there. My name is Dug. I have just met you, and I love you.
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 9th Jan 2012 12:17
Looking at the text, I think there is something wrong with how AppGameKit stores the strings in memory - if you compare the characters in the first lines, it says "Level 1" in the first screenshot, and "!!!" with other garbage in the second.

Hi there. My name is Dug. I have just met you, and I love you.
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 10th Jan 2012 06:46
Can you post the png and sub images txt files?
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 10th Jan 2012 10:09 Edited at: 10th Jan 2012 10:18
Problem solved. It was a path issue, or something along those lines. I had the images being loaded with a path of "/fonts/xxxx.png". Replacing them with "fonts/xxxx.png" causes it to work.

However, this causes another problem. On iOS, the text appears correctly, but using GetTextX(), GetTextY(), GetTextTotalWidth(), GetTextTotalHeight(), makes the program crash.

So, one step forward, two back

EDIT: Anyone from TGC, message me. I'll send you my source code - ironically enough right now, the only way I can play my game is without text appearing correctly :/

Hi there. My name is Dug. I have just met you, and I love you.
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 10th Jan 2012 11:50
There is no message function in this forum.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Jan 2012 12:33
Quote: " On iOS, the text appears correctly, but using GetTextX(), GetTextY(), GetTextTotalWidth(), GetTextTotalHeight(), makes the program crash."


Do they work in Windows? The last 2 commands are working ok for me in Windows and Android.

anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 10th Jan 2012 13:01 Edited at: 10th Jan 2012 13:02
Yes, it works in Windows. If I create a simple sample application, it will show the text size. Though, on the iOS it doesn't always work.

The code is attached. If there is a preceding '/' in the path of the image, it doesn't appear on iOS, and returns a different font size width and height, compared to Windows. I'm not sure why it doesn't crash - it could be due to the overall complexity of my code in my project vs. the one I just uploaded.

If there isn't a preceding '/', it works the same as on both.

EDIT: This code also includes font and font subimages files

Hi there. My name is Dug. I have just met you, and I love you.

Attachments

Login to view attachments
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Jan 2012 13:17
This looks like some of Lee's anti-crash code, it keeps tripping me up. Either that or as you say, a bug in iOS.

Explanation 1
If you put the "/" then it will go to the root folder of the app. Your fonts are not in root, they are in Media. In theory it should crash, but the safety code may be redirecting it Media on Windows, and replacing it with the default font on iOS.

Explanation 2
"/" should put you in Media. In which case, iOS is bugged.

anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 10th Jan 2012 13:27 Edited at: 10th Jan 2012 13:50
Well, regardless. Removing the "/" causes the font images to be loaded correctly, but causes the app to crash when GetTextX(), etc. to be called (if I comment out this code, the app works correctly).

If I insert the "/" in there, I can't read anything due to garbage being printed to screen, but hey - if I know what it's supposed to say, I can play it! :3

EDIT: Uploaded crash log from my iPhone

Hi there. My name is Dug. I have just met you, and I love you.

Attachments

Login to view attachments
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 10th Jan 2012 17:25
Due to the way the path commands work adding a / at the start of the path would create something like this internally

C:/pathtomedia//fonts/image.png

which some OSs may accept others not.

I can't see why GetTextX() would crash as it's a simple float return, if you email me the project I'll run it through a debugger and see what comes up.
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 10th Jan 2012 18:32
Sent you an e-mail. It's from a Yahoo email address, so might want to check your spam folder.

Hi there. My name is Dug. I have just met you, and I love you.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 10th Jan 2012 22:35
Looks like a bug when changing the text font image. In certain cases the old font image would be deleted whilst still being used by some of its letters, causing a crash when it tried to set the new image. I've added a fix but I don't think there will be a new release for a while. You should be able to work around it by using SetTextFontImage( ID, 0 ) to clear the image before setting the new one.

In particular the bug is likely to occur when changing a text object from a variable width font to another variable width font.
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 10th Jan 2012 23:04
Nope, setting the font image to 0 does not work - it still crashes. However, commenting out all additional "SetTextFontImage" in the code - besides the initial ones - work.

I could edit the code to change the text color as well, I presume.

But thank you for looking at the problem! I appreciate being able to read the text on my screen now

Hi there. My name is Dug. I have just met you, and I love you.

Login to post a reply

Server time is: 2024-11-23 00:31:02
Your offset time is: 2024-11-23 00:31:02