Adoranda/src/util.c

22 lines
420 B
C

#include <gint/keyboard.h>
#include <gint/std/stdlib.h>
#include "util.h"
/*wait for a specified input key*/
void wait_for_input(int input) {
int buffer = keydown(input);
while(1) {
clearevents();
if(keydown(input)) {
if(buffer) buffer = 0;
else break;
}
while(keydown(input)) clearevents();
}
}
/**
* Random [low;high[
*/
int rand_range(int low, int high) { return (rand() % (high - low)) + low; }