Data Realms Fan Forums
http://forums.datarealms.com/

How to use DrawTextPrimitive?
http://forums.datarealms.com/viewtopic.php?f=73&t=46137
Page 1 of 1

Author:  BlueComet24 [ Sat Jan 21, 2017 4:03 am ]
Post subject:  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?

Author:  Bad Boy [ Sat Jan 21, 2017 5:43 am ]
Post subject:  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)

Author:  BlueComet24 [ Sat Jan 21, 2017 9:22 am ]
Post subject:  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

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/