From 80ebb0dcd54f346a1a755b228a8322d37638146d Mon Sep 17 00:00:00 2001 From: riccardom Date: Sat, 11 Apr 2009 14:42:15 +0000 Subject: [PATCH] Use CLAMP from glib in Stylus_Move. --- desmume/src/gtk/main.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/desmume/src/gtk/main.cpp b/desmume/src/gtk/main.cpp index b02a4c88a..b1cb7edf2 100644 --- a/desmume/src/gtk/main.cpp +++ b/desmume/src/gtk/main.cpp @@ -951,17 +951,8 @@ static gboolean Stylus_Move(GtkWidget *w, GdkEventMotion *e, gpointer data) scaled_y -= 192; } if(scaled_y >= 0 && (state & GDK_BUTTON1_MASK)) { - EmuX = scaled_x; - EmuY = scaled_y; - - if(EmuX<0) - EmuX = 0; - else if(EmuX>255) - EmuX = 255; - if(EmuY<0) - EmuY = 0; - else if(EmuY>192) - EmuY = 192; + EmuX = CLAMP(scaled_x, 0, 255); + EmuY = CLAMP(scaled_y, 0, 192); NDS_setTouchPos(EmuX, EmuY); } }