Skip to content

Instantly share code, notes, and snippets.

@Symphonym
Created June 3, 2014 20:42
Show Gist options
  • Save Symphonym/2ae40f056aa8d70c4aab to your computer and use it in GitHub Desktop.
Save Symphonym/2ae40f056aa8d70c4aab to your computer and use it in GitHub Desktop.
HidingTest
namespace internal
{
// Forward declare OpenAL dependant classes
class ALSourceWrapper;
}
class AudioSource
{
private:
// This adds dependencies to the header file that I don't want
ALuint m_source;
// Something like this is what I'm currently using
std::unique_ptr<internal::ALSourceWrapper> m_source;
}
// AudioImpl.hpp
namespace internal
{
// This class will only be included in .cpp files so we can freely use
// external dependencies such as OpenAL and its types
struct ALSourceWrapper
{
ALuint source;
ALSourceWrapper()
{
alGenSources(1, &source);
}
~ALSourceWrapper()
{
alDeleteSources(1, &source);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment