#ifndef JTK_EVENT_H
#define JTK_EVENT_H

#include <stdint.h>
#include <stdlib.h>

#define JTK_EVENT_CLOSE_WINDOW      1u
#define JTK_EVENT_WINDOW_EXPOSE     2u
#define JTK_EVENT_KEY_PRESS         3u
#define JTK_EVENT_KEY_RELEASE       4u
#define JTK_EVENT_BUTTON_PRESS      5u
#define JTK_EVENT_BUTTON_RELEASE    6u
#define JTK_EVENT_TIMER             7u

typedef struct
{
    uint32_t key;
} Jtk_KeyEvent;

typedef struct
{
    uint8_t button;
} Jtk_ButtonEvent;

typedef struct
{
    size_t timer_id;
    void * user1;
    void * user2;
} Jtk_TimerEvent;

typedef struct
{
    uint8_t type;
    union
    {
        Jtk_KeyEvent key;
        Jtk_ButtonEvent button;
        Jtk_TimerEvent timer;
    };
} Jtk_Event;

void Jtk_WaitEvent(Jtk_Event * event);

#endif
