Sharingan Posted July 28, 2011 Share Posted July 28, 2011 Hello guys, I'm trying to do a HUD, but i got a little problem. I don't know how to add borders in Texts. I'll show you some images: I tried to do borders putting behind another dxdrawtext: It looks like this without borders: I want something like this: Here's my simple code: dxDrawText(tostring (inclip),sWidth-414,sHeight-47,sWidth-369,sHeight-18,tocolor(127,127,127,255),1.0,"pricedown") dxDrawText(tostring (ammo2),sWidth-375,sHeight-47,sWidth-272,sHeight-12,tocolor(255,255,255,255),1.0,"pricedown") Sorry for my bad english, I'm still learning. Link to comment
BinSlayer1 Posted July 28, 2011 Share Posted July 28, 2011 well border is just the same text (usually black colored) 1-2 pixels to the right, then another one to the left, upwards and downwards of the original text Borders come first as dxDrawTexts (since they're black) and the original text is the last one to be drawn (so it appears on top of the rest) dxDrawText(--black colored, 2 pixels down from original text position--) dxDrawText(--black colored, 2 pixels up from original text position--) dxDrawText(--black colored, 2 pixels to the right from original text position--) dxDrawText(--black colored, 2 pixels to the left from original text position --) dxDrawText(--original text parameters--) 4 dxDraws for the border, 1 for the original text. Hope I helped. There's another way (simplier too). Check this out: viewtopic.php?f=108&t=24262&hilit=textlib Link to comment
Maccer. Posted July 29, 2011 Share Posted July 29, 2011 As the guy above said, you can use textlib, but his manual way is incorrect and lacks some accuracy. The correct way: dxDrawText ( "a", 100 - 1, 100 - 1, 100 - 1, 100 - 1, tocolor ( 0, 0, 0, 255 ) ) -- black dxDrawText ( "a", 100 + 1, 100 - 1, 100 + 1, 100 - 1, tocolor ( 0, 0, 0, 255 ) ) dxDrawText ( "a", 100 - 1, 100 + 1, 100 - 1, 100 + 1, tocolor ( 0, 0, 0, 255 ) ) dxDrawText ( "a", 100 + 1, 100 + 1, 100 + 1, 100 + 1, tocolor ( 0, 0, 0, 255 ) ) dxDrawText ( "a", 100 - 1, 100, 100 - 1, 100, tocolor ( 0, 0, 0, 255 ) ) dxDrawText ( "a", 100 + 1, 100, 100 + 1,100, tocolor ( 0, 0, 0, 255 ) ) dxDrawText ( "a", 100, 100 - 1, 100, 100 - 1, tocolor ( 0, 0, 0, 255 ) ) dxDrawText ( "a", 100, 100 + 1, 100, 100 + 1, tocolor ( 0, 0, 0, 255 ) ) dxDrawText ( "a", 100, 100, 100, 100, tocolor ( 255, 255, 255, 255 ) ) -- white Link to comment
Sharingan Posted July 30, 2011 Author Share Posted July 30, 2011 textlib? What is that? Are there some libraries for MTA? Link to comment
qaisjp Posted July 30, 2011 Share Posted July 30, 2011 function dxDrawBorderedText(text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak,postGUI) for oX = -1, 1 do -- Border size is 1 for oY = -1, 1 do -- Border size is 1 dxDrawText(text, left + oX, top + oY, right + oX, bottom + oY, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak,postGUI) end end dxDrawText(text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) end 1 Link to comment
AGENT_STEELMEAT Posted July 30, 2011 Share Posted July 30, 2011 This is a bit unneccesary, but I liked your solution so much that I went ahead and cleaned it up a bit. You can now provide your own arguments for the outline size and outline color. http://pyropaste.net/n7T30E114 Link to comment
BinSlayer1 Posted July 30, 2011 Share Posted July 30, 2011 Fedor_s, how is my way incorrect? Do that and you get your border lol.. Link to comment
Sharingan Posted August 2, 2011 Author Share Posted August 2, 2011 Thanks to everyone. 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