mirror of
https://github.com/Valeh2012/PersonalVotingMachine
synced 2025-12-08 18:15:11 +02:00
first commit
This commit is contained in:
12
basic-setup/components/u8g2/sys/sdl/utf8_test_8x8/Makefile
Normal file
12
basic-setup/components/u8g2/sys/sdl/utf8_test_8x8/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
CFLAGS = -g -Wall -I../../../csrc/. `sdl2-config --cflags`
|
||||
|
||||
SRC = $(shell ls ../../../csrc/*.c) $(shell ls ../common/*.c ) main.c
|
||||
|
||||
OBJ = $(SRC:.c=.o)
|
||||
|
||||
helloworld: $(OBJ)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ) `sdl2-config --libs` -o u8g2_sdl
|
||||
|
||||
clean:
|
||||
-rm $(OBJ) u8g2_sdl
|
||||
|
||||
29
basic-setup/components/u8g2/sys/sdl/utf8_test_8x8/main.c
Normal file
29
basic-setup/components/u8g2/sys/sdl/utf8_test_8x8/main.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
Use UTF-8 encoding for this file
|
||||
*/
|
||||
|
||||
|
||||
#include "u8x8.h"
|
||||
|
||||
u8x8_t u8g2;
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
u8x8_Setup_SDL_128x64(&u8g2);
|
||||
u8x8_InitDisplay(&u8g2);
|
||||
|
||||
u8x8_SetFont(&u8g2, u8x8_font_amstrad_cpc_extended_f);
|
||||
u8x8_DrawString(&u8g2, 0, 0, "UTF-8 Test");
|
||||
|
||||
u8x8_DrawString(&u8g2, 0, 1, "M\xfcnchen");/* works: select umlaut-u directly with code 0xfc */
|
||||
u8x8_DrawString(&u8g2, 0, 2, "München"); /* does not work: umlaut-u is translated to utf-8, broken output */
|
||||
u8x8_DrawUTF8(&u8g2, 0, 3, "M\xfcnchen"); /* does not work: Codes above 127 are reserved for UTF-8 encoding */
|
||||
u8x8_DrawUTF8(&u8g2, 0, 4, "München"); /* works: u8x8 can handle UTF-8 code correctly */
|
||||
|
||||
while( u8g_sdl_get_key() < 0 )
|
||||
;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user