I usually keep a global pointer to my topmost object instead of passing subsystems all over. Example: If I want to play a sound I do gGame->mSound->play(...). I always felt this was more sane than passing around pointers everywhere, but I feel kind of dirty. Good or no good?
-
Näytä tämä ketju
Vastauksena käyttäjälle @tuxedolabs
Bad for thread safety reasons. Possible to make Play() just queue a message under the hood, then be processed by Sound::Update(). I would do a namespace, hiding details in cpp file, like others have noted. Personal preference.
16.44 - 10. toukok. 2019
0 vastausta
0 uudelleentwiittausta
1 tykkäys
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.