How do I use SDl_Threads properly?

Posted by Anoymonous on Stack Overflow See other posts from Stack Overflow or by Anoymonous
Published on 2009-04-13T01:25:04Z Indexed on 2010/04/01 23:03 UTC
Read the original article Hit count: 295

Filed under:
|
|

I am new to threads,SDL and how graphic work in general. I've been looking through all of LazyFoo's SDL tutorials, and had helped me greatly. But in his tutorials about multi threading, he commented that you should never use video functions in separate threads, or might cause problem. I am curious how it should be done, as I still have a vague understanding of graphics and threads.

As one of my projects is a shoot'em up, I was wondering if I should create one thread that displays all the graphics, one threads receives all the player input for his ship, and another thread for the enemy AI.

If this is NOT how it should be done, (I think it's wrong) does anyone have any advice of how graphics should be implemented with user input and enemy AI with threads?

For the Lazyfoo's tutorials, this is the link: http://lazyfoo.net/SDL_tutorials/

© Stack Overflow or respective owner

Related posts about sdl

Related posts about multithreading