DrawBox, fixed utf8 draw info setup

This commit is contained in:
olikraus 2016-04-23 08:24:04 +02:00
parent 79aeb44d4f
commit 9fca49da84
6 changed files with 59 additions and 2 deletions

View File

@ -413,6 +413,11 @@ uint8_t u8g2_IsIntersection(u8g2_t *u8g2, u8g2_uint_t x0, u8g2_uint_t y0, u8g2_u
#endif /* U8G2_WITH_INTERSECTION */
/*==========================================*/
/* u8g2_box.c */
void u8g2_DrawBox(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g2_uint_t h);
/*==========================================*/
/* u8g2_font.c */

View File

@ -125,8 +125,8 @@ void u8g2_update_dimension_r1(u8g2_t *u8g2)
u8g2->user_y0 = 0;
u8g2->user_y1 = u8g2->pixel_buf_width;
// printf("x0=%d x1=%d y0=%d y1=%d\n",
// u8g2->user_x0, u8g2->user_x1, u8g2->user_y0, u8g2->user_y1);
printf("x0=%d x1=%d y0=%d y1=%d\n",
u8g2->user_x0, u8g2->user_x1, u8g2->user_y0, u8g2->user_y1);
}
void u8g2_update_dimension_r2(u8g2_t *u8g2)

View File

@ -318,6 +318,8 @@ static const u8x8_display_info_t u8x8_tga_lcd_info =
#else
/* default_x_offset = */ 0,
#endif
/* pixel_width = */ (DEFAULT_WIDTH)/FACTOR,
/* pixel_height = */ (DEFAULT_HEIGHT)/FACTOR
};

View File

@ -0,0 +1,14 @@
CC = gcc
CFLAGS = -g -Wall -I../../../csrc/.
SRC = $(shell ls ../../../csrc/*.c) $(shell ls ../common/*.c ) main.c
OBJ = $(SRC:.c=.o)
u8g2_utf8: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) -o u8g2_utf8
clean:
-rm $(OBJ) u8g2_utf8

View File

@ -0,0 +1,34 @@
#include "u8g2.h"
#include <stdio.h>
u8g2_t u8g2;
int main(void)
{
u8g2_SetupBuffer_Utf8(&u8g2, U8G2_R2);
u8g2_InitDisplay(&u8g2);
u8g2_SetPowerSave(&u8g2, 0);
u8g2_SetFont(&u8g2, u8g2_font_6x13_tf);
u8g2_SetFontDirection(&u8g2, 0);
u8g2_FirstPage(&u8g2);
do
{
u8g2_DrawBox(&u8g2, 2, 3, 7, 9);
u8g2_DrawBox(&u8g2, 12, 3, 2, 13);
u8g2_DrawBox(&u8g2, 12,17, 13, 2);
u8g2_DrawStr(&u8g2, 30, 10, "DrawBox");
} while( u8g2_NextPage(&u8g2) );
utf8_show();
return 0;
}

View File

@ -153,6 +153,8 @@ static const u8x8_display_info_t u8x8_utf8_info =
#else
/* default_x_offset = */ 0,
#endif
/* pixel_width = */ CHGR_WIDTH,
/* pixel_height = */ CHGR_HEIGHT
};