Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ ifeq ($(CONFIG_DEMO_EXAMPLE),y)
target-y += libiui_example

libiui_example_files-y := tests/example.c
libiui_example_files-$(CONFIG_DEMO_PIXELWALL) += tests/pixelwall-demo.c
libiui_example_includes-y := include ports externals tests
libiui_example_depends-y := libiui.a $(NYANCAT_DATA)
libiui_example_ldflags-y := libiui.a $(TARGET_LIBS)
Expand Down
9 changes: 9 additions & 0 deletions configs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,15 @@ config DEMO_FONT_EDITOR
Displays and renders glyphs from glyphs-data.inc.
Demonstrates point editing and curve visualization.

config DEMO_PIXELWALL
bool "Pixel-Grid Demo"
default y
depends on DEMO_EXAMPLE && MODULE_BASIC
help
Animated pixel-grid designs ported from PixelWall.
Includes Snake, Pong, Tetris, Invaders, and Pacman March.
Uses a segmented button to switch between designs.

endmenu

# Build Options
Expand Down
32 changes: 32 additions & 0 deletions tests/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
#include "nyancat-data.h"
#endif

#ifdef CONFIG_DEMO_PIXELWALL
#include "pixelwall-demo.h"
#endif

#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
Expand Down Expand Up @@ -2921,6 +2925,10 @@ typedef struct {
#ifdef CONFIG_DEMO_FONT_EDITOR
bool show_font_editor;
#endif
#ifdef CONFIG_DEMO_PIXELWALL
pixelwall_state_t pixelwall;
bool show_pixelwall;
#endif
#ifdef CONFIG_FEATURE_THEME
bool dark_mode;
#endif
Expand Down Expand Up @@ -3020,6 +3028,10 @@ static void demo_close_other_windows(demo_state_t *state, bool *keep_open)
if (&state->show_font_editor != keep_open)
state->show_font_editor = false;
#endif
#ifdef CONFIG_DEMO_PIXELWALL
if (&state->show_pixelwall != keep_open)
state->show_pixelwall = false;
#endif
}
#endif /* CONFIG_MODULE_BASIC */

Expand Down Expand Up @@ -3197,6 +3209,12 @@ static void example_frame(void *arg)
demo_close_other_windows(state, &state->show_font_editor);
iui_grid_next(ui);
#endif
#ifdef CONFIG_DEMO_PIXELWALL
if (iui_switch(ui, "Pixel wall", &state->show_pixelwall, NULL, NULL) &&
state->show_pixelwall)
demo_close_other_windows(state, &state->show_pixelwall);
iui_grid_next(ui);
#endif
#ifdef CONFIG_FEATURE_THEME
if (iui_switch(ui, "Dark mode", &state->dark_mode, NULL, NULL)) {
iui_set_theme(ui,
Expand Down Expand Up @@ -3294,6 +3312,11 @@ static void example_frame(void *arg)
if (state->show_font_editor)
draw_font_editor_window(ui);
#endif
#ifdef CONFIG_DEMO_PIXELWALL
if (state->show_pixelwall)
draw_pixelwall_window(ui, port, &state->pixelwall, delta_time,
get_demo_window_height());
#endif
#ifdef CONFIG_MODULE_INPUT
if (state->show_textfield_demo)
draw_textfield_window(ui);
Expand Down Expand Up @@ -3608,12 +3631,21 @@ int main(int argc, char *argv[])
#ifdef CONFIG_DEMO_ACCESSIBILITY
state.show_accessibility = DEMO_DEFAULT_VIS;
#endif
#ifdef CONFIG_DEMO_FONT_EDITOR
state.show_font_editor = DEMO_DEFAULT_VIS;
#endif
#ifdef CONFIG_DEMO_PIXELWALL
state.show_pixelwall = DEMO_DEFAULT_VIS;
#endif
#ifdef CONFIG_FEATURE_THEME
state.dark_mode = true;
#endif
#ifdef CONFIG_DEMO_CALCULATOR
calc_init(&state.calc);
#endif
#ifdef CONFIG_DEMO_PIXELWALL
pixelwall_init(&state.pixelwall);
#endif

#ifdef CONFIG_FEATURE_THEME
/* Set initial theme */
Expand Down
Loading