SFML community forums

Help => General => Topic started by: barnack on June 16, 2018, 02:04:41 pm

Title: Single loop vs 2 threads
Post by: barnack on June 16, 2018, 02:04:41 pm


_________________________________________________________________
Just thought a thing:
can i have the input loop draw in memory a "temporary image" and the particles loop draw that temporary image on screen with then the particles on top of it? That way all i'd have to do is protecting with a single mutex the access to said temporary image! Does it work in your mind?
Title: Re: Single loop vs 2 threads
Post by: eXpl0it3r on June 17, 2018, 09:29:49 am
Multi-threading will introduce quite a bit of complexity (read: you will create a lot of unnecessary bugs) and it requires sone more advanced knowledge to pull it off properly.

What does it matter whether a separate thread is running a render loop or whether your main thead is doing so? Just setFramerateLimit to 15-30fps and use pollEvent.