summaryrefslogtreecommitdiff
path: root/src/event.c
blob: 9b98ee647df7036435f79b2b9d2994506a449ed4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "event.h"

#include "constants.h"
#include "uiLibrary.h"

#include <cassert.h>

void PushWidgetEvent(uiWidgetEvent* event) {
  assert(event);
  assert(g_ui.num_widget_events < MaxWidgetEvents);

  g_ui.widget_events[g_ui.num_widget_events++] = *event;
}

int uiGetEvents(uiWidgetEvent const** ppWidgetEvents) {
  assert(ppWidgetEvents);

  const int count        = g_ui.num_widget_events;
  g_ui.num_widget_events = 0;

  *ppWidgetEvents = g_ui.widget_events;
  return count;
}