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/tile_row/Makefile
Normal file
12
basic-setup/components/u8g2/sys/sdl/tile_row/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
CFLAGS = -g -Wall -I../../../csrc/. `sdl2-config --cflags` -fsanitize=address -fsanitize=undefined -fsanitize=bounds-strict -fsanitize=object-size
|
||||
|
||||
SRC = $(shell ls ../../../csrc/*.c) ../../bitmap/common/u8x8_d_bitmap.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
|
||||
|
||||
80
basic-setup/components/u8g2/sys/sdl/tile_row/main.c
Normal file
80
basic-setup/components/u8g2/sys/sdl/tile_row/main.c
Normal file
@@ -0,0 +1,80 @@
|
||||
|
||||
#include "u8g2.h"
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
u8g2_t u8g2;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int x, y;
|
||||
int k;
|
||||
int i;
|
||||
|
||||
u8g2_SetupBuffer_SDL_128x64_1(&u8g2, &u8g2_cb_r0);
|
||||
u8x8_InitDisplay(u8g2_GetU8x8(&u8g2));
|
||||
u8x8_SetPowerSave(u8g2_GetU8x8(&u8g2), 0);
|
||||
|
||||
|
||||
x = 2;
|
||||
y = 8;
|
||||
|
||||
|
||||
for(;;)
|
||||
{
|
||||
|
||||
/*
|
||||
u8g2_ClearBuffer(&u8g2);
|
||||
|
||||
u8g2_SetFontDirection(&u8g2, 0);
|
||||
u8g2_DrawStr(&u8g2, x, y, "ABC");
|
||||
u8g2_SetFontDirection(&u8g2, 1);
|
||||
u8g2_DrawStr(&u8g2, x, y, "abc");
|
||||
u8g2_SetFontDirection(&u8g2, 2);
|
||||
u8g2_DrawStr(&u8g2, x, y, "abc");
|
||||
u8g2_SetFontDirection(&u8g2, 3);
|
||||
u8g2_DrawStr(&u8g2, x, y, "abc");
|
||||
|
||||
u8g2_SendBuffer(&u8g2);
|
||||
*/
|
||||
|
||||
u8g2_SetBufferCurrTileRow(&u8g2, 0);
|
||||
u8g2_ClearBuffer(&u8g2);
|
||||
u8g2_SetFont(&u8g2, u8g2_font_helvB08_tr);
|
||||
u8g2_DrawStr(&u8g2, x, y, "ABC def");
|
||||
u8g2_SendBuffer(&u8g2);
|
||||
u8g2_SetBufferCurrTileRow(&u8g2, 4);
|
||||
u8g2_SendBuffer(&u8g2);
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
k = u8g_sdl_get_key();
|
||||
} while( k < 0 );
|
||||
|
||||
if ( k == 273 ) y -= 7;
|
||||
if ( k == 274 ) y += 7;
|
||||
if ( k == 276 ) x -= 7;
|
||||
if ( k == 275 ) x += 7;
|
||||
|
||||
if ( k == 'e' ) y -= 1;
|
||||
if ( k == 'x' ) y += 1;
|
||||
if ( k == 's' ) x -= 1;
|
||||
if ( k == 'd' ) x += 1;
|
||||
if ( k == 'q' ) break;
|
||||
|
||||
if ( k == 't' )
|
||||
u8x8_SaveBitmapTGA(u8g2_GetU8x8(&u8g2), "screenshot.tga");
|
||||
}
|
||||
|
||||
//u8x8_Set8x8Font(u8g2_GetU8x8(&u8g2), bdf_font);
|
||||
//u8x8_Draw8x8String(u8g2_GetU8x8(&u8g2), 0, 0, "Hello World!");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user