我正在研究这里找到的Pebble C表面教程https://developer.getpebble.com/tutorials/watchface-tutorial/part1
有问题的代码部分在这里:
static void init() { // Create main Window element and assign to pointer s_main_window = window_create(); // Set handlers to manage the elements inside the Window window_set_window_handlers(s_main_window, (WindowHandlers) { .load = main_window_load, .unload = main_window_unload }); // Show the Window on the watch, with animated=true window_stack_push(s_main_window, true); }
window_set_window_handlers是一个函数声明和调用吗?C中的.load和.unload简写符号的术语是什么?
如果有人可以解释这段代码,我将非常感谢,谢谢.
它被称为指定初始化器.WindowHandlers
在传递给函数调用之前,结构是在内联中创建和初始化的window_set_window_handlers
.