u8g2-copy/sys/tga/text_picture_loop/main.c

77 lines
1.6 KiB
C
Raw Normal View History

2015-11-07 04:07:14 +08:00
#include "u8g2.h"
#include <stdio.h>
u8g2_t u8g2;
int main(void)
{
int x, y;
int k;
int i;
2015-12-21 06:39:27 +08:00
u8g2_SetupBuffer_TGA_DESC(&u8g2, &u8g2_cb_r0);
2015-12-07 06:22:52 +08:00
u8x8_InitDisplay(u8g2_GetU8x8(&u8g2));
2015-12-08 04:34:49 +08:00
u8x8_SetPowerSave(u8g2_GetU8x8(&u8g2), 0);
2015-11-07 04:07:14 +08:00
u8g2_SetFont(&u8g2, u8g2_font_helvB18_tr);
x = 50;
y = 30+0;
#ifdef U8G2_WITH_HVLINE_COUNT
u8g2.hv_cnt = 0UL;
#endif /* U8G2_WITH_HVLINE_COUNT */
/*
u8g2_ClearBuffer(&u8g2);
u8g2_SetFontDirection(&u8g2, 0);
2015-12-23 16:04:24 +08:00
u8g2_DrawStr(&u8g2, x, y, "ABC");
2015-11-07 04:07:14 +08:00
u8g2_SetFontDirection(&u8g2, 1);
2015-12-23 16:04:24 +08:00
u8g2_DrawStr(&u8g2, x, y, "abc");
2015-11-07 04:07:14 +08:00
u8g2_SetFontDirection(&u8g2, 2);
2015-12-23 16:04:24 +08:00
u8g2_DrawStr(&u8g2, x, y, "abc");
2015-11-07 04:07:14 +08:00
u8g2_SetFontDirection(&u8g2, 3);
2015-12-23 16:04:24 +08:00
u8g2_DrawStr(&u8g2, x, y, "abc");
2015-11-07 04:07:14 +08:00
u8g2_SendBuffer(&u8g2);
*/
u8g2_FirstPage(&u8g2);
i = 0;
do
{
u8g2_SetFontDirection(&u8g2, 0);
2015-12-23 16:04:24 +08:00
u8g2_DrawStr(&u8g2, x, y, "ABC");
2015-11-07 04:07:14 +08:00
u8g2_SetFontDirection(&u8g2, 1);
2015-12-23 16:04:24 +08:00
u8g2_DrawStr(&u8g2, x, y, "abc");
2015-11-07 04:07:14 +08:00
u8g2_SetFontDirection(&u8g2, 2);
2015-12-23 16:04:24 +08:00
u8g2_DrawStr(&u8g2, x, y, "abc");
2015-11-07 04:07:14 +08:00
u8g2_SetFontDirection(&u8g2, 3);
2015-12-23 16:04:24 +08:00
u8g2_DrawStr(&u8g2, x, y, "abc");
2015-11-07 04:07:14 +08:00
if ( i == 1 )
{
u8g2_DrawHVLine(&u8g2, u8g2.user_x0, u8g2.user_y0, 1, 0);
u8g2_DrawHVLine(&u8g2, u8g2.user_x0, u8g2.user_y1-1, 1, 0);
u8g2_DrawHVLine(&u8g2, u8g2.user_x1-1, u8g2.user_y1-1, 1, 0);
u8g2_DrawHVLine(&u8g2, u8g2.user_x1-1, u8g2.user_y0, 1, 0);
}
i++;
} while( u8g2_NextPage(&u8g2) );
#ifdef U8G2_WITH_HVLINE_COUNT
printf("hv cnt: %ld\n", u8g2.hv_cnt);
#endif /* U8G2_WITH_HVLINE_COUNT */
tga_save("u8g2.tga");
return 0;
}