Use CLAMP from glib in Stylus_Move.

This commit is contained in:
riccardom 2009-04-11 14:42:15 +00:00
parent 30c0e56fc9
commit 80ebb0dcd5
1 changed files with 2 additions and 11 deletions

View File

@ -951,17 +951,8 @@ static gboolean Stylus_Move(GtkWidget *w, GdkEventMotion *e, gpointer data)
scaled_y -= 192; scaled_y -= 192;
} }
if(scaled_y >= 0 && (state & GDK_BUTTON1_MASK)) { if(scaled_y >= 0 && (state & GDK_BUTTON1_MASK)) {
EmuX = scaled_x; EmuX = CLAMP(scaled_x, 0, 255);
EmuY = scaled_y; EmuY = CLAMP(scaled_y, 0, 192);
if(EmuX<0)
EmuX = 0;
else if(EmuX>255)
EmuX = 255;
if(EmuY<0)
EmuY = 0;
else if(EmuY>192)
EmuY = 192;
NDS_setTouchPos(EmuX, EmuY); NDS_setTouchPos(EmuX, EmuY);
} }
} }