This function waits until an event is available in the event queue and returns the oldest event.
Event WaitEvent()
Returns the oldest event in the queue.
Use PeekEvent to check if any events are available before calling this function, if you don't want the application to pause.
#include "UltraEngine.h"
using namespace UltraEngine;
int main(int argc, const char* argv[])
{
//Get the displays
auto displays = GetDisplays();
//Create window
auto window = CreateWindow("Ultra Engine", 0, 0, 800, 600, displays[0]);
//Create user interface
auto ui = CreateInterface(window);
while (true)
{
const Event ev = WaitEvent();
switch (ev.id)
{
case EVENT_WINDOWCLOSE:
if (ev.source == window)
{
return 0;
}
break;
}
}
return 0;
}