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 / DrawSprite() equivalent for text objects? Compositing with GetImage()

Author
Message
EarwigTC
11
Years of Service
User Offline
Joined: 3rd Sep 2012
Location:
Posted: 14th Nov 2012 22:57
I would like to build new images with GetImage() that will involve both sprites and text. Is using Render() and placing these component objects far away from everything else that's in my game field the only option for doing this? I can render single sprites with DrawSprite() but see no way to do the same with single text objects.

Or am I missing some simpler way to merge text and images into a new image/sprite? If not, it would be very handy to be able to turn text objects into sprites or images in one command.

Thanks!
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 15th Nov 2012 00:45
You're right there is no DrawText command. Something for the future.
EarwigTC
11
Years of Service
User Offline
Joined: 3rd Sep 2012
Location:
Posted: 15th Nov 2012 18:27
Okay, thanks much for the reply.

One-step conversion of text to sprite would be really good too. I find that I need to treat static text with the same functions/type models as sprites more often than not, and it means duplicating sprite functionality into text functions that are basically the same thing, but with text commands.
EarwigTC
11
Years of Service
User Offline
Joined: 3rd Sep 2012
Location:
Posted: 15th Nov 2012 18:41
I see now, too, that you can't even change the angle of text objects, just sub characters. If I can't rotate text, and I can't turn the text into a sprite which I can rotate, eeeep! Frustrating. This would solve that issue as well.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 15th Nov 2012 22:05
I actually wrote an enhancement request for this months ago. You can turn text into a sprite using getImage() but it's not exactly a one step process.


this.mess = abs(sin(times#))
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th Nov 2012 22:59
I do this in my app, it's not pretty code but it works:

1. Create Sprite
2. Position and Size Sprite
3. Render()
4. Create Text
5. Position and Size Text over Sprite
6. Render()
7. GetImage()

I have tried all sorts of ways and this is the only one that works consistently. But...

If your image or text has semi-transparent areas, then the entire image becomes semi-transparent in this area. For example, if you put solid text over a 50% opaque image, the text becomes 50% opaque too

It broke at 108 Beta 3 . The text no longer renders. This may be because of other issues I haven't had time to look into, but my 1076/108 Beta 2 code no longer worked by Beta 3. The top image is beta 3, the lower image is Beta 2...



EarwigTC
11
Years of Service
User Offline
Joined: 3rd Sep 2012
Location:
Posted: 15th Nov 2012 23:40
Thanks. I implemented essentially this solution today, and it works great on PC, but any use of GetImage() (even the CustomImage example app) on my Droid 2 Global is crashing the player. I upgraded to 1.08 IDE/player in an effort to solve that, but have a fun new bug with UDT objects in multidimensional arrays now, which has halted me.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th Nov 2012 23:55
Quote: "but any use of GetImage() (even the CustomImage example app) on my Droid 2 Global is crashing the player"


I got this on Win 7 and Win 8. Certain combinations of Render() and Sync() are very sensitive and break easily. The example I posted only works in this sequence, anything else breaks.

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 16th Nov 2012 02:35
Batvink, can you email me a small example of the text over sprite not working with GetImage, I've not seen this before. I've also not had any problems with Render and Sync, so any code you have on that would be welcome.

Login to post a reply

Server time is: 2024-05-05 14:45:04
Your offset time is: 2024-05-05 14:45:04