{"action":"created","issue":{"url":"https://api.github.com/repos/andlabs/libui/issues/21","repository_url":"https://api.github.com/repos/andlabs/libui","labels_url":"https://api.github.com/repos/andlabs/libui/issues/21/labels{/name}","comments_url":"https://api.github.com/repos/andlabs/libui/issues/21/comments","events_url":"https://api.github.com/repos/andlabs/libui/issues/21/events","html_url":"https://github.com/andlabs/libui/pull/21","id":154923670,"number":21,"title":"added: uiMainStep for handling events manually in a blocking and non-blocking fashion","user":{"login":"ProPuke","id":105934,"avatar_url":"https://avatars.githubusercontent.com/u/105934?v=3","gravatar_id":"","url":"https://api.github.com/users/ProPuke","html_url":"https://github.com/ProPuke","followers_url":"https://api.github.com/users/ProPuke/followers","following_url":"https://api.github.com/users/ProPuke/following{/other_user}","gists_url":"https://api.github.com/users/ProPuke/gists{/gist_id}","starred_url":"https://api.github.com/users/ProPuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProPuke/subscriptions","organizations_url":"https://api.github.com/users/ProPuke/orgs","repos_url":"https://api.github.com/users/ProPuke/repos","events_url":"https://api.github.com/users/ProPuke/events{/privacy}","received_events_url":"https://api.github.com/users/ProPuke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-15T18:53:36Z","updated_at":"2016-05-15T20:10:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/andlabs/libui/pulls/21","html_url":"https://github.com/andlabs/libui/pull/21","diff_url":"https://github.com/andlabs/libui/pull/21.diff","patch_url":"https://github.com/andlabs/libui/pull/21.patch"},"body":"This hasn't had proper testing. Only used it in linux atm, but think it _should_ be okay in windows and osx (which probably means it isn't, and needs testing).\r\n\r\n`uiMainStep(int blocking)` - Run a single iteration of the main loop. If `blocking` is non-zero this may block until the next available event, before processing.\r\n\r\nFor use in your own manual program loops."},"comment":{"url":"https://api.github.com/repos/andlabs/libui/issues/comments/219307673","html_url":"https://github.com/andlabs/libui/pull/21#issuecomment-219307673","issue_url":"https://api.github.com/repos/andlabs/libui/issues/21","id":219307673,"user":{"login":"ProPuke","id":105934,"avatar_url":"https://avatars.githubusercontent.com/u/105934?v=3","gravatar_id":"","url":"https://api.github.com/users/ProPuke","html_url":"https://github.com/ProPuke","followers_url":"https://api.github.com/users/ProPuke/followers","following_url":"https://api.github.com/users/ProPuke/following{/other_user}","gists_url":"https://api.github.com/users/ProPuke/gists{/gist_id}","starred_url":"https://api.github.com/users/ProPuke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProPuke/subscriptions","organizations_url":"https://api.github.com/users/ProPuke/orgs","repos_url":"https://api.github.com/users/ProPuke/repos","events_url":"https://api.github.com/users/ProPuke/events{/privacy}","received_events_url":"https://api.github.com/users/ProPuke/received_events","type":"User","site_admin":false},"created_at":"2016-05-15T20:10:04Z","updated_at":"2016-05-15T20:10:04Z","body":"Sorry, what I get for doing those blind >.>\r\n\r\nIt's useful for any apps where you still want control of the main loop - for instance if you have a game or gamedev tool that uses libui, and you need a tight render-loop and other updates alongside your ui. I guess you could delegate the ui handling to a separate thread, but that seems a bit of a convoluted solution (and needless threads usually cause problems).\r\n\r\nIn my case I'm using sdl and a few other things alongside libui, so I need to maintain my own event loop.\r\n\r\nI cleaned up the windows spam (I'd pasted something for reference and forgot all of it). I had presumed that firing off events manually with [NSApplication nextEventMatchingMask] and [NSApplication sendEvent] was a suitable replacement for [NSApplication run]? I could be totally wrong there. I did kinda guess. Windows code _should_ be fine now."}}