Created
June 25, 2015 22:53
-
-
Save ejrh/7f68016b4f4a43504611 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Uint32 MESSAGE_EVENT = SDL_RegisterEvents(1); | |
| /* In a thread dealing with network stuff */ | |
| while () { | |
| shared_ptr<Message> message = read_message_from_network(); | |
| SDL_Event evt; | |
| evt.type = MESSAGE_EVENT; | |
| evt.user.data1 = // what? | |
| SDL_PushEvent(&evt); | |
| } | |
| /* In the event-handling thread */ | |
| while () { | |
| SDL_Event evt; | |
| SDL_PollEvent(evt); | |
| if (evt.type == MESSAGE_EVENT) { | |
| shared_ptr<Message> message = // what? | |
| handle_message(message); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment