forked from len0rd/rockbox
Two new lcd/multi screen api convinience functions: draw_viewport(), fill_viewport().
They work as the drawrect/fillrect pendants but work on a viewport basis; pass NULL to draw the current viewport (the one set with set_viewport()). In conjunction with action_get_touchscreen_press_in_vp() it should be less of a pain to draw buttons and get presses on them. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28239 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
752c91b50d
commit
8a0152bd4a
9 changed files with 47 additions and 14 deletions
|
|
@ -66,16 +66,17 @@ static void gui_buttonbar_draw_button(struct gui_buttonbar * buttonbar, int num)
|
|||
struct viewport vp = bb_vp[display->screen_type];
|
||||
|
||||
button_width = display->lcdwidth/BUTTONBAR_MAX_BUTTONS;
|
||||
vp.width = button_width;
|
||||
vp.width = button_width-1;
|
||||
vp.x = button_width * num;
|
||||
display->set_viewport(&vp);
|
||||
display->fillrect(0, 0, button_width - 1, vp.height);
|
||||
display->fill_viewport(NULL);
|
||||
if(buttonbar->caption[num][0] != 0)
|
||||
{
|
||||
display->getstringsize(buttonbar->caption[num], &fw, &fh);
|
||||
display->putsxy((button_width - fw)/2,
|
||||
(vp.height-fh)/2, buttonbar->caption[num]);
|
||||
}
|
||||
display->set_viewport(NULL);
|
||||
}
|
||||
|
||||
void gui_buttonbar_set(struct gui_buttonbar * buttonbar,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue