Posts: 1,767
Threads: 124
Joined: Mar 2010
You mean.. when textdraw color is red by using ~r~ specifier to make text color red, you can't hover it? Make sure that your color from SelectTextDraw is not red, because it won't show you that you hovered it with mouse.
Posts: 1,767
Threads: 124
Joined: Mar 2010
Looks like SA-MP issue for me.
Code that I've tested:
pawn Code:
#include <a_samp>
new Text:gTextDraw;
public OnGameModeInit()
{
gTextDraw = TextDrawCreate(10.000000, 141.000000, "MyTextDraw");
TextDrawTextSize(gTextDraw,60.000000, 20.000000);
TextDrawAlignment(gTextDraw,0);
TextDrawBackgroundColor(gTextDraw,0x000000ff);
TextDrawFont(gTextDraw,1);
TextDrawLetterSize(gTextDraw,0.250000, 1.000000);
TextDrawColor(gTextDraw,0xffffffff);
TextDrawSetProportional(gTextDraw,1);
TextDrawSetShadow(gTextDraw,1);
TextDrawSetSelectable(gTextDraw, 1);
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SUBMISSION)
{
TextDrawSetString(gTextDraw, "~r~MyTextDraw");
TextDrawShowForPlayer(playerid, gTextDraw);
SelectTextDraw(playerid, 0x00FF00FF);
}
return 1;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
if(clickedid == gTextDraw)
{
SendClientMessage(playerid, 0xFFFFFFAA, "You clicked on a textdraw.");
CancelSelectTextDraw(playerid);
}
return 1;
}
Image:
http://bankfotek.pl/image/1668935 (I am actually hovering the textdraw there, but mouse has not been captured).
Note:
There are some other issues with ~r~ specifier anyway. Like displaying number '1' after '~r~' won't display the number. That must be SA-MPs issue, try ~h~~r~ and check what happens.
Posts: 1,767
Threads: 124
Joined: Mar 2010
Quote:
Originally Posted by PawnoQ
thanks mate
I was aware of the other bugs u mentioned.
I also alreadey tried to light up the colours using ~h~'s but still the same.
I also assumed this was a SAMP issue but like for many SAMP related issues there might be also a getaround for this one.
Still no solution found for this...
I cant test it atm but do you think it was worth a try to create the textdraw without any ~r~ colour formatting and then use the colour formatting for that textdraw in TextDrawSetString AFTER it has been created?
thanks
|
You might try, but.. you want to keep that textdraw red all the time? If so.. why don't you just change Textdraws color to: 0xFF0000FF ?
Because, what you're saying now is just to create a textdraw and then just use TextDrawSetString, yes? That's what I did in code above (previous post).
Posts: 375
Threads: 104
Joined: Nov 2011
Reputation:
0
i want a red textdraw but i want it to change its colour when hovering over.
And hover effect doesnt work when using a colour formatting...
I just thought mabye the colour/text formatting is processed differently on textdraw creation then when it is when youre using TextDrawSetString...
Posts: 1,767
Threads: 124
Joined: Mar 2010
No. But, did it worked when you setted textdraw color to red by DEFAULT? Not by using TextDrawSetString? Because that might/should actually work. Only in case you want that textdraw to be ALWAYS red (but you can change its color by using TextDrawSetString to blue or something, but not using ~r~ for it again).
Posts: 375
Threads: 104
Joined: Nov 2011
Reputation:
0
that was the first thing i tried. Didnt work, what lead me to my latest experiments...
And yes, i also tried other colours.
Posts: 1,767
Threads: 124
Joined: Mar 2010
Quote:
Originally Posted by PawnoQ
that was the first thing i tried. Didnt work, what lead me to my latest experiments...
And yes, i also tried other colours.
|
Huh? How sure you're? I've did a test right now, and here is the result:
http://bankfotek.pl/image/1668959
As you may see, it works perfect. Left image is when I am hovering text, right is when I am not hovering it.
Posts: 375
Threads: 104
Joined: Nov 2011
Reputation:
0
what did you do, use some black magic? :P
I did try around for so long and never was able to get hover effect when i used a colour on my textdraw.
Can u give me the code pls.
Posts: 1,767
Threads: 124
Joined: Mar 2010
He? I've told you already, make your textdraw RED by DEFAULT (TextDrawColor)
pawn Код:
gTextDraw = TextDrawCreate(10.000000, 141.000000, "MyTextDraw");
TextDrawTextSize(gTextDraw,60.000000, 20.000000);
TextDrawAlignment(gTextDraw,0);
TextDrawBackgroundColor(gTextDraw,0x000000ff);
TextDrawFont(gTextDraw,1);
TextDrawLetterSize(gTextDraw,0.250000, 1.000000);
TextDrawColor(gTextDraw, 0xFF0000FF);
TextDrawSetProportional(gTextDraw,1);
TextDrawSetShadow(gTextDraw,1);
TextDrawSetSelectable(gTextDraw, 1);
And just use different color for hovering? not red.