summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2008-06-06 18:29:46 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2008-06-06 18:29:46 +0000
commite1753de41af9149b09fbacc6ac16515747d0b1f3 (patch)
tree82d98883cabd5fc4e4ea40398a0325d87ace27e8
parentf9bf137b67d16a03100e392ab2171ae4a0ec0bba (diff)
downloadrockbox-e1753de41af9149b09fbacc6ac16515747d0b1f3.tar.gz
rockbox-e1753de41af9149b09fbacc6ac16515747d0b1f3.zip
1) Implement generic touchscreen detection library for the plugins
2) Adapt minesweeper, pegbox & calculator to it 3) Simplify gui/bitmap/list.c git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17695 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/bitmap/list.c14
-rw-r--r--apps/plugins/calculator.c34
-rw-r--r--apps/plugins/lib/SOURCES3
-rw-r--r--apps/plugins/lib/touchscreen.c133
-rw-r--r--apps/plugins/lib/touchscreen.h90
-rw-r--r--apps/plugins/minesweeper.c40
-rw-r--r--apps/plugins/pegbox.c80
7 files changed, 382 insertions, 12 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index bf0d22df32..abae87e3b5 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -344,20 +344,12 @@ unsigned gui_synclist_do_touchpad(struct gui_synclist * gui_list, struct viewpor
344 if (y > list_text[SCREEN_MAIN].y) 344 if (y > list_text[SCREEN_MAIN].y)
345 { 345 {
346 int i, line_height, actual_y; 346 int i, line_height, actual_y;
347
347 actual_y = y - list_text[SCREEN_MAIN].y; 348 actual_y = y - list_text[SCREEN_MAIN].y;
348 line_height = font_get(parent->font)->height; 349 line_height = font_get(parent->font)->height;
349 line = -1; 350 line = actual_y / line_height;
350 for(i=0; i<gui_list->nb_items; i++)
351 {
352 if(actual_y > line_height*i && actual_y < line_height*(i+1))
353 {
354 line = i;
355 break;
356 }
357 }
358 351
359 /* Something went wrong during line detection... */ 352 if(actual_y%line_height == 0) /* Pressed a border */
360 if(line == -1)
361 return ACTION_NONE; 353 return ACTION_NONE;
362 354
363 if (line != gui_list->selected_item - gui_list->start_item[SCREEN_MAIN] && button ^ BUTTON_REL) 355 if (line != gui_list->selected_item - gui_list->start_item[SCREEN_MAIN] && button ^ BUTTON_REL)
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c
index 47facaadf4..8628d816d4 100644
--- a/apps/plugins/calculator.c
+++ b/apps/plugins/calculator.c
@@ -288,6 +288,9 @@ PLUGIN_HEADER
288#ifndef CALCULATOR_CLEAR 288#ifndef CALCULATOR_CLEAR
289#define CALCULATOR_CLEAR BUTTON_TOPRIGHT 289#define CALCULATOR_CLEAR BUTTON_TOPRIGHT
290#endif 290#endif
291
292#include "lib/touchscreen.h"
293static struct ts_raster calc_raster = { X_0_POS, Y_1_POS, BUTTON_COLS*REC_WIDTH, BUTTON_ROWS*REC_HEIGHT, REC_WIDTH, REC_HEIGHT };
291#endif 294#endif
292 295
293static const struct plugin_api* rb; 296static const struct plugin_api* rb;
@@ -1547,6 +1550,37 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
1547 1550
1548 while (calStatus != cal_exit ) { 1551 while (calStatus != cal_exit ) {
1549 btn = rb->button_get_w_tmo(HZ/2); 1552 btn = rb->button_get_w_tmo(HZ/2);
1553#ifdef HAVE_TOUCHPAD
1554 if(btn & BUTTON_TOUCHPAD)
1555 {
1556 struct ts_raster_result res;
1557 if(touchscreen_map_raster(&calc_raster, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff, &res) == 1)
1558 {
1559 btn_row = res.y;
1560 btn_col = res.x;
1561 drawButtons(buttonGroup);
1562 drawLines();
1563
1564 rb->lcd_update();
1565
1566 prev_btn_row = btn_row;
1567 prev_btn_col = btn_col;
1568 if(btn & BUTTON_REL)
1569 {
1570 btn = CALCULATOR_INPUT;
1571 switch(buttonGroup){
1572 case basicButtons:
1573 basicButtonsProcess();
1574 break;
1575 case sciButtons:
1576 sciButtonsProcess();
1577 break;
1578 }
1579 btn = BUTTON_TOUCHPAD;
1580 }
1581 }
1582 }
1583#endif
1550 switch (btn) { 1584 switch (btn) {
1551 case CALCULATOR_INPUT: 1585 case CALCULATOR_INPUT:
1552 case CALCULATOR_CALC: 1586 case CALCULATOR_CALC:
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES
index 58074f500c..c5c3a25e26 100644
--- a/apps/plugins/lib/SOURCES
+++ b/apps/plugins/lib/SOURCES
@@ -39,3 +39,6 @@ bmp_smooth_scale.c
39#endif 39#endif
40pluginlib_actions.c 40pluginlib_actions.c
41helper.c 41helper.c
42#ifdef HAVE_TOUCHPAD
43touchscreen.c
44#endif
diff --git a/apps/plugins/lib/touchscreen.c b/apps/plugins/lib/touchscreen.c
new file mode 100644
index 0000000000..9acee9cbe8
--- /dev/null
+++ b/apps/plugins/lib/touchscreen.c
@@ -0,0 +1,133 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Copyright (C) 2008 by Maurus Cuelenaere
11*
12* All files in this archive are subject to the GNU General Public License.
13* See the file COPYING in the source tree root for full license agreement.
14*
15* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16* KIND, either express or implied.
17*
18****************************************************************************/
19
20#include "plugin.h"
21
22#ifdef HAVE_TOUCHPAD
23
24#include "touchscreen.h"
25
26unsigned int touchscreen_map(struct ts_mappings *map, int x, int y)
27{
28 int i;
29 for(i=0; i < map->amount; i++)
30 {
31 #define _MAP(x) (map->mappings[x])
32 if(x > _MAP(i).tl_x && x < (_MAP(i).tl_x+_MAP(i).width)
33 && y > _MAP(i).tl_y && y < (_MAP(i).tl_y+_MAP(i).height))
34 return i;
35 }
36
37 return -1;
38}
39
40unsigned int touchscreen_map_raster(struct ts_raster *map, int x, int y, struct ts_raster_result *result)
41{
42 int res1_x, res2_x, res1_y, res2_y;
43
44 if((x - map->tl_x) < 0 ||
45 (x - map->tl_x) > map->width)
46 return -1;
47 res1_x = (x - map->tl_x)/(map->raster_width);
48 res2_x = (x - map->tl_x)%(map->raster_width);
49
50 if((y - map->tl_y) < 0 ||
51 (y - map->tl_y) > map->height)
52 return -1;
53 res1_y = (y - map->tl_y)/(map->raster_height);
54 res2_y = (y - map->tl_y)%(map->raster_height);
55
56 if(res2_x == 0 || res2_y == 0) /* pen hit a raster boundary */
57 return -2;
58 else
59 {
60 (*result).x = res1_x;
61 (*result).y = res1_y;
62 return 1;
63 }
64}
65
66struct ts_raster_button_result touchscreen_raster_map_button(struct ts_raster_button_mapping *map, int x, int y, int button)
67{
68 struct ts_raster_button_result ret = {0, {0, 0}, {0, 0}};
69 struct ts_raster_result tmp;
70
71 ret.action = TS_ACTION_NONE;
72 if(touchscreen_map_raster(map->raster, x, y, &tmp) != 1)
73 return ret;
74
75 #define NOT_HANDLED (ret.action == TS_ACTION_NONE)
76 if((button == BUTTON_REPEAT) && (map->_prev_btn_state != BUTTON_REPEAT) && map->drag_drop_enable)
77 {
78 map->_prev_x = tmp.x;
79 map->_prev_y = tmp.y;
80 }
81 if((button == BUTTON_REL) && (map->_prev_btn_state == BUTTON_REPEAT) && map->drag_drop_enable)
82 {
83 ret.action = TS_ACTION_DRAG_DROP;
84 ret.from.x = map->_prev_x;
85 ret.from.y = map->_prev_y;
86 ret.to.x = tmp.x;
87 ret.to.y = tmp.y;
88 }
89 if((button == BUTTON_REL) && map->double_click_enable && NOT_HANDLED)
90 {
91 if(map->_prev_x == tmp.x && map->_prev_y == tmp.y)
92 {
93 ret.action = TS_ACTION_DOUBLE_CLICK;
94 ret.from.x = ret.to.x = tmp.x;
95 ret.from.y = ret.to.y = tmp.y;
96 }
97 else
98 {
99 map->_prev_x = tmp.x;
100 map->_prev_y = tmp.y;
101 }
102 }
103 if((button & BUTTON_REL || button & BUTTON_REPEAT) && map->two_d_movement_enable && NOT_HANDLED)
104 {
105 if((map->two_d_from.x == tmp.x) ^ (map->two_d_from.y == tmp.y))
106 {
107 ret.action = TS_ACTION_TWO_D_MOVEMENT;
108 ret.from.x = map->two_d_from.x;
109 ret.from.y = map->two_d_from.y;
110 ret.to.x = map->two_d_from.x + (map->two_d_from.x == tmp.x ? 0 : (tmp.x > map->two_d_from.x ? 1 : -1));
111 ret.to.y = map->two_d_from.y + (map->two_d_from.y == tmp.y ? 0 : (tmp.y > map->two_d_from.y ? 1 : -1));
112 }
113 else
114 ret.action = TS_ACTION_NONE;
115 }
116 if(map->click_enable && (button & BUTTON_REL) && NOT_HANDLED)
117 {
118 ret.action = TS_ACTION_CLICK;
119 ret.from.x = ret.to.x = tmp.x;
120 ret.from.y = ret.to.y = tmp.y;
121 }
122 if(map->move_progress_enable && NOT_HANDLED)
123 {
124 ret.action = TS_ACTION_MOVE;
125 ret.from.x = ret.to.x = tmp.x;
126 ret.from.y = ret.to.y = tmp.y;
127 }
128
129 map->_prev_btn_state = button;
130 return ret;
131}
132
133#endif /* HAVE_TOUCHPAD */
diff --git a/apps/plugins/lib/touchscreen.h b/apps/plugins/lib/touchscreen.h
new file mode 100644
index 0000000000..e7bc0004cc
--- /dev/null
+++ b/apps/plugins/lib/touchscreen.h
@@ -0,0 +1,90 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Copyright (C) 2008 by Maurus Cuelenaere
11*
12* All files in this archive are subject to the GNU General Public License.
13* See the file COPYING in the source tree root for full license agreement.
14*
15* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16* KIND, either express or implied.
17*
18****************************************************************************/
19
20#ifndef _PLUGIN_LIB_TOUCHSCREEN_H_
21#define _PLUGIN_LIB_TOUCHSCREEN_H_
22
23#ifdef HAVE_TOUCHPAD
24
25struct ts_mapping
26{
27 int tl_x; /* top left */
28 int tl_y;
29 int width;
30 int height;
31};
32
33struct ts_mappings
34{
35 struct ts_mapping *mappings;
36 int amount;
37};
38
39unsigned int touchscreen_map(struct ts_mappings *map, int x, int y);
40
41struct ts_raster
42{
43 int tl_x; /* top left */
44 int tl_y;
45 int width;
46 int height;
47 int raster_width;
48 int raster_height;
49};
50
51struct ts_raster_result
52{
53 int x;
54 int y;
55};
56
57unsigned int touchscreen_map_raster(struct ts_raster *map, int x, int y, struct ts_raster_result *result);
58
59struct ts_raster_button_mapping
60{
61 struct ts_raster *raster;
62 bool drag_drop_enable; /* ... */
63 bool double_click_enable; /* ... */
64 bool click_enable; /* ... */
65 bool move_progress_enable; /* ... */
66 bool two_d_movement_enable; /* ... */
67 struct ts_raster_result two_d_from; /* ... */
68 int _prev_x; /* Internal: DO NOT MODIFY! */
69 int _prev_y; /* Internal: DO NOT MODIFY! */
70 int _prev_btn_state; /* Internal: DO NOT MODIFY! */
71};
72
73struct ts_raster_button_result
74{
75 enum{
76 TS_ACTION_NONE,
77 TS_ACTION_MOVE,
78 TS_ACTION_CLICK,
79 TS_ACTION_DOUBLE_CLICK,
80 TS_ACTION_DRAG_DROP,
81 TS_ACTION_TWO_D_MOVEMENT
82 } action;
83 struct ts_raster_result from;
84 struct ts_raster_result to;
85};
86
87struct ts_raster_button_result touchscreen_raster_map_button(struct ts_raster_button_mapping *map, int x, int y, int button);
88
89#endif /* HAVE_TOUCHPAD */
90#endif /* _PLUGIN_LIB_TOUCHSCREEN_H_ */
diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c
index 7b1587ce6f..75a9330f47 100644
--- a/apps/plugins/minesweeper.c
+++ b/apps/plugins/minesweeper.c
@@ -303,6 +303,12 @@ int stack_pos = 0;
303/* a usefull string for snprintf */ 303/* a usefull string for snprintf */
304char str[30]; 304char str[30];
305 305
306#ifdef HAVE_TOUCHPAD
307
308#include "lib/touchscreen.h"
309static struct ts_raster mine_raster = { 0, 0, MAX_WIDTH, MAX_HEIGHT, TileSize, TileSize };
310#endif
311
306 312
307void push( int *stack, int y, int x ) 313void push( int *stack, int y, int x )
308{ 314{
@@ -477,6 +483,9 @@ void mine_show( void )
477 button = rb->button_get(true); 483 button = rb->button_get(true);
478 while( ( button == BUTTON_NONE ) 484 while( ( button == BUTTON_NONE )
479 || ( button & (BUTTON_REL|BUTTON_REPEAT) ) ); 485 || ( button & (BUTTON_REL|BUTTON_REPEAT) ) );
486#ifdef HAVE_TOUCHPAD
487 button = BUTTON_NONE;
488#endif
480} 489}
481 490
482int count_tiles_left( void ) 491int count_tiles_left( void )
@@ -570,6 +579,13 @@ enum minesweeper_status minesweeper( void )
570 */ 579 */
571 top = (LCD_HEIGHT-height*TileSize)/2; 580 top = (LCD_HEIGHT-height*TileSize)/2;
572 left = (LCD_WIDTH-width*TileSize)/2; 581 left = (LCD_WIDTH-width*TileSize)/2;
582
583#ifdef HAVE_TOUCHPAD
584 mine_raster.tl_x = left;
585 mine_raster.tl_y = top;
586 mine_raster.width = width*TileSize;
587 mine_raster.height = height*TileSize;
588#endif
573 589
574 rb->srand( *rb->current_tick ); 590 rb->srand( *rb->current_tick );
575 minesweeper_init(); 591 minesweeper_init();
@@ -614,7 +630,29 @@ enum minesweeper_status minesweeper( void )
614 /* update the screen */ 630 /* update the screen */
615 rb->lcd_update(); 631 rb->lcd_update();
616 632
617 switch( button = rb->button_get( true ) ) 633 button = rb->button_get(true);
634#ifdef HAVE_TOUCHPAD
635 if(button & BUTTON_TOUCHPAD)
636 {
637 struct ts_raster_result res;
638 if(touchscreen_map_raster(&mine_raster, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff, &res) == 1)
639 {
640 button &= ~BUTTON_TOUCHPAD;
641 lastbutton &= ~BUTTON_TOUCHPAD;
642
643 if(button & BUTTON_REPEAT && lastbutton != MINESWP_TOGGLE && lastbutton ^ BUTTON_REPEAT)
644 button = MINESWP_TOGGLE;
645 else if(button == BUTTON_REL && lastbutton ^ BUTTON_REPEAT)
646 button = MINESWP_DISCOVER;
647 else
648 button |= BUTTON_TOUCHPAD;
649
650 x = res.x;
651 y = res.y;
652 }
653 }
654#endif
655 switch(button)
618 { 656 {
619 /* quit minesweeper (you really shouldn't use this button ...) */ 657 /* quit minesweeper (you really shouldn't use this button ...) */
620#ifdef MINESWP_RC_QUIT 658#ifdef MINESWP_RC_QUIT
diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c
index ed58ac605d..f3a4f0e67c 100644
--- a/apps/plugins/pegbox.c
+++ b/apps/plugins/pegbox.c
@@ -368,6 +368,32 @@ PLUGIN_HEADER
368#define BOARD_Y 0 368#define BOARD_Y 0
369#endif 369#endif
370 370
371#ifdef HAVE_TOUCHPAD
372#include "lib/touchscreen.h"
373
374static struct ts_mapping main_menu_items[5] =
375{
376{(LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2, BMPHEIGHT_pegbox_menu_top, BMPWIDTH_pegbox_menu_items, (BMPHEIGHT_pegbox_menu_items/9)},
377{(LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2, BMPHEIGHT_pegbox_menu_top+(BMPHEIGHT_pegbox_menu_items/9), BMPWIDTH_pegbox_menu_items, (BMPHEIGHT_pegbox_menu_items/9)},
378{(LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2, BMPHEIGHT_pegbox_menu_top+(BMPHEIGHT_pegbox_menu_items/9)*2, BMPWIDTH_pegbox_menu_items, (BMPHEIGHT_pegbox_menu_items/9)},
379{(LCD_WIDTH-BMPWIDTH_pegbox_menu_items)/2, BMPHEIGHT_pegbox_menu_top+(BMPHEIGHT_pegbox_menu_items/9)*3, BMPWIDTH_pegbox_menu_items, (BMPHEIGHT_pegbox_menu_items/9)},
380{
381#if (LCD_WIDTH >= 138) && (LCD_HEIGHT >= 110)
3820, BMPHEIGHT_pegbox_menu_top+4*(BMPHEIGHT_pegbox_menu_items/9)+8, SYSFONT_WIDTH*28, SYSFONT_HEIGHT
383#elif LCD_WIDTH > 112
3840, LCD_HEIGHT - 8, SYSFONT_WIDTH*28, SYSFONT_HEIGHT
385#else
386#error "Touchpad isn't supported on non-bitmap screens!"
387#endif
388}
389
390};
391static struct ts_mappings main_menu = {main_menu_items, 5};
392
393static struct ts_raster pegbox_raster = { BOARD_X, BOARD_Y, COLS*BMPWIDTH_pegbox_pieces, ROWS*BMPWIDTH_pegbox_pieces, BMPWIDTH_pegbox_pieces, BMPWIDTH_pegbox_pieces };
394static struct ts_raster_button_mapping pegbox_raster_btn = { &pegbox_raster, false, false, true, false, true, {0, 0}, 0, 0, 0 };
395#endif
396
371struct game_context { 397struct game_context {
372 unsigned int level; 398 unsigned int level;
373 unsigned int highlevel; 399 unsigned int highlevel;
@@ -612,6 +638,9 @@ static void display_text(char *str, bool waitkey)
612 key = rb->button_get(true); 638 key = rb->button_get(true);
613 switch (key) 639 switch (key)
614 { 640 {
641#ifdef HAVE_TOUCHPAD
642 case BUTTON_TOUCHPAD:
643#endif
615 case PEGBOX_QUIT: 644 case PEGBOX_QUIT:
616 case PEGBOX_LEFT: 645 case PEGBOX_LEFT:
617 case PEGBOX_DOWN: 646 case PEGBOX_DOWN:
@@ -738,6 +767,28 @@ static void new_piece(struct game_context* pb, unsigned int x_loc,
738 while (!exit) { 767 while (!exit) {
739 draw_board(pb); 768 draw_board(pb);
740 button = rb->button_get(true); 769 button = rb->button_get(true);
770#ifdef HAVE_TOUCHPAD
771 if(button & BUTTON_TOUCHPAD)
772 {
773 pegbox_raster_btn.two_d_from.y = x_loc;
774 pegbox_raster_btn.two_d_from.x = y_loc;
775
776 struct ts_raster_button_result ret = touchscreen_raster_map_button(&pegbox_raster_btn, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff, button);
777 if(ret.action == TS_ACTION_TWO_D_MOVEMENT)
778 {
779 if(ret.to.x > ret.from.x)
780 button = PEGBOX_UP;
781 else if(ret.to.x < ret.from.x)
782 button = PEGBOX_DOWN;
783 else if(ret.to.y > ret.from.y)
784 button = PEGBOX_LEFT;
785 else if(ret.to.y < ret.from.y)
786 button = PEGBOX_RIGHT;
787 }
788 else if(ret.action == TS_ACTION_CLICK && (unsigned)ret.to.x == y_loc && (unsigned)ret.to.y == x_loc)
789 button = PEGBOX_SAVE;
790 }
791#endif
741 switch(button){ 792 switch(button){
742 case PEGBOX_LEFT: 793 case PEGBOX_LEFT:
743 case (PEGBOX_LEFT|BUTTON_REPEAT): 794 case (PEGBOX_LEFT|BUTTON_REPEAT):
@@ -1053,6 +1104,24 @@ static unsigned int pegbox_menu(struct game_context* pb) {
1053 1104
1054 /* handle menu button presses */ 1105 /* handle menu button presses */
1055 button = rb->button_get(true); 1106 button = rb->button_get(true);
1107
1108#ifdef HAVE_TOUCHPAD
1109 if(button & BUTTON_TOUCHPAD)
1110 {
1111 unsigned int result = touchscreen_map(&main_menu, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff);
1112 if(result != (unsigned)-1 && button & BUTTON_REL)
1113 {
1114 if(result == 4)
1115 button = PEGBOX_LVL_UP;
1116 else
1117 {
1118 if(loc == result)
1119 button = PEGBOX_RIGHT;
1120 loc = result;
1121 }
1122 }
1123 }
1124#endif
1056 1125
1057 switch(button) { 1126 switch(button) {
1058 case PEGBOX_SAVE: /* start playing */ 1127 case PEGBOX_SAVE: /* start playing */
@@ -1169,6 +1238,17 @@ static int pegbox(struct game_context* pb) {
1169 1238
1170 while (true) { 1239 while (true) {
1171 temp_var = rb->button_get(true); 1240 temp_var = rb->button_get(true);
1241#ifdef HAVE_TOUCHPAD
1242 if(temp_var & BUTTON_TOUCHPAD)
1243 {
1244 pegbox_raster_btn.two_d_from.y = pb->player_row;
1245 pegbox_raster_btn.two_d_from.x = pb->player_col;
1246
1247 struct ts_raster_button_result ret = touchscreen_raster_map_button(&pegbox_raster_btn, rb->button_get_data() >> 16, rb->button_get_data() & 0xffff, temp_var);
1248 if(ret.action == TS_ACTION_TWO_D_MOVEMENT)
1249 move_player(pb, ret.to.x - ret.from.x, ret.to.y - ret.from.y);
1250 }
1251#endif
1172 switch(temp_var){ 1252 switch(temp_var){
1173 case PEGBOX_LEFT: /* move cursor left */ 1253 case PEGBOX_LEFT: /* move cursor left */
1174 case (PEGBOX_LEFT|BUTTON_REPEAT): 1254 case (PEGBOX_LEFT|BUTTON_REPEAT):