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.

iOS and MacOS / Problem with function agk::SetTextMaxWidth on iPads in landscape mode!

Author
Message
Commandor
11
Years of Service
User Offline
Joined: 25th Jan 2011
Location: Kiev, Ukraine
Posted: 24th Sep 2012 00:38 Edited at: 24th Sep 2012 00:45
Hi all!

I have problem with sets the maximum width the text object on iPad in landscape mode. On OS Windows this function works, but the iPad does not work.

Example code:


SetTextMaxWidth - wrap onto a new line on iPads in landscape mode as if the width in portrait mode.
May not work correctly agk::GetDeviceWidth() in landscape mode?



Who knows how to solve this problem?

Life is our game, playing we live!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Sep 2012 01:22
What version of AppGameKit are you using?

Are you using the Player on your iOS device or are you directly connected to a Mac and running from Xcode?

Cheers,
Ancient Lady
AGK Community Tester
Commandor
11
Years of Service
User Offline
Joined: 25th Jan 2011
Location: Kiev, Ukraine
Posted: 24th Sep 2012 01:38 Edited at: 24th Sep 2012 01:40
1) version: 1076

2) agk::SetTextMaxWidth -> "Player on your iOS device" - Is there Player for tier 2? )

3) Yes, I directly connected from a Mac and running from Xcode on iPad. I also run on the iPad - the same error.

Life is our game, playing we live!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Sep 2012 01:52
Doh! There is no player for Tier 2, my bad. Of course I should not have needed to ask that question based on your code snippet.

Do you have the updated AppGameKit 1076 files in your Tier 2 Xcode project? There were several fixes made for orientation issues.

I have a simple app that shows me orientation and width/height using the same commands as you show and it shows the correct width/height for all orientations.

I posted some good Tier 2 templates/files in this thread.

Cheers,
Ancient Lady
AGK Community Tester
Commandor
11
Years of Service
User Offline
Joined: 25th Jan 2011
Location: Kiev, Ukraine
Posted: 24th Sep 2012 21:25 Edited at: 24th Sep 2012 21:31
"the updated AppGameKit 1076 files" - template_set_vs10_and_ios.zip? This update you have in mind?

It did not work. I checked the bug is in the function:
agk::SetTextMaxWidth

I've created screenshot of the screen:





Life is our game, playing we live!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Sep 2012 21:41
Quote: "This update you have in mind?"

Yes. And are you sure you have the 1076 version of libraries and such on your Mac?

When do you set the text?

I discovered that you should set the text after you apply SetTextMaxWidth for it to work properly.

I've had no problems with using the command all over the place in Tier 2 on all my devices (iOS 5.1/6.0, Android 3.2/4.1).

Cheers,
Ancient Lady
AGK Community Tester
Commandor
11
Years of Service
User Offline
Joined: 25th Jan 2011
Location: Kiev, Ukraine
Posted: 24th Sep 2012 22:34 Edited at: 24th Sep 2012 22:38
I started to work only in this case:


The function agk::SetTextString was useless when using agk::SetTextMaxWidth You can not change the text in the course of the program.

Life is our game, playing we live!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Sep 2012 22:40
You absolutely can change the text once you create the object. My game does it all over the place. For instance, it's how the score/time/etc. gets updated in the score board.

Have you tried displaying the value you are getting for agk::GetDeviceWidth()?

Cheers,
Ancient Lady
AGK Community Tester
Commandor
11
Years of Service
User Offline
Joined: 25th Jan 2011
Location: Kiev, Ukraine
Posted: 24th Sep 2012 23:09 Edited at: 24th Sep 2012 23:11
I meant to change the text using the function agk::SetTextMaxWidth for dialog box in top center screen. Text is big. Change text "the score/time/etc." - it is not difficult.

I replaced agk::GetDeviceWidth() on 1024 - the same effect.

agk::GetDeviceWidth() = 1024

Life is our game, playing we live!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Sep 2012 23:10
My game plays in landscape mode, only. This is the function I use for displaying a message, the passed in i_txt is for a text object created during the initialization for the game (some bits have been extracted as not necessary to demonstrate usage, the MSG_BOX_BUTT sprite is also created at initialization):


Cheers,
Ancient Lady
AGK Community Tester
Commandor
11
Years of Service
User Offline
Joined: 25th Jan 2011
Location: Kiev, Ukraine
Posted: 24th Sep 2012 23:47
I also, but not working.

Life is our game, playing we live!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Sep 2012 00:02
Are you working in Debug or Release mode?

And are you sure you are using the v1076 files?

The current libraries are dated 6-Jun-2012. The Debug/libAGKiOS.a file size is 43.6MB and the Release one is 43.1MB.

What are the dates and sizes of the files in <yourproj>/Classes directory? If you started from the template_ios_xcode4 directory without updating the files in the Classes directory, then you are not using the 1076 version files.

It is a known issue that the Tier 2 templates, across the board for platform, were not up to date with the released AppGameKit versions for at least the last three releases.

Cheers,
Ancient Lady
AGK Community Tester
Commandor
11
Years of Service
User Offline
Joined: 25th Jan 2011
Location: Kiev, Ukraine
Posted: 25th Sep 2012 00:26
Quote: "The current libraries are dated 6-Jun-2012. The Debug/libAGKiOS.a file size is 43.6MB and the Release one is 43.1MB."

Yes.

I found when not working correctly:
if

Set text center alignment!

Life is our game, playing we live!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Sep 2012 00:48
That is correct. According to the documentation: 0=left, 1=center, 2=right

If you look in your <yourproj>/Classes/UntitledViewController.m file, does the 'shouldAutorotateToInterfaceOrientation' function look like this:


If not, unless you have edited it, then your files are not the correct ones for v1076.

Cheers,
Ancient Lady
AGK Community Tester
Commandor
11
Years of Service
User Offline
Joined: 25th Jan 2011
Location: Kiev, Ukraine
Posted: 25th Sep 2012 00:51
Found a solution how to fix!

Required after the function agk::SetTextMaxWidth & agk::SetTextString add agk::SetTextPosition:



Thank you Ancient Lady

Life is our game, playing we live!
Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Sep 2012 01:25
Okay. Good! Sometimes it really is in the ordering. I guess the whole display processing is done with the SetTextPosition, it probably does the recalculations at that point.

Cheers,
Ancient Lady
AGK Community Tester

Login to post a reply

Server time is: 2022-10-04 14:04:46
Your offset time is: 2022-10-04 14:04:46