aboutsummaryrefslogtreecommitdiff
path: root/src/mgui/mgui.c
blob: e2fa0bea23d47d3d1cb05b0fb126714aed12f792 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "../../include/mgui/mgui.h"
#include "../../include/mgui/widget.h"
#include <mgl/system/clock.h>

static mgl_clock global_timer;

void mgui_init() {
    mgl_clock_init(&global_timer);
}

void mgui_draw(mgui_widget *root_widget, mgl_window *window) {
    mgui_widget_draw(root_widget, window);
}

double mgui_get_seconds_since_last_update() {
    double elapsed_time_sec = mgl_clock_restart(&global_timer);
    if(elapsed_time_sec > 1.0)
        elapsed_time_sec = 1.0;
    return elapsed_time_sec;
}