mirror of
https://github.com/Valeh2012/PersonalVotingMachine
synced 2024-11-23 09:41:01 +02:00
109 lines
1.6 KiB
C
109 lines
1.6 KiB
C
/*
|
|
|
|
main.c
|
|
|
|
*/
|
|
|
|
#include "gui.h"
|
|
#include <stdio.h>
|
|
|
|
|
|
u8g2_t u8g2;
|
|
|
|
|
|
|
|
int main(void)
|
|
{
|
|
int x, y;
|
|
int k;
|
|
int i;
|
|
|
|
u8g2_SetupBuffer_SDL_128x64_4(&u8g2, &u8g2_cb_r0);
|
|
u8x8_InitDisplay(u8g2_GetU8x8(&u8g2));
|
|
u8x8_SetPowerSave(u8g2_GetU8x8(&u8g2), 0);
|
|
|
|
//u8g2_SetFont(&u8g2, u8g2_font_helvB18_tf);
|
|
u8g2_SetFont(&u8g2, u8g2_font_ncenR08_tf);
|
|
|
|
gui_Init(&u8g2);
|
|
|
|
x = 50;
|
|
y = 50;
|
|
|
|
for(;;)
|
|
{
|
|
u8g2_FirstPage(&u8g2);
|
|
i = 0;
|
|
do
|
|
{
|
|
gui_Draw();
|
|
u8g2_SetFontDirection(&u8g2, 0);
|
|
u8g2_SetFont(&u8g2, u8g2_font_ncenR08_tf);
|
|
u8g2_DrawStr(&u8g2, x, y, "-- 123");
|
|
i++;
|
|
|
|
} while( u8g2_NextPage(&u8g2) );
|
|
|
|
do
|
|
{
|
|
k = u8g_sdl_get_key();
|
|
} while( k < 0 );
|
|
|
|
if ( k == 'n' )
|
|
gui_Next();
|
|
|
|
if ( k == 's' )
|
|
gui_Select();
|
|
|
|
if ( k == 'm' )
|
|
{
|
|
gui_data.mo++;
|
|
if ( gui_data.mo >= 10 )
|
|
{
|
|
gui_data.mo = 0;
|
|
gui_data.mt++;
|
|
if ( gui_data.mt >= 60 )
|
|
{
|
|
gui_data.h++;
|
|
if ( gui_data.h >= 24 )
|
|
{
|
|
gui_data.h = 0;
|
|
gui_data.day++;
|
|
}
|
|
}
|
|
}
|
|
gui_Recalculate();
|
|
}
|
|
|
|
if ( k == 'h' )
|
|
{
|
|
gui_data.h++;
|
|
if ( gui_data.h >= 24 )
|
|
{
|
|
gui_data.h = 0;
|
|
gui_data.day++;
|
|
}
|
|
gui_Recalculate();
|
|
}
|
|
|
|
if ( k == 273 ) y -= 1;
|
|
if ( k == 274 ) y += 1;
|
|
if ( k == 276 ) x -= 1;
|
|
if ( k == 275 ) x += 1;
|
|
|
|
if ( k == 'q' ) break;
|
|
|
|
}
|
|
|
|
//u8x8_Set8x8Font(u8g2_GetU8x8(&u8g2), bdf_font);
|
|
//u8x8_Draw8x8String(u8g2_GetU8x8(&u8g2), 0, 0, "Hello World!");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
}
|
|
|