selection list u8x8

This commit is contained in:
olikraus 2016-06-14 23:15:53 +02:00
parent eaec72b964
commit 29f84058ca
3 changed files with 39 additions and 2 deletions

View File

@ -154,12 +154,12 @@ uint8_t u8x8_UserInterfaceSelectionList(u8x8_t *u8x8, const char *title, uint8_t
return u8sl.current_pos;
else if ( event == U8X8_MSG_GPIO_MENU_HOME )
return start_pos;
else if ( event == U8X8_MSG_GPIO_MENU_NEXT )
else if ( event == U8X8_MSG_GPIO_MENU_NEXT || event == U8X8_MSG_GPIO_MENU_DOWN )
{
u8sl_Next(&u8sl);
u8x8_DrawSelectionList(u8x8, &u8sl, u8x8_sl_string_line_cb, sl);
}
else if ( event == U8X8_MSG_GPIO_MENU_PREV )
else if ( event == U8X8_MSG_GPIO_MENU_PREV || event == U8X8_MSG_GPIO_MENU_UP )
{
u8sl_Prev(&u8sl);
u8x8_DrawSelectionList(u8x8, &u8sl, u8x8_sl_string_line_cb, sl);

View File

@ -0,0 +1,12 @@
CFLAGS = -g -Wall -I../../../csrc/. `sdl-config --cflags`
SRC = $(shell ls ../../../csrc/*.c) $(shell ls ../common/*.c ) main.c
OBJ = $(SRC:.c=.o)
helloworld: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) `sdl-config --libs` -o u8g2_sdl
clean:
-rm $(OBJ) u8g2_sdl

View File

@ -0,0 +1,25 @@
/*
Example for the
u8x8_UserInterfaceSelectionList
procedure.
*/
#include "u8x8.h"
u8x8_t u8x8;
int main(void)
{
u8x8_Setup_SDL_128x64(&u8x8);
u8x8_InitDisplay(&u8x8);
u8x8_SetFont(&u8x8, u8x8_font_amstrad_cpc_extended_f);
u8x8_UserInterfaceSelectionList(&u8x8, "Title", 1, "abc\ndef\nghi\njkl\nmno");
return 0;
}