From 82223882526cb40b1e368f0fae60b5777577f48b Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 30 Jan 2012 00:17:47 +0100 Subject: [PATCH] reversi: Fix viewport initialization. Improve button layout for portrait. Enable for toucschreen RaaA. Change-Id: Ief0937693dc2056ed442f68a5ab76a006eaa1209 --- apps/plugins/SUBDIRS.app_build | 2 ++ apps/plugins/reversi/reversi-gui.c | 22 ++++++++-------------- apps/plugins/reversi/reversi-gui.h | 13 +++++++++++++ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/apps/plugins/SUBDIRS.app_build b/apps/plugins/SUBDIRS.app_build index e9f9253e82..934474a996 100644 --- a/apps/plugins/SUBDIRS.app_build +++ b/apps/plugins/SUBDIRS.app_build @@ -13,6 +13,8 @@ lua fft #endif +reversi + #ifdef HAVE_TAGCACHE pictureflow #endif diff --git a/apps/plugins/reversi/reversi-gui.c b/apps/plugins/reversi/reversi-gui.c index e6613d6a25..e59a91e341 100644 --- a/apps/plugins/reversi/reversi-gui.c +++ b/apps/plugins/reversi/reversi-gui.c @@ -167,14 +167,14 @@ static bool game_finished; #define B_QUIT_H (LCD_HEIGHT/4) #else /* Define Menu button x, y, width, height */ -#define B_MENU_X (LCD_WIDTH/2) +#define B_MENU_X (LCD_WIDTH/2 - XOFS) #define B_MENU_Y (CELL_HEIGHT*BOARD_SIZE+YOFS*2) -#define B_MENU_W (LCD_WIDTH/4) +#define B_MENU_W (LCD_WIDTH/4 - XOFS) #define B_MENU_H (2*CELL_HEIGHT) /* Define Quit Button x, y, width, height */ -#define B_QUIT_X (LCD_WIDTH-LCD_WIDTH/4) +#define B_QUIT_X (B_MENU_X + B_MENU_W + 1) #define B_QUIT_Y (CELL_HEIGHT*BOARD_SIZE+YOFS*2) -#define B_QUIT_W (LCD_WIDTH/4) +#define B_QUIT_W (LCD_WIDTH/4 - XOFS) #define B_QUIT_H (2*CELL_HEIGHT) #endif @@ -316,22 +316,16 @@ static void reversi_gui_display_board(void) { y = LEGEND_Y(0); reversi_gui_draw_cell(x, y+(LEGEND_Y(1)-LEGEND_Y(0))/2-CELL_WIDTH/2, BLACK); rb->snprintf(buf, sizeof(buf), "%01d", c); + + rb->viewport_set_defaults(&tempvp, SCREEN_MAIN); tempvp.x=x+CELL_WIDTH+2; tempvp.y=y; tempvp.width=LCD_WIDTH-tempvp.x; tempvp.height=LEGEND_Y(1); - - tempvp.font=FONT_UI; - tempvp.drawmode=STYLE_DEFAULT; #if LCD_DEPTH > 1 - tempvp.fg_pattern=0; - tempvp.bg_pattern=0xFFFF; -#ifdef HAVE_LCD_COLOR - tempvp.lss_pattern=0; - tempvp.lse_pattern=0; - tempvp.lst_pattern=0; -#endif + tempvp.fg_pattern = LCD_BLACK; + tempvp.bg_pattern = LCD_WHITE; #endif rb->screens[SCREEN_MAIN]->set_viewport(&tempvp); diff --git a/apps/plugins/reversi/reversi-gui.h b/apps/plugins/reversi/reversi-gui.h index c0d6183c2f..60b35d94e2 100644 --- a/apps/plugins/reversi/reversi-gui.h +++ b/apps/plugins/reversi/reversi-gui.h @@ -208,6 +208,19 @@ #elif CONFIG_KEYPAD == ONDAVX777_PAD #define REVERSI_BUTTON_QUIT BUTTON_POWER +#elif CONFIG_KEYPAD == ANDROID_PAD +#define REVERSI_BUTTON_QUIT BUTTON_BACK +#define REVERSI_BUTTON_MENU BUTTON_MENU + +#elif CONFIG_KEYPAD == SDL_PAD +#define REVERSI_BUTTON_QUIT BUTTON_BACK +#define REVERSI_BUTTON_UP BUTTON_UP +#define REVERSI_BUTTON_DOWN BUTTON_DOWN +#define REVERSI_BUTTON_LEFT BUTTON_LEFT +#define REVERSI_BUTTON_RIGHT BUTTON_RIGHT +#define REVERSI_BUTTON_MAKE_MOVE BUTTON_SELECT +#define REVERSI_BUTTON_MENU BUTTON_MENU + #elif CONFIG_KEYPAD == SAMSUNG_YH_PAD #define REVERSI_BUTTON_QUIT BUTTON_REC #define REVERSI_BUTTON_UP BUTTON_UP -- 2.11.4.GIT