View unanswered posts | View active topics It is currently Thu Nov 28, 2024 11:29 am



Reply to topic  [ 3 posts ] 
 How to use DrawTextPrimitive? 
Author Message

Joined: Sun Mar 08, 2015 11:57 pm
Posts: 8
Reply with quote
Post How to use DrawTextPrimitive?
I'm not sure what the proper syntax is for std::string text in DrawTextPrimitive.
Let's say I want to have small text that says "TARGET LOCK" centered over an actor that's locally defined as TargetMO. I assume it's similar to DrawLinePrimitive which works in the same Lua script using something like FrameMan:DrawLinePrimitive(TargetMO.Pos,TargetMO.Pos+Vector(5,0),13);, so I would use FrameMan:DrawTextPrimitive(TargetMO.Pos, std::string text, 1, 1), but this doesn't work if I replace std::string text with "TARGET LOCK" like so: FrameMan:DrawTextPrimitive(TargetMO.Pos, "TARGET LOCK", 1, 1) and I get this error message:

ERROR: no overload of 'FrameManager:DrawTextPrimitive' matched the arguments (FrameManager, Vector, string, number, number)
candidates are:
FrameManager:DrawTextPrimitive(Vector, string, boolean, number)

I've also tried without quotes around the text and various variations of
Code:
std::string text = "TARGET LOCK"
FrameMan:DrawTextPrimitive(TargetMO.Pos, std::string text, 1, 1)

But I don't really know what I'm doing here and there's not much about this or similar things online, or I don't know what to look for.
How do I enter the text to draw?


Sat Jan 21, 2017 4:03 am
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: How to use DrawTextPrimitive?
I don't remember what the parameters for this actually do anymore but the error tells you what the problem is - the 3rd parameter should be a boolean instead of a number, so replace the first 1 with true or false.
I.e. FrameMan:DrawTextPrimitive(TargetMO.Pos, "TARGET LOCK", true, 1)


Sat Jan 21, 2017 5:43 am
Profile

Joined: Sun Mar 08, 2015 11:57 pm
Posts: 8
Reply with quote
Post Re: How to use DrawTextPrimitive?
Thank you! I should've paid closer attention to the dev log:
Quote:
function DrawTextPrimitive(Vector start, std::string text, bool isSmall, int alignment) , alignment 0 = left, 1 = center, 2 = right


Sat Jan 21, 2017 9:22 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.028s | 13 Queries | GZIP : Off ]