|
From: <ric...@us...> - 2010-05-09 15:42:48
|
Revision: 3611
http://desmume.svn.sourceforge.net/desmume/?rev=3611&view=rev
Author: riccardom
Date: 2010-05-09 15:42:40 +0000 (Sun, 09 May 2010)
Log Message:
-----------
Cleanup the code a bit, make some loops more natural and
merge two duplicate functions.
Again the compiler does not care about the changes :)
Modified Paths:
--------------
trunk/desmume/src/ctrlssdl.cpp
Modified: trunk/desmume/src/ctrlssdl.cpp
===================================================================
--- trunk/desmume/src/ctrlssdl.cpp 2010-05-09 15:29:52 UTC (rev 3610)
+++ trunk/desmume/src/ctrlssdl.cpp 2010-05-09 15:42:40 UTC (rev 3611)
@@ -181,9 +181,13 @@
u16 lookup_joy_key (u16 keyval) {
int i;
u16 Key = 0;
+
for(i = 0; i < NB_KEYS; i++)
- if(keyval == joypad_cfg[i]) break;
- if(i < NB_KEYS) Key = KEYMASK_(i);
+ if(keyval == joypad_cfg[i]) {
+ Key = KEYMASK_(i);
+ break;
+ }
+
return Key;
}
@@ -191,9 +195,13 @@
u16 lookup_key (u16 keyval) {
int i;
u16 Key = 0;
+
for(i = 0; i < NB_KEYS; i++)
- if(keyval == keyboard_cfg[i]) break;
- if(i < NB_KEYS) Key = KEYMASK_(i);
+ if(keyval == keyboard_cfg[i]) {
+ Key = KEYMASK_(i);
+ break;
+ }
+
return Key;
}
@@ -272,19 +280,10 @@
}
static signed long
-screen_to_touch_range_x( signed long scr_x, float size_ratio) {
- signed long touch_x = (signed long)((float)scr_x * size_ratio);
-
- return touch_x;
+screen_to_touch_range( signed long scr, float size_ratio) {
+ return (signed long)((float)scr * size_ratio);
}
-static signed long
-screen_to_touch_range_y( signed long scr_y, float size_ratio) {
- signed long touch_y = (signed long)((float)scr_y * size_ratio);
-
- return touch_y;
-}
-
/* Set mouse coordinates */
void set_mouse_coord(signed long x,signed long y)
{
@@ -554,10 +553,10 @@
break;
else {
signed long scaled_x =
- screen_to_touch_range_x( event.button.x,
+ screen_to_touch_range( event.button.x,
cfg->nds_screen_size_ratio);
signed long scaled_y =
- screen_to_touch_range_y( event.button.y,
+ screen_to_touch_range( event.button.y,
cfg->nds_screen_size_ratio);
if( scaled_y >= 192)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|