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 / Are both necessary for custom text ?

Author
Message
GunnerJnr
AGK Developer
8
Years of Service
User Offline
Joined: 30th Nov 2015
Location: Bridgwater, UK
Posted: 7th Jan 2018 15:22 Edited at: 7th Jan 2018 15:24
Probably a stupid question but as the title suggests are both necessary for custom text,



??

I saw there was a command called
, just wondering if there might be an easier way to set it up than creating it for each new text object ? Perhaps someone could provide a small example..

Thanks in advance here is the current code. I have also provided a small gif of it in action for now they both use the same images for text but this could change in the future.



Attachments

Login to view attachments
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 7th Jan 2018 16:36 Edited at: 7th Jan 2018 16:42
You don't need to load the same font twice. If both texts are using the same font image, then assign the same image to both.

something like:



You only need SetTextString when you want to update the text. If you never need to update the string, then CreateText will do the job.
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 7th Jan 2018 16:40
You use CreateText() when creating the text object and setting the initial string, then afterward, whenever you want to change the text string of that object you use SetTextString().
13/0
GunnerJnr
AGK Developer
8
Years of Service
User Offline
Joined: 30th Nov 2015
Location: Bridgwater, UK
Posted: 7th Jan 2018 18:29
Quote: "You don't need to load the same font twice. If both texts are using the same font image, then assign the same image to both."


Thanks @CJB I had a feeling I was being stupid here.

Quote: "You use CreateText() when creating the text object and setting the initial string, then afterward, whenever you want to change the text string of that object you use SetTextString()."


and yes thanks @Cybermind, I had a feeling this was the case, It's been a while since I used AppGameKit, I've grown a little rusty.

Thank You both.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 8th Jan 2018 09:31
You're also creating a bitmap font, but telling AppGameKit to use the new TTF font system with the UseNewDefaultFonts( 1 ) command.
GunnerJnr
AGK Developer
8
Years of Service
User Offline
Joined: 30th Nov 2015
Location: Bridgwater, UK
Posted: 9th Jan 2018 11:17 Edited at: 9th Jan 2018 11:17
Quote: "You're also creating a bitmap font, but telling AppGameKit to use the new TTF font system with the UseNewDefaultFonts( 1 ) command."


@Mobiius, yea thanks it was only for testing that I changed the FPS I have reverted it back to the normal text and prefer the default nicer fonts so that is why it is still enabled. I get the desired effect and best of both now.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-19 00:28:55
Your offset time is: 2024-04-19 00:28:55