本文整理汇总了C++中draw_progress_locked函数的典型用法代码示例。如果您正苦于以下问题:C++ draw_progress_locked函数的具体用法?C++ draw_progress_locked怎么用?C++ draw_progress_locked使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了draw_progress_locked函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_background_locked
// Redraw everything on the screen. Does not flip pages.
// Should only be called with updateMutex locked.
void ScreenRecoveryUI::draw_screen_locked() {
if (!show_text) {
draw_background_locked(currentIcon);
draw_progress_locked();
} else {
gr_color(0, 0, 0, 255);
gr_clear();
int y = 0;
if (show_menu) {
char recovery_fingerprint[PROPERTY_VALUE_MAX];
property_get("ro.bootimage.build.fingerprint", recovery_fingerprint, "");
SetColor(INFO);
DrawTextLine(&y, "Android Recovery", true);
for (auto& chunk : android::base::Split(recovery_fingerprint, ":")) {
DrawTextLine(&y, chunk.c_str(), false);
}
DrawTextLines(&y, HasThreeButtons() ? REGULAR_HELP : LONG_PRESS_HELP);
SetColor(HEADER);
DrawTextLines(&y, menu_headers_);
SetColor(MENU);
DrawHorizontalRule(&y);
y += 4;
for (int i = 0; i < menu_items; ++i) {
if (i == menu_sel) {
// Draw the highlight bar.
SetColor(IsLongPress() ? MENU_SEL_BG_ACTIVE : MENU_SEL_BG);
gr_fill(0, y - 2, gr_fb_width(), y + char_height + 2);
// Bold white text for the selected item.
SetColor(MENU_SEL_FG);
gr_text(4, y, menu_[i], true);
SetColor(MENU);
} else {
gr_text(4, y, menu_[i], false);
}
y += char_height + 4;
}
DrawHorizontalRule(&y);
}
// display from the bottom up, until we hit the top of the
// screen, the bottom of the menu, or we've displayed the
// entire text buffer.
SetColor(LOG);
int row = (text_top_ + text_rows_ - 1) % text_rows_;
size_t count = 0;
for (int ty = gr_fb_height() - char_height;
ty >= y && count < text_rows_;
ty -= char_height, ++count) {
gr_text(0, ty, text_[row], false);
--row;
if (row < 0) row = text_rows_ - 1;
}
}
}
示例2: draw_background_locked
// Redraw everything on the screen. Does not flip pages.
// Should only be called with updateMutex locked.
void ScreenRecoveryUI::draw_screen_locked()
{
if (!show_text) {
draw_background_locked(currentIcon);
draw_progress_locked();
// MStar Android Patch Begin
draw_top_title_locked();
draw_tip_title_locked(currentTip);
draw_exit_recovery_tip_title_locked(currentExitRecoveryTip);
// MStar Android Patch End
} else {
gr_color(0, 0, 0, 255);
gr_clear();
int y = 0;
int i = 0;
if (show_menu) {
SetColor(HEADER);
for (; i < menu_top + menu_items; ++i) {
if (i == menu_top) SetColor(MENU);
if (i == menu_top + menu_sel) {
// draw the highlight bar
SetColor(MENU_SEL_BG);
gr_fill(0, y-2, gr_fb_width(), y+char_height+2);
// white text of selected item
SetColor(MENU_SEL_FG);
if (menu[i][0]) gr_text(4, y, menu[i], 1);
SetColor(MENU);
} else {
if (menu[i][0]) gr_text(4, y, menu[i], i < menu_top);
}
y += char_height+4;
}
SetColor(MENU);
y += 4;
gr_fill(0, y, gr_fb_width(), y+2);
y += 4;
++i;
}
SetColor(LOG);
// display from the bottom up, until we hit the top of the
// screen, the bottom of the menu, or we've displayed the
// entire text buffer.
int ty;
int row = (text_top+text_rows-1) % text_rows;
for (int ty = gr_fb_height() - char_height, count = 0;
ty > y+2 && count < text_rows;
ty -= char_height, ++count) {
gr_text(4, ty, text[row], 0);
--row;
if (row < 0) row = text_rows-1;
}
}
}
示例3: draw_screen_locked
// Updates only the progress bar, if possible, otherwise redraws the screen.
// Should only be called with updateMutex locked.
void ScreenRecoveryUI::update_progress_locked() {
if (show_text || !pagesIdentical) {
draw_screen_locked(); // Must redraw the whole screen
pagesIdentical = true;
} else {
draw_progress_locked(); // Draw only the progress bar and overlays
}
gr_flip();
}
示例4: update_progress_locked
// Updates only the progress bar, if possible, otherwise redraws the screen.
// Should only be called with gUpdateMutex locked.
static void update_progress_locked(void)
{
if (show_text || !gPagesIdentical) {
draw_screen_locked(); // Must redraw the whole screen
gPagesIdentical = 1;
} else {
draw_progress_locked(); // Draw only the progress bar
}
gr_flip();
}
示例5: pthread_mutex_lock
void ScreenRecoveryUI::progress_loop() {
double interval = 1.0 / animation_fps;
for (;;) {
pthread_mutex_lock(&updateMutex);
if (progressBarType == EMPTY && !update_waiting)
pthread_cond_wait(&progressCondition, &updateMutex);
bool redraw = false;
double start = now();
LOGV("loop %f show_text=%d progressBarType=%d waiting=%d\n", start, show_text, progressBarType, update_waiting );
// update the installation animation, if active
// skip this if we have a text overlay (too expensive to update)
if ((currentIcon == INSTALLING_UPDATE || currentIcon == ERASING) &&
installing_frames > 0) {
installingFrame = (installingFrame + 1) % installing_frames;
redraw = true;
}
// move the progress bar forward on timed intervals, if configured
int duration = progressScopeDuration;
if (progressBarType == DETERMINATE && duration > 0) {
double elapsed = now() - progressScopeTime;
float p = 1.0 * elapsed / duration;
if (p > 1.0) p = 1.0;
if (p > progress) {
progress = p;
redraw = true;
}
}
if (update_waiting || !pagesIdentical) {
LOGV("call draw_screen_locked\n");
draw_screen_locked();
if (!update_waiting)
pagesIdentical = true;
}
if (redraw) {
LOGV("call draw_progress_locked\n");
draw_progress_locked();
}
gr_flip();
update_waiting = false;
pthread_mutex_unlock(&updateMutex);
double end = now();
// minimum of 20ms delay between frames
double delay = interval - (end-start);
if (delay < 0.02) delay = 0.02;
usleep((long)(delay * 1000000));
}
}
示例6: update_progress_locked
// Updates only the progress bar, if possible, otherwise redraws the screen.
// Should only be called with gUpdateMutex locked.
static void update_progress_locked(void)
{
if (!ui_has_initialized) return;
if (show_text || !gPagesIdentical) {
draw_screen_locked(); // Must redraw the whole screen
gPagesIdentical = 1;
} else {
draw_progress_locked(); // Draw only the progress bar and overlays
}
gr_flip();
}
示例7: draw_background_locked
// Redraw everything on the screen. Does not flip pages.
// Should only be called with updateMutex locked.
void ScreenRecoveryUI::draw_screen_locked()
{
draw_background_locked(currentIcon);
draw_progress_locked();
if (show_text) {
gr_color(0, 0, 0, 160);
gr_fill(0, 0, gr_fb_width(), gr_fb_height());
int i = 0;
if (show_menu) {
#ifndef VENDOR_EDIT
//[email protected], 2012/06/11, Modify for recovery font color
gr_color(64, 96, 255, 255);
#else /* VENDOR_EDIT */
gr_color(41, 198, 255, 255);
#endif /* VENDOR_EDIT */
gr_fill(0, (menu_top+menu_sel) * CHAR_HEIGHT,
gr_fb_width(), (menu_top+menu_sel+1)*CHAR_HEIGHT+1);
for (; i < menu_top + menu_items; ++i) {
if (i == menu_top + menu_sel) {
#ifndef VENDOR_EDIT
//[email protected], 2012/06/11, Modify for recovery font color
gr_color(255, 140, 0, 255);
draw_text_line(i, menu[i]);
gr_color(64, 96, 255, 255);
#else /* VENDOR_EDIT */
gr_color(255, 255, 255, 255);
draw_focus_text_line(i, menu[i]);
gr_color(255, 255, 60, 255);
#endif /* VENDOR_EDIT */
} else {
#ifndef VENDOR_EDIT
//[email protected], 2012/06/11, Modify for recovery font color
gr_color(255, 140, 0, 255);
#else /* VENDOR_EDIT */
gr_color(255, 230, 120, 255);
#endif /* VENDOR_EDIT */
draw_text_line(i, menu[i]);
}
}
gr_fill(0, i*CHAR_HEIGHT+CHAR_HEIGHT/2-1,
gr_fb_width(), i*CHAR_HEIGHT+CHAR_HEIGHT/2+1);
++i;
}
gr_color(240, 255, 240, 255); //wschen 2012-07-11
for (; i < text_rows; ++i) {
draw_text_line(i, text[(i+text_top) % text_rows]);
}
}
}
示例8: draw_screen_locked
// Redraw everything on the screen. Does not flip pages.
// Should only be called with gUpdateMutex locked.
static void draw_screen_locked(void)
{
if (!ui_has_initialized) return;
draw_background_locked(gCurrentIcon);
draw_progress_locked();
if (show_text) {
gr_color(0, 0, 0, 160);
gr_fill(0, 0, gr_fb_width(), gr_fb_height());
int i = 0;
int j = 0;
int row = 0; // current row that we are drawing on
if (show_menu) {
gr_color(MENU_TEXT_COLOR);
gr_fill(0, (menu_top + menu_sel - menu_show_start) * CHAR_HEIGHT,
gr_fb_width(), (menu_top + menu_sel - menu_show_start + 1)*CHAR_HEIGHT+1);
gr_color(HEADER_TEXT_COLOR);
for (i = 0; i < menu_top; ++i) {
draw_text_line(i, menu[i]);
row++;
}
if (menu_items - menu_show_start + menu_top >= MAX_ROWS)
j = MAX_ROWS - menu_top;
else
j = menu_items - menu_show_start;
gr_color(MENU_TEXT_COLOR);
for (i = menu_show_start + menu_top; i < (menu_show_start + menu_top + j); ++i) {
if (i == menu_top + menu_sel) {
gr_color(255, 255, 255, 255);
draw_text_line(i - menu_show_start , menu[i]);
gr_color(MENU_TEXT_COLOR);
} else {
gr_color(MENU_TEXT_COLOR);
draw_text_line(i - menu_show_start, menu[i]);
}
row++;
}
gr_fill(0, row*CHAR_HEIGHT+CHAR_HEIGHT/2-1,
gr_fb_width(), row*CHAR_HEIGHT+CHAR_HEIGHT/2+1);
}
gr_color(NORMAL_TEXT_COLOR);
for (; row < text_rows; ++row) {
draw_text_line(row, text[(row+text_top) % text_rows]);
}
}
}
示例9: draw_screen_locked
// Redraw everything on the screen. Does not flip pages.
// Should only be called with gUpdateMutex locked.
static void draw_screen_locked(void)
{
int cRv = 54;
int cGv = 74;
int cBv = 255;
draw_background_locked(gCurrentIcon);
draw_progress_locked();
if (show_text) {
gr_color(0, 0, 0, 160);
gr_fill(0, 0, gr_fb_width(), gr_fb_height());
int i = 0;
if (show_menu) {
gr_color(cRv,cGv,cBv,255);
gr_fill(0, (menu_top+menu_sel) * CHAR_HEIGHT,
gr_fb_width(), (menu_top+menu_sel+1)*CHAR_HEIGHT+1);
for (; i < menu_top + menu_items; ++i) {
if (i == menu_top + menu_sel) {
gr_color(255, 255, 255, 255);
draw_text_line(i, menu[i]);
gr_color(cRv,cGv,cBv,255);
} else {
draw_text_line(i, menu[i]);
}
}
gr_fill(0, i*CHAR_HEIGHT+CHAR_HEIGHT/2-1,
gr_fb_width(), i*CHAR_HEIGHT+CHAR_HEIGHT/2+1);
++i;
}
TEXTCOLOR
for (; i < text_rows; ++i) {
draw_text_line(i, text[(i+text_top) % text_rows]);
}
}
}
示例10: update_progress_locked
// Updates only the progress bar, if possible, otherwise redraws the screen.
// Should only be called with gUpdateMutex locked.
static void update_progress_locked(void) {
if (!ui_has_initialized)
return;
// set minimum delay between progress updates if we have a text overlay
// exception: gProgressScopeDuration != 0: to keep zip installer refresh behavior
struct timeval curtime;
gettimeofday(&curtime, NULL);
long delta_ms = delta_milliseconds(lastprogupd, curtime);
if (show_text && gProgressScopeDuration == 0 && lastprogupd.tv_sec > 0
&& delta_ms < UI_MIN_PROG_DELTA_MS) {
return;
}
if (show_text || !gPagesIdentical) {
draw_screen_locked(); // Must redraw the whole screen
gPagesIdentical = 1;
} else {
draw_progress_locked(); // Draw only the progress bar and overlays
}
gr_flip();
}
示例11: draw_background_locked
// Redraw everything on the screen. Does not flip pages.
// Should only be called with updateMutex locked.
void ScreenRecoveryUI::draw_screen_locked()
{
draw_background_locked(currentIcon);
draw_progress_locked();
if (show_text) {
gr_color(0, 0, 0, 160);
gr_fill(0, 0, gr_fb_width(), gr_fb_height());
int i = 0;
if (show_menu) {
gr_color(64, 96, 255, 255);
gr_fill(0, (menu_top+menu_sel) * CHAR_HEIGHT,
gr_fb_width(), (menu_top+menu_sel+1)*CHAR_HEIGHT+1);
for (; i < menu_top + menu_items; ++i) {
if (i == menu_top + menu_sel) {
gr_color(255, 255, 255, 255);
draw_text_line(i, menu[i]);
gr_color(64, 96, 255, 255);
} else {
draw_text_line(i, menu[i]);
}
}
gr_fill(0, i*CHAR_HEIGHT+CHAR_HEIGHT/2-1,
gr_fb_width(), i*CHAR_HEIGHT+CHAR_HEIGHT/2+1);
++i;
}
gr_color(255, 255, 0, 255);
for (; i < text_rows; ++i) {
draw_text_line(i, text[(i+text_top) % text_rows]);
}
}
}
示例12: draw_screen_locked
// Redraw everything on the screen. Does not flip pages.
// Should only be called with gUpdateMutex locked.
static void draw_screen_locked(void) {
if (!ui_has_initialized)
return;
draw_background_locked(gCurrentIcon);
draw_progress_locked();
if (show_text) {
int total_rows = (gr_fb_height() - virtualkey_h) / CHAR_HEIGHT;
int i = 0;
int j = 0;
int row = 0; // current row that we are drawing on
if (show_menu) {
int batt_level = 0;
char batt_text[40];
batt_level = get_batt_stats();
/*struct tm *current;
time_t now;
now = time(NULL); // add 2 hours
current = localtime(&now);
sprintf(batt_text, "[%d%% %02D:%02D]", batt_level, current->tm_hour, current->tm_min);
if (now == NULL)*/
sprintf(batt_text, " [%d%%]", batt_level);
gr_color(menuTextColor[0], menuTextColor[1], menuTextColor[2], menuTextColor[3]);
//gr_color(0, 255, 0, 255);
if (batt_level < 21)
gr_color(255, 0, 0, 255);
draw_text_line(0, batt_text, RIGHT_ALIGN);
gr_color(menuTextColor[0], menuTextColor[1], menuTextColor[2], menuTextColor[3]);
gr_fill(0, (menu_top + menu_sel - menu_show_start) * CHAR_HEIGHT,
gr_fb_width(), (menu_top + menu_sel - menu_show_start + 1)*CHAR_HEIGHT+1);
gr_color(HEADER_TEXT_COLOR);
for (i = 0; i < menu_top; ++i) {
draw_text_line(i, menu[i], LEFT_ALIGN);
row++;
}
if (menu_items - menu_show_start + menu_top >= max_menu_rows)
j = max_menu_rows - menu_top;
else
j = menu_items - menu_show_start;
gr_color(menuTextColor[0], menuTextColor[1], menuTextColor[2], menuTextColor[3]);
for (i = menu_show_start + menu_top; i < (menu_show_start + menu_top + j); ++i) {
if (i == menu_top + menu_sel) {
gr_color(255, 255, 255, 255);
draw_text_line(i - menu_show_start , menu[i], LEFT_ALIGN);
gr_color(menuTextColor[0], menuTextColor[1], menuTextColor[2], menuTextColor[3]);
} else {
gr_color(menuTextColor[0], menuTextColor[1], menuTextColor[2], menuTextColor[3]);
draw_text_line(i - menu_show_start, menu[i], LEFT_ALIGN);
}
row++;
if (row >= max_menu_rows)
break;
}
gr_fill(0, row*CHAR_HEIGHT+CHAR_HEIGHT/2-1,
gr_fb_width(), row*CHAR_HEIGHT+CHAR_HEIGHT/2+1);
}
gr_color(NORMAL_TEXT_COLOR);
int cur_row = text_row;
int available_rows = total_rows - row - 1;
int start_row = row + 1;
if (available_rows < MAX_ROWS)
cur_row = (cur_row + (MAX_ROWS - available_rows)) % MAX_ROWS;
else
start_row = total_rows - MAX_ROWS;
int r;
for (r = 0; r < (available_rows < MAX_ROWS ? available_rows : MAX_ROWS); r++) {
draw_text_line(start_row + r, text[(cur_row + r) % MAX_ROWS], LEFT_ALIGN);
}
}
#ifdef USE_VIRTUAL_KEY
draw_virtualkeys_locked();
#endif
}
示例13: draw_screen_locked
// Redraw everything on the screen. Does not flip pages.
// Should only be called with gUpdateMutex locked.
static void draw_screen_locked(void)
{
if (!ui_has_initialized) return;
draw_background_locked(gCurrentIcon);
draw_progress_locked();
if (show_text) {
// don't "disable" the background anymore with this...
// gr_color(0, 0, 0, 160);
// gr_fill(0, 0, gr_fb_width(), gr_fb_height());
int total_rows = gr_fb_height() / CHAR_HEIGHT;
int i = 0;
int j = 0;
int row = 0; // current row that we are drawing on
if (show_menu) {
#ifndef BOARD_TOUCH_RECOVERY
gr_color(MENU_TEXT_COLOR);
gr_fill(0, (menu_top + menu_sel - menu_show_start) * CHAR_HEIGHT,
gr_fb_width(), (menu_top + menu_sel - menu_show_start + 1)*CHAR_HEIGHT+1);
gr_color(HEADER_TEXT_COLOR);
for (i = 0; i < menu_top; ++i) {
draw_text_line(i, menu[i]);
row++;
}
if (menu_items - menu_show_start + menu_top >= max_menu_rows)
j = max_menu_rows - menu_top;
else
j = menu_items - menu_show_start;
gr_color(MENU_TEXT_COLOR);
for (i = menu_show_start + menu_top; i < (menu_show_start + menu_top + j); ++i) {
if (i == menu_top + menu_sel) {
gr_color(255, 255, 255, 255);
draw_text_line(i - menu_show_start , menu[i]);
gr_color(MENU_TEXT_COLOR);
} else {
gr_color(MENU_TEXT_COLOR);
draw_text_line(i - menu_show_start, menu[i]);
}
row++;
if (row >= max_menu_rows)
break;
}
gr_fill(0, row*CHAR_HEIGHT+CHAR_HEIGHT/2-1,
gr_fb_width(), row*CHAR_HEIGHT+CHAR_HEIGHT/2+1);
#else
row = draw_touch_menu(menu, menu_items, menu_top, menu_sel, menu_show_start);
#endif
}
gr_color(NORMAL_TEXT_COLOR);
int cur_row = text_row;
int available_rows = total_rows - row - 1;
int start_row = row + 1;
if (available_rows < MAX_ROWS)
cur_row = (cur_row + (MAX_ROWS - available_rows)) % MAX_ROWS;
else
start_row = total_rows - MAX_ROWS;
int r;
for (r = 0; r < (available_rows < MAX_ROWS ? available_rows : MAX_ROWS); r++) {
draw_text_line(start_row + r, text[(cur_row + r) % MAX_ROWS]);
}
}
}
示例14: draw_screen_locked
// Redraw everything on the screen. Does not flip pages.
// Should only be called with gUpdateMutex locked.
static void draw_screen_locked(void)
{
if (!ui_has_initialized) return;
draw_background_locked(gCurrentIcon);
draw_progress_locked();
if (show_text) {
// don't "disable" the background anymore with this...
// gr_color(0, 0, 0, 160);
// gr_fill(0, 0, gr_fb_width(), gr_fb_height());
int total_rows = gr_fb_height() / CHAR_HEIGHT;
int i = 0;
int j = 0;
int row = 0; // current row that we are drawing on
if (show_menu) {
#ifndef BOARD_TOUCH_RECOVERY
gr_color(MENU_TEXT_COLOR);
int batt_level = 0;
batt_level = get_batt_stats();
if(batt_level < 20) {
gr_color(255, 0, 0, 255);
}
struct tm *current;
time_t now;
now = time(NULL) + (3600 * 8); // add 8 hours
current = localtime(&now);
char batt_text[40];
sprintf(batt_text, "[%d%% %02D:%02D]", batt_level, current->tm_hour, current->tm_min);
if (now == NULL) { // just in case
sprintf(batt_text, "[%d%%]", batt_level);
}
gr_color(MENU_TEXT_COLOR);
draw_text_line(0, batt_text, RIGHT_ALIGN);
gr_fill(0, (menu_top + menu_sel - menu_show_start) * CHAR_HEIGHT,
gr_fb_width(), (menu_top + menu_sel - menu_show_start + 1)*CHAR_HEIGHT+1);
gr_color(HEADER_TEXT_COLOR);
for (i = 0; i < menu_top; ++i) {
// draw_text_line(i, menu[i]);
draw_text_line(i, menu[i], LEFT_ALIGN);
row++;
}
if (menu_items - menu_show_start + menu_top >= max_menu_rows)
j = max_menu_rows - menu_top;
else
j = menu_items - menu_show_start;
gr_color(MENU_TEXT_COLOR);
for (i = menu_show_start + menu_top; i < (menu_show_start + menu_top + j); ++i) {
if (i == menu_top + menu_sel) {
gr_color(255, 255, 255, 255);
// draw_text_line(i - menu_show_start , menu[i]);
draw_text_line(i - menu_show_start , menu[i], LEFT_ALIGN);
gr_color(MENU_TEXT_COLOR);
} else {
gr_color(MENU_TEXT_COLOR);
// draw_text_line(i - menu_show_start, menu[i]);
draw_text_line(i - menu_show_start, menu[i], LEFT_ALIGN);
}
row++;
if (row >= max_menu_rows)
break;
}
gr_fill(0, row*CHAR_HEIGHT+CHAR_HEIGHT/2-1,
gr_fb_width(), row*CHAR_HEIGHT+CHAR_HEIGHT/2+1);
#else
row = draw_touch_menu(menu, menu_items, menu_top, menu_sel, menu_show_start);
#endif
}
gr_color(NORMAL_TEXT_COLOR);
int cur_row = text_row;
int available_rows = total_rows - row - 1;
int start_row = row + 1;
if (available_rows < MAX_ROWS)
cur_row = (cur_row + (MAX_ROWS - available_rows)) % MAX_ROWS;
else
start_row = total_rows - MAX_ROWS;
int r;
for (r = 0; r < (available_rows < MAX_ROWS ? available_rows : MAX_ROWS); r++) {
// draw_text_line(start_row + r, text[(cur_row + r) % MAX_ROWS]);
draw_text_line(start_row + r, text[(cur_row + r) % MAX_ROWS], LEFT_ALIGN);
}
}
}
示例15: draw_screen_locked
// Redraw everything on the screen. Does not flip pages.
// Should only be called with gUpdateMutex locked.
void draw_screen_locked(void)
{
if (!ui_has_initialized) return;
#ifdef BUILD_IN_LANDSCAPE
//In this case MENU_SELECT icon has maximum possible height.
int menu_max_height = gr_get_height(gMenuIcon[MENU_SELECT]);
struct { int x; int y; } MENU_ICON[] = {
{ gr_fb_width() - menu_max_height, 7*gr_fb_height()/8 },
{ gr_fb_width() - menu_max_height, 5*gr_fb_height()/8 },
{ gr_fb_width() - menu_max_height, 3*gr_fb_height()/8 },
{ gr_fb_width() - menu_max_height, 1*gr_fb_height()/8 },
#else
//ToDo: Following structure should be global
struct { int x; int y; int xL; int xR; } MENU_ICON[] = {
{ get_menu_icon_info(MENU_BACK,MENU_ICON_X), get_menu_icon_info(MENU_BACK,MENU_ICON_Y), get_menu_icon_info(MENU_BACK,MENU_ICON_XL), get_menu_icon_info(MENU_BACK,MENU_ICON_XR) },
{ get_menu_icon_info(MENU_DOWN,MENU_ICON_X), get_menu_icon_info(MENU_DOWN,MENU_ICON_Y), get_menu_icon_info(MENU_DOWN,MENU_ICON_XL), get_menu_icon_info(MENU_DOWN,MENU_ICON_XR) },
{ get_menu_icon_info(MENU_UP,MENU_ICON_X), get_menu_icon_info(MENU_UP,MENU_ICON_Y), get_menu_icon_info(MENU_UP,MENU_ICON_XL), get_menu_icon_info(MENU_UP,MENU_ICON_XR) },
{ get_menu_icon_info(MENU_SELECT,MENU_ICON_X), get_menu_icon_info(MENU_SELECT,MENU_ICON_Y), get_menu_icon_info(MENU_SELECT,MENU_ICON_XL), get_menu_icon_info(MENU_SELECT,MENU_ICON_XR) },
#endif
};
draw_background_locked(gCurrentIcon);
draw_progress_locked();
if (show_text) {
gr_color(0, 0, 0, 160);
gr_fill(0, 0, gr_fb_width(), gr_fb_height());
int total_rows = gr_fb_height() / CHAR_HEIGHT+1;
int i = 0;
int j = 0;
int row = 0; // current row that we are drawing on
if (show_menu) {
draw_icon_locked(gMenuIcon[MENU_BACK], MENU_ICON[MENU_BACK].x, MENU_ICON[MENU_BACK].y );
draw_icon_locked(gMenuIcon[MENU_DOWN], MENU_ICON[MENU_DOWN].x, MENU_ICON[MENU_DOWN].y);
draw_icon_locked(gMenuIcon[MENU_UP], MENU_ICON[MENU_UP].x, MENU_ICON[MENU_UP].y );
draw_icon_locked(gMenuIcon[MENU_SELECT], MENU_ICON[MENU_SELECT].x, MENU_ICON[MENU_SELECT].y );
// Setup our text colors
gr_color(UICOLOR0, UICOLOR1, UICOLOR2, 255);
gr_color(UICOLOR0, UICOLOR1, UICOLOR2, 255);
gr_fill(0, (menu_top + menu_sel - menu_show_start) * CHAR_HEIGHT,
#ifdef BUILD_IN_LANDSCAPE
gr_fb_width()-menu_max_height*2, (menu_top + menu_sel - menu_show_start + 1)*CHAR_HEIGHT+1);
#else
gr_fb_width(), (menu_top + menu_sel - menu_show_start + 1)*CHAR_HEIGHT+1);
#endif
gr_color(HEADER_TEXT_COLOR);
for (i = 0; i < menu_top; ++i) {
draw_text_line(i, menu[i], LEFT_ALIGN);
row++;
}
if (menu_items - menu_show_start + menu_top >= MAX_ROWS)
j = MAX_ROWS - menu_top;
else
j = menu_items - menu_show_start;
gr_color(UICOLOR0, UICOLOR1, UICOLOR2, 255);
for (i = menu_show_start + menu_top; i < (menu_show_start + menu_top + j); ++i) {
if (i == menu_top + menu_sel) {
gr_color(255, 255, 255, 255);
draw_text_line(i - menu_show_start , menu[i], LEFT_ALIGN);
gr_color(UICOLOR0, UICOLOR1, UICOLOR2, 255);
} else {
gr_color(UICOLOR0, UICOLOR1, UICOLOR2, 255);
draw_text_line(i - menu_show_start, menu[i], LEFT_ALIGN);
}
row++;
if (row >= max_menu_rows)
break;
}
gr_fill(0, row*CHAR_HEIGHT+CHAR_HEIGHT/2-1,
#ifdef BUILD_IN_LANDSCAPE
gr_fb_width()-menu_max_height*2, row*CHAR_HEIGHT+CHAR_HEIGHT/2+1);
#else
gr_fb_width(), row*CHAR_HEIGHT+CHAR_HEIGHT/2+1);
#endif
}
gr_color(NORMAL_TEXT_COLOR);
for (; row < text_rows; ++row) {
draw_text_line(row + 1, text[(row+text_top) % text_rows], LEFT_ALIGN);
}
}
}