33/// Import the Zig Standard Library
44const std = @import ("std" );
55
6- /// Import the LVGL Module
7- const lvgl = @import ("lvgl.zig" );
8-
96/// Import the WebAssembly Logger
107const wasmlog = @import ("wasmlog.zig" );
118
9+ /// Import the LVGL Module
10+ const lvgl = @import ("lvgl.zig" );
11+
1212/// Import the LVGL Library from C
13- const c = @cImport ({
14- // NuttX Defines
15- @cDefine ("__NuttX__" , "" );
16- @cDefine ("NDEBUG" , "" );
17-
18- // NuttX Header Files
19- @cInclude ("arch/types.h" );
20- @cInclude ("../../nuttx/include/limits.h" );
21- @cInclude ("stdio.h" );
22- @cInclude ("nuttx/config.h" );
23- @cInclude ("sys/boardctl.h" );
24- @cInclude ("unistd.h" );
25- @cInclude ("stddef.h" );
26- @cInclude ("stdlib.h" );
27-
28- // LVGL Header Files
29- @cInclude ("lvgl/lvgl.h" );
30-
31- // LVGL Display Interface for Zig
32- @cInclude ("display.h" );
33- });
13+ const c = lvgl .c ;
3414
3515///////////////////////////////////////////////////////////////////////////////
3616// Main Function
@@ -158,14 +138,11 @@ fn createWidgets() !void {
158138
159139/// Create the Display Label
160140fn createDisplayLabel (cont : * c.lv_obj_t ) ! void {
161- // TODO: Create the Label inside the Container
162- _ = cont ;
163-
164- // Get the Active Screen
165- var screen = try lvgl .getActiveScreen ();
141+ // Get the Container
142+ var container = lvgl .Object .init (cont );
166143
167144 // Create a Label Widget
168- var label = try screen .createLabel ();
145+ var label = try container .createLabel ();
169146
170147 // Wrap long lines in the label text
171148 label .setLongMode (c .LV_LABEL_LONG_WRAP );
@@ -185,8 +162,8 @@ fn createDisplayLabel(cont: *c.lv_obj_t) !void {
185162 // Set the label width
186163 label .setWidth (200 );
187164
188- // Align the label to the top middle of the screen
189- label .alignObject (c .LV_ALIGN_TOP_MID , 0 , 20 );
165+ // Align the label to the top middle
166+ label .alignObject (c .LV_ALIGN_TOP_MID , 0 , 0 );
190167}
191168
192169/// Create the Call and Cancel Buttons
0 commit comments