~ruther/CTU-FEE-B0B35APO-Semestral-project

ref: 8e2364f03eb822b5086732b7f8ceee8e59a874a2 CTU-FEE-B0B35APO-Semestral-project/lib-gui/src/gui_group_container.c -rw-r--r-- 1.4 KiB
8e2364f0 — František Boháček feat: add keyboard filter 0 for any key 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "gui.h"

component_t *gui_group_container_add_component(container_t *container,
                                       component_t component) {
  group_container_t group = container->inner.group;
  if (group.count >= group.size) {
    return false;
  }

  group.components[group.count++] = component;
  container->inner.group = group;
  return &group.components[group.count - 1];
}

void gui_group_container_render(gui_t *gui, container_t *container) {
  group_container_t group = container->inner.group;
  for (int i = 0; i < group.size; i++) {
    gui_component_render(gui, container, &group.components[i]);
  }
}

void gui_group_container_update(gui_t *gui, container_t *container) {
  group_container_t group = container->inner.group;
  for (int i = 0; i < group.size; i++) {
    gui_component_update(gui, container, &group.components[i]);
  }
  container->inner.group = group;
}

container_t gui_group_container_create(int16_t x, int16_t y, component_t *components, uint16_t components_size) {
  container_t container = {.x = x,
                           .y = y,
                           .type = CONT_GROUP,
                           .focusable = false,
                           .focused = false,
                           .inner = {.group = {.components = components,
                                               .size = components_size,
                                               .count = 0}}};
  return container;
}
Do not follow this link