Legacy GM How to change text colour on mouse enter?

T

TheTygrysekPL

Guest
I tried to put "draw_set_colour(c_red)" in mouse enter event but it does not work.

Can someone help me?
 

Llama_Code

Member
You can only set drawing functions in the draw event, so you would need to check for the mouse enter there and change the color

You could make variable on create, and on mouse enter change that variable, in the draw event check the value of the variable and draw the appropriate color

Like

Create
Code:
 tcolor = 0;
Mouse enter event
Code:
 tcolor = 1;
Draw event
Code:
if (tcolor == 1)
{
draw_set_colour(c_red) ;
}
else
{
draw_set_colour(c_black) ;
}
 
Last edited:
T

TheTygrysekPL

Guest
You can only set drawing functions in the draw event, so you would need to check for the mouse enter there and change the color

You could make variable on create, and on mouse enter change that variable, in the draw event check the value of the variable and draw the appropriate color

Like

Create
Code:
 tcolor = 0;
Mouse enter event
Code:
 tcolor = 1;
Draw event
Code:
if (tcolor == 1)
{
draw_set_colour(c_red) ;
}
else
{
draw_set_colour(c_black) ;
}
Thanks man
 
A

Aura

Guest
@Llama_Code: You can use the draw_set_*() functions outside the Draw event. What he may have done wrong is resetting the draw colour to c_black in the Draw event. Either way, use of a variable is still recommended.
 
  • Like
Reactions: Sam
Top