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 / print ("text") with locate X,Y

Author
Message
Santiago3D
4
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 18th Nov 2020 14:48
Hello, many times it is very practical to have a text on the screen that is occasional.

Just as we use the PRINT ("") command, it would be nice to have the possibility of positioning a simple text on the XY screen.

The fact of creating a textID is cumbersome in some situations

is there any way to position a simple text?

I know it is not ideal in terms of optimization, but on some occasions it is really useful.

Now I'm generating a mission editor, and I have a lot of information that it's quick to display using drawrect, drawellipse, drawline, and a drawtext (text $, x, y, center) would be great.

without having to create the id
so in the next frame it would no longer be there unless we use that command again.

If I'm not mistaken, creating a text from agk every frame is slow, since generating the text is a slow process according to the help if we use it too much.

any suggestions?



Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 18th Nov 2020 16:58 Edited at: 18th Nov 2020 17:12
can you explain more of what you want, here?

does each one of those rectangles and circles need a constant text label (with a unique string?), or just when you hover over them? i'm remembering a limit to the # of text objects we can have which i think is 100 but i don't see a limit mentioned @ CreateText()/not sure where i read that.

meanwhile, if you made a basic functioning example, we could be more help, even if it wasn't optimized in any way. or, just a more-elaborate description? i just want to know all that you're trying to accomplish so the functionality can be taken into account. i expect each one of those is part of a type that has a label/some "text" that accompanies it and is displayed somehow? do you need to be able to select the text? etc.

otherwise, the simple answer is, i don't think we have any other options beyond DrawText or AddText. handling them wouldn't be too terrible but you state "The fact of creating a textID is cumbersome in some situation" which i'm not understanding, so...

ADD: a couple things to consider
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=AGK] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]
Santiago3D
4
Years of Service
User Offline
Joined: 11th May 2020
Location: Argentina
Posted: 18th Nov 2020 20:44
the link you post was helpful

i just solved making a own function to create texts and delete if are temporary texts.



Now i trying to draw the texts front of the lines drawings, because appears back to the drawline or ellipses and box

thanks for the data!


Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 18th Nov 2020 20:59 Edited at: 18th Nov 2020 21:04
the Draw commands are not elegant. you won't have much built-in control over them like Text/Sprite objects, etc., especially no notion of Depth or Draw Order except:

if you need to use them, you'd need to consider using Render and RenderToImage to get what you want. basically, draw your lines/boxes/elipses, render, then add Text/whatever else is to be above the lines, then finish (sync/etc).

alternatively, consider using a dynamically-sized single pixel sprite* (with SetSpriteSize() or the like based on the distance from A to B) where you could set the depth/order easily.

*the sprite doesn't have to be single pixel. you could add any style/alpha, etc, but you get the idea.
[My Itch.io Home] [Now Playing]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=AGK] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[Google Forum Search]
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 19th Nov 2020 09:20
The print command also needs an option to add a solid/semi-transparent background behind the text, as it can often be hard to see against your app/game. I know you can change the print colour but that doesn't always help. A semi transparent background will make the print text much clearer. Never needed to print it in an x and y position but probably would if I could. I know on my Samsung S9 the round edges at the top of the screen cut off the first few characters in the first few print lines so I sometimes have to print a blank line to avoid that. That's where x and y would also be useful. And to move it away from the far left edge of the screen a bit with a bit of padding/margin.
OryUI - A WIP AGK2 UI Framework

Login to post a reply

Server time is: 2024-11-21 22:46:50
Your offset time is: 2024-11-21 22:46:50