Joysurrender
Member
Hello,
I have a button that has variable caption (basically is a text inside a rectangle).
I'll post the code in order to make you understand better than words:
Object Button
Create object
Step event
Draw event
The fact is: the rectangle around the text is perfectly drawn, while the clickable area is not working properly!
The last part of the button (on the right side) is not full clickable (and doesn't change color), it's like the text is smaller than how it appears on screen (even if the rectangle is correct).
How do I solve this?
An example screen:
PS: the more the text is long, the more the unclickable gap is big
PPS: the font I use is 16pt, if I use a 14pt font the problem doesn't sussist (while if I use a 12pt font I have the opposite problem)
I have a button that has variable caption (basically is a text inside a rectangle).
I'll post the code in order to make you understand better than words:
Object Button
Create object
GML:
txt = "Hello there"
c = c_ltgray
GML:
if point_in_rectangle(mouse_x,mouse_y,x,y,x+string_width(txt)+8,y+24) {
c = c_white;
window_set_cursor(cr_handpoint);
} else { c = c_ltgray; window_set_cursor(cr_default); }
GML:
draw_set_font(Font_Button)
draw_rectangle_color(x,y,x+string_width(txt)+8,y+24,c,c,c,c,1)
draw_text_color(x+4,y+2,string(txt),c,c,c,c,1)
The last part of the button (on the right side) is not full clickable (and doesn't change color), it's like the text is smaller than how it appears on screen (even if the rectangle is correct).
How do I solve this?
An example screen:
PS: the more the text is long, the more the unclickable gap is big
PPS: the font I use is 16pt, if I use a 14pt font the problem doesn't sussist (while if I use a 12pt font I have the opposite problem)
Last edited: