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.

Newcomers AppGameKit Corner / Tier II: Using the CreateText Function to Display Integer Values

Author
Message
PEV
User Offline
Joined: 20th Apr 2019
Location:
Posted: 28th Aug 2019 04:46
I'm slowly picking up Tier II from Tier I using Visual Studio 2019 and the AppGameKit 2 library of functions.

I'd like to display an integer value using the CreateText command in Tier II.

In Tier I, the following works:

CreateText(3,"SCORE: " + str(score) )

However, when I call the Tier II function:

agk::CreateText( 3, "SCORE: " + str(score) );

I get an error message. Is "str" not recognized in Tier II or do I need to go about this a different way in C++?

The following command works, but I like having more text options with the CreateText command:

agk:rint(score);

Any help greatly appreciated.
Dark Raven
5
Years of Service
User Offline
Joined: 27th Jul 2014
Location: United States
Posted: 28th Aug 2019 08:32
agk::Str(score) should do it.
Cybermind
16
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 11th Sep 2019 14:15
In Tier 2, agk::Str() will return a pointer (a memory address that points to where the data is stored in memory). Every time you call that function, it will create a new item in memory and give you the pointer that points to that item/data, so you will have to delete the data that is POINTED to, not just the pointer itself (the pointer is just a variable that holds a memory address that tells where the data is stored). Not deleting the data itself will give you memory leaks as new data is constantly created but not deleted, if functions that returns pointers are called.
13/0

Login to post a reply

Server time is: 2019-09-22 18:17:56
Your offset time is: 2019-09-22 18:17:56