Jump to content


Photo

Unexplicable mouse hover bug


  • Please log in to reply
1 reply to this topic

#1 Erik Leppen

Erik Leppen

    GMC Member

  • GMC Member
  • 2038 posts
  • Version:GM:Studio

Posted 28 February 2012 - 06:15 PM

I just got GMHTML5 and am now testing out stuff. Strangely I run into a weird bug right away.

I have the following piece of code in the Draw event:

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))

Here, mouse_region is a script with the following code:

//mouse_region(x1, y1, x2, y2)
return (mouse_x >= argument0 xor mouse_x > argument2)
and (mouse_y >= argument1 xor mouse_y > argument3)

So this return whether the mouse is in the given coordinate rectangle.


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

//mouse_region(x1, y1, x2, y2)
return mouse_x >= argument0
and mouse_x <= argument2
and mouse_y >= argument1
and mouse_y <= argument3

it works as it should. Is the xor operator bugging out?

Edit
When I change the mouse_region script code into

//mouse_region(x1, y1, x2, y2)
return ((mouse_x >= argument0) xor (mouse_x > argument2))
and ((mouse_y >= argument1) xor (mouse_y > argument3))

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?

Edited by Erik Leppen, 28 February 2012 - 06:41 PM.

  • 0

#2 rwkay

rwkay

    YoYo Games CTO

  • YoYo Games Staff
  • 1415 posts
  • Version:Unknown

Posted 28 February 2012 - 08:24 PM

Sounds like a bug... please file a report and I will take a look, after GDC.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users