mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Rework internal module registration to happen in constructors.
This commit is contained in:
@@ -27,6 +27,11 @@ namespace sound
|
||||
|
||||
love::Type Sound::type("Sound", &Module::type);
|
||||
|
||||
Sound::Sound(const char *name)
|
||||
: Module(M_SOUND, name)
|
||||
{
|
||||
}
|
||||
|
||||
Sound::~Sound()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -46,9 +46,6 @@ public:
|
||||
|
||||
virtual ~Sound();
|
||||
|
||||
// Implements Module.
|
||||
virtual ModuleType getModuleType() const { return M_SOUND; }
|
||||
|
||||
/**
|
||||
* Creates new SoundData from a decoder. Fully expands the
|
||||
* encoded sound data into raw sound data. Not recommended
|
||||
@@ -89,6 +86,10 @@ public:
|
||||
**/
|
||||
virtual Decoder *newDecoder(Stream *stream, int bufferSize) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
Sound(const char *name);
|
||||
|
||||
}; // Sound
|
||||
|
||||
} // sound
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace lullaby
|
||||
{
|
||||
|
||||
Sound::Sound()
|
||||
: love::sound::Sound("love.sound.lullaby")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -66,11 +67,6 @@ Sound::~Sound()
|
||||
{
|
||||
}
|
||||
|
||||
const char *Sound::getName() const
|
||||
{
|
||||
return "love.sound.lullaby";
|
||||
}
|
||||
|
||||
sound::Decoder *Sound::newDecoder(Stream *stream, int bufferSize)
|
||||
{
|
||||
std::vector<DecoderImpl> possibleDecoders = {
|
||||
|
||||
@@ -48,9 +48,6 @@ public:
|
||||
Sound();
|
||||
virtual ~Sound();
|
||||
|
||||
/// @copydoc love::Module::getName
|
||||
const char *getName() const override;
|
||||
|
||||
/// @copydoc love::sound::Sound::newDecoder
|
||||
sound::Decoder *newDecoder(Stream *stream, int bufferSize) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user