Can someone explain the part of this code found in the Pebble C Watchface tutorial?

I am studying a face study tutorial in Pebble C found here https://developer.getpebble.com/tutorials/watchface-tutorial/part1

The piece of code in question is here:

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);
}

Is window_set_window_handlers a function declaration and call? And what is the terminology for the abbreviations .load and .unload in C?

It would be very helpful if someone could explain this piece of code, thanks.

+4
source share

Source: https://habr.com/ru/post/1620852/


All Articles