momento/src/input/update.c

23 lines
385 B
C

/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Copyright (C) 2021 KikooDX */
#include "input.h"
#include <gint/keyboard.h>
void
input_update(struct Input *input)
{
int i;
clearevents();
i = KEYS_COUNT;
while (i-- > 0) {
if (keydown(input->keycodes[i]))
input->keystates[i] =
input->keystates[i] ? KS_DOWN : KS_PRESS;
else
input->keystates[i] = KS_UP;
}
}