denny199 Posted October 23, 2013 Share Posted October 23, 2013 Hi guys, I was making my own dx Window and now I strumbeled into a problem, the dxDrawText function is pretty unhandy with colorCoding and wordBreaking. Let's take for example I want to draw a player name which is "WWWWWWWWWWWWWWW" ( which is too long for say example a DX grid ) , Now I want to combine it with colorCoded and wordBreak, but too sad a wiki note: colorCoded: Set to true to enable embedded #FFFFFF color codes. Note: clip and wordBreak are forced false if this is set. Now is my question, does someone has his own dxDrawText function, which draws color codes and has wordBreak enabled for color coded, I can write my own, but why should I if someone else has it for free (ofc if he wants to share it) . Regards, Danny Link to comment
Tete omar Posted October 24, 2013 Share Posted October 24, 2013 function dxDrawTxt ( text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, postGUI, subPixelPositioning ) dxDrawText ( text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, true, postGUI, true, subPixelPositioning ) end Link to comment
denny199 Posted October 24, 2013 Author Share Posted October 24, 2013 Wooooooow, this IS NOT working, you are forcing to set the variables inside dxDrawText to true, please read the wiki (or my topic post): right: the absolute X coordinate of the right side of the text bounding box. Used for text aligning, clipping and word breaking. bottom: the absolute Y coordinate of the bottom side of the text bounding box. Used for text aligning, clipping and word breaking. (......) -- skip that huge part clip: if set to true, the parts of the text that don't fit within the bounding box will be cut off. -- I want this, but see beneath colorCoded: Set to true to enable embedded #FFFFFF color codes. Note: clip and wordBreak are forced false if this is set. So I need a costum dxDrawText function with reading the HTML color codes, and then split those away like dxDrawColoredText, and then check if the text is still withing the bounding box. Link to comment
asd123 Posted October 24, 2013 Share Posted October 24, 2013 Just remove from the name the HTML color codes, then use dxGetTextWidth to check if it's inside the bounding box -> if not, check for the last letter width etc, just some maths, then remove those letters from the name for outputting. Link to comment
denny199 Posted October 24, 2013 Author Share Posted October 24, 2013 Hmmmm, thats an good idea ProGear, i'll try it out today! Link to comment
Tete omar Posted October 24, 2013 Share Posted October 24, 2013 Wooooooow, this IS NOT working, you are forcing to set the variables inside dxDrawText to true, please read the wiki (or my topic post):right: the absolute X coordinate of the right side of the text bounding box. Used for text aligning, clipping and word breaking. bottom: the absolute Y coordinate of the bottom side of the text bounding box. Used for text aligning, clipping and word breaking. (......) -- skip that huge part clip: if set to true, the parts of the text that don't fit within the bounding box will be cut off. -- I want this, but see beneath colorCoded: Set to true to enable embedded #FFFFFF color codes. Note: clip and wordBreak are forced false if this is set. So I need a costum dxDrawText function with reading the HTML color codes, and then split those away like dxDrawColoredText, and then check if the text is still withing the bounding box. Sorry, misreading Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now