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.

Windows / Set the Position of the Text from Text file

Author
Message
Darknaruto
8
Years of Service
User Offline
Joined: 24th Aug 2015
Location:
Posted: 24th Aug 2015 13:05
After opening and display the text from the text file, how should I set the position of each text?

I am who I am
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 24th Aug 2015 16:10
Do you mean on the screen?

You would use createText() and SetTextPosition()

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Darknaruto
8
Years of Service
User Offline
Joined: 24th Aug 2015
Location:
Posted: 24th Aug 2015 17:58
Yes I am mean on the screen, but that want is only writing the text.
What I want is the text that has been read from a text file and set it's position.

I am who I am
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 24th Aug 2015 19:05
You have 2 options:

Print()
This only allows very basic text, that must be reprinted every loop.

CreateText()
This allows you to easily change size, colour, position etc. You can also load different bitmap fonts to change the style. Every piece of text can have a different size, style and colour. It can be aligned left, right or centrally. If you want to write a paragraph of text, then this is also the best option. You can use chr(10) to add line endings.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Darknaruto
8
Years of Service
User Offline
Joined: 24th Aug 2015
Location:
Posted: 24th Aug 2015 19:17
In the myFile.txt, it have the text
"aaa"
"bbb"
"ccc"
I want to set the position of these text, how should I do it? Because I try to use
agk::SetTextPosition(2, 700, 50);
But it is not working.
Below is my code.

agk:penToRead(2, "myFile.txt");

for (int i = 0; i < 3; i++)
{
m_sReadTextLine[i] = agk::ReadLine(2);

agk:rint(m_sReadTextLine[i].c_str());

}

agk::CloseFile(2);

I am who I am
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 24th Aug 2015 22:27
I don't use AppGameKit Tier 2, but from what I can understand, you are mixing Print and Text.

SetTextPosition() works with CreateText()

Print() is a completely different "system", that you cannot position in the same way.

Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Darknaruto
8
Years of Service
User Offline
Joined: 24th Aug 2015
Location:
Posted: 25th Aug 2015 11:38
It works now. Thanks! But now it only show the first words which is
"aaa"
How to set position of the other words?

I am who I am

Login to post a reply

Server time is: 2024-04-23 13:09:47
Your offset time is: 2024-04-23 13:09:47