GML Drawn Button Origin?

Z

ZanyMechanism

Guest
This is my first post. Hiiiiii! Whenever I try to create this and put the position x=room_width/2 and y=room_width/2, it's not on the center. Please help, here's my code
Code:
draw_rectangle_colour((x-(buttonWidth/2))-2,(y-(buttonHeight/2))-2,(x+(buttonWidth/2))+2,(y+(buttonHeight/2))+7,c_white,c_white,c_white,c_white,0)
Thanks in Advance
 
F

Fodderbot

Guest
Its because you need to get room height instead of width for y (room_height)

skip that I just read your code block, I was going on the description

Are you making an adjustment for the x,y position of the button being in the upper left corner?

you need to adjust for both the room and the button offsets
 
Top