Z
zendraw
Guest
when i try to move the view with this code
the view shuld get dragged around, and it does. but the problem is that it stutters as if it wants to be in two places at once. and this has somthing to do with moving the view itself and mouse_x/y becouse when i look at the xdrag-mouse_x, without applying the code in if (mbm) the value calculates normally, but if i run the code in if (mbm) the value constantly shifts betwean two values, making the screen stutter.
mbm is mouse_check_button and mbm_p is mouse_check_button_pressed.
any idea how to fix this?
Code:
//move view------------------------------------------------------
if (mbm_p)
{
xdrag=floor(mouse_x);
ydrag=floor(mouse_y);
xview=floor(view_xview);
yview=floor(view_yview);
}
if (mbm)
{
view_xview=clamp(xview+floor(xdrag-mouse_x), 0, room_width-view_wview);
view_yview=clamp(yview+floor(ydrag-mouse_y), 0, room_height-view_hview);
}
mbm is mouse_check_button and mbm_p is mouse_check_button_pressed.
any idea how to fix this?