diff options
Diffstat (limited to 'apps/tests/main.cpp')
-rw-r--r-- | apps/tests/main.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/apps/tests/main.cpp b/apps/tests/main.cpp index e11f1dc..34e26ed 100644 --- a/apps/tests/main.cpp +++ b/apps/tests/main.cpp @@ -2,13 +2,37 @@ #include "pico/stdlib.h" #include "main.hpp" +#include "../../hal/ui/widget/list_widget.hpp" +#define NUMBER_OF_SCREENS 2 BaseApp::AppReturnValues app_tests::render(Api *app_api) { app_api->gui_header_text("App for testing APIs."); + + switch (m_current_screen) { + case 0: + for (uint i = 0; i < 127*63; i++) { + int x = rand() % 128; + int y = rand() % 64; + app_api->display_write_pixel(x, y, rand() % 2, 0); + } + break; + + case 1: { + ListWidget widget(app_api, {10, 10, 100, 50}); + widget.paint(); + break; + } + + default: + break; + } return AppReturnValues::OK; } BaseApp::AppReturnValues app_tests::btn_pressed(Api *app_api, uint gpio, unsigned long delta) { + if (gpio == BUTTON_MODE and ++m_current_screen > (NUMBER_OF_SCREENS-1)) + m_current_screen = 0; + return AppReturnValues::OK; } |