I have the following piece of code in the Draw event:
Here, mouse_region is a script with the following code:var tt;
tt = "None"
if mouse_region(200, 100, 400, 150) {
draw_set_color(c_blue)
tt = "Blue"
}
else {
draw_set_color(c_red)
tt = "Red"
}
draw_rectangle(200, 100, 400, 150, true)
draw_text(250, 120, tt)
draw_text(10, 300, "mouse_x: " + string(mouse_x))
draw_text(10, 320, "mouse_y: " + string(mouse_y))
So this return whether the mouse is in the given coordinate rectangle.//mouse_region(x1, y1, x2, y2)
return (mouse_x >= argument0 xor mouse_x > argument2)
and (mouse_y >= argument1 xor mouse_y > argument3)
I set the target to Windows and press Run in debug mode. I get an exe that gets run and indeed, whenever the mouse is within the given rectangle it turns blue and the text in variable tt changes accordingly, and the two mouse variables are visible on the screen.
I set the target to HTML and press Run in debug mode. I get a browser window. However whatever I do with the mouse, the rectangle and text stay red. The strangest thing is that the the two mouse variables are visible on the screen and are updated (as long as the mouse is within the room). So why does this script not work in a browser, while it does in a Windows executable?
EDIT
When I change the mouse_region script code into
it works as it should. Is the xor operator bugging out?//mouse_region(x1, y1, x2, y2)
return mouse_x >= argument0
and mouse_x <= argument2
and mouse_y >= argument1
and mouse_y <= argument3
Edit
When I change the mouse_region script code into
it works as it should too. My only conclusion is that the order of operations is different on HTML5 than on .exe. Why? Is this intended behavior, or a bug?//mouse_region(x1, y1, x2, y2)
return ((mouse_x >= argument0) xor (mouse_x > argument2))
and ((mouse_y >= argument1) xor (mouse_y > argument3))
Edited by Erik Leppen, 28 February 2012 - 06:41 PM.











