msg box 8x8

This commit is contained in:
olikraus 2016-06-14 23:09:53 +02:00
parent e16dda869f
commit 0ac87622d6
5 changed files with 42 additions and 7 deletions

View File

@ -117,13 +117,11 @@ uint8_t u8g2_UserInterfaceInputValue(u8g2_t *u8g2, const char *title, const char
if ( event == U8X8_MSG_GPIO_MENU_SELECT )
{
*value = local_value;
r = 1;
return r;
return 1;
}
else if ( event == U8X8_MSG_GPIO_MENU_HOME )
{
r = 0;
return r;
return 0;
}
else if ( event == U8X8_MSG_GPIO_MENU_NEXT || event == U8X8_MSG_GPIO_MENU_UP )
{

View File

@ -171,7 +171,7 @@ uint8_t u8g2_UserInterfaceMessage(u8g2_t *u8g2, const char *title1, const char *
if ( event == U8X8_MSG_GPIO_MENU_SELECT )
return cursor+1;
else if ( event == U8X8_MSG_GPIO_MENU_HOME )
break;
return 0;
else if ( event == U8X8_MSG_GPIO_MENU_NEXT || event == U8X8_MSG_GPIO_MENU_DOWN )
{
cursor++;

View File

@ -132,14 +132,14 @@ uint8_t u8x8_UserInterfaceMessage(u8x8_t *u8x8, const char *title1, const char *
return cursor+1;
else if ( event == U8X8_MSG_GPIO_MENU_HOME )
break;
else if ( event == U8X8_MSG_GPIO_MENU_NEXT )
else if ( event == U8X8_MSG_GPIO_MENU_NEXT || event == U8X8_MSG_GPIO_MENU_UP )
{
cursor++;
if ( cursor >= button_cnt )
cursor = 0;
u8x8_draw_button_line(u8x8, y, u8x8_GetCols(u8x8), cursor, buttons);
}
else if ( event == U8X8_MSG_GPIO_MENU_PREV )
else if ( event == U8X8_MSG_GPIO_MENU_PREV || event == U8X8_MSG_GPIO_MENU_DOWN )
{
if ( cursor == 0 )
cursor = button_cnt;

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_UserInterfaceMessage
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_UserInterfaceMessage(&u8x8, "title1", "title2", "title3", "Yes\nNo");
return 0;
}