Skip to content

Commit b8b1220

Browse files
committed
Move C imports to Zig module
1 parent ce46e36 commit b8b1220

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

feature-phone.wasm

-61 Bytes
Binary file not shown.

feature-phone.zig

+10-7
Original file line numberDiff line numberDiff line change
@@ -142,28 +142,28 @@ fn createDisplayLabel(cont: *c.lv_obj_t) !void {
142142
var container = lvgl.Object.init(cont);
143143

144144
// Create a Label Widget
145-
var label = try container.createLabel();
145+
display_label = try container.createLabel();
146146

147147
// Wrap long lines in the label text
148-
label.setLongMode(c.LV_LABEL_LONG_WRAP);
148+
display_label.setLongMode(c.LV_LABEL_LONG_WRAP);
149149

150150
// Interpret color codes in the label text
151-
label.setRecolor(true);
151+
display_label.setRecolor(true);
152152

153153
// Center align the label text
154-
label.setAlign(c.LV_TEXT_ALIGN_CENTER);
154+
display_label.setAlign(c.LV_TEXT_ALIGN_CENTER);
155155

156156
// Set the label text and colors
157-
label.setText("#ff0000 HELLO# " ++ // Red Text
157+
display_label.setText("#ff0000 HELLO# " ++ // Red Text
158158
"#00aa00 LVGL ON# " ++ // Green Text
159159
"#0000ff PINEPHONE!# " // Blue Text
160160
);
161161

162162
// Set the label width
163-
label.setWidth(200);
163+
display_label.setWidth(200);
164164

165165
// Align the label to the top middle
166-
label.alignObject(c.LV_ALIGN_TOP_MID, 0, 0);
166+
display_label.alignObject(c.LV_ALIGN_TOP_MID, 0, 0);
167167
}
168168

169169
/// Create the Call and Cancel Buttons
@@ -212,6 +212,9 @@ export fn eventHandler(e: ?*c.lv_event_t) void {
212212
}
213213
}
214214

215+
/// LVGL Display Label
216+
var display_label: lvgl.Label = undefined;
217+
215218
/// LVGL Styles for Containers (std.mem.zeroes crashes the compiler)
216219
var display_style: c.lv_style_t = undefined;
217220
var call_style: c.lv_style_t = undefined;

0 commit comments

Comments
 (0)