mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Move luaopen_love_sound to love.sound.lullaby
--HG-- branch : minor
This commit is contained in:
+2
-2
@@ -51,7 +51,7 @@
|
||||
#include <keyboard/sdl/wrap_Keyboard.h>
|
||||
#include <mouse/sdl/wrap_Mouse.h>
|
||||
#include <physics/box2d/wrap_Physics.h>
|
||||
#include <sound/wrap_Sound.h>
|
||||
#include <sound/lullaby/wrap_Sound.h>
|
||||
#include <timer/sdl/wrap_Timer.h>
|
||||
#include <thread/sdl/wrap_Thread.h>
|
||||
|
||||
@@ -76,7 +76,7 @@ static const luaL_Reg modules[] = {
|
||||
{ "love.keyboard.sdl", love::keyboard::sdl::luaopen_love_keyboard },
|
||||
{ "love.mouse.sdl", love::mouse::sdl::luaopen_love_mouse },
|
||||
{ "love.physics.box2d", love::physics::box2d::luaopen_love_physics },
|
||||
{ "love.sound", love::sound::luaopen_love_sound },
|
||||
{ "love.sound.lullaby", love::sound::lullaby::luaopen_love_sound },
|
||||
{ "love.timer.sdl", love::timer::sdl::luaopen_love_timer },
|
||||
{ "love.thread.sdl", love::thread::sdl::luaopen_love_thread },
|
||||
{ 0, 0 }
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2011 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#include "wrap_Sound.h"
|
||||
|
||||
#include "Sound.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace sound
|
||||
{
|
||||
extern Sound * instance;
|
||||
namespace lullaby
|
||||
{
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] = {
|
||||
{ "newSoundData", w_newSoundData },
|
||||
{ "newDecoder", w_newDecoder },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static const lua_CFunction types[] = {
|
||||
luaopen_sounddata,
|
||||
luaopen_decoder,
|
||||
0
|
||||
};
|
||||
|
||||
int luaopen_love_sound(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
instance = new Sound();
|
||||
}
|
||||
catch(Exception & e)
|
||||
{
|
||||
return luaL_error(L, e.what());
|
||||
}
|
||||
}
|
||||
else
|
||||
instance->retain();
|
||||
|
||||
|
||||
WrappedModule w;
|
||||
w.module = instance;
|
||||
w.name = "sound";
|
||||
w.flags = MODULE_SOUND_T;
|
||||
w.functions = functions;
|
||||
w.types = types;
|
||||
|
||||
return luax_register_module(L, w);
|
||||
}
|
||||
|
||||
} // lullaby
|
||||
} // sound
|
||||
} // love
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2011 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_SOUND_LULLABY_WRAP_SOUND_H
|
||||
#define LOVE_SOUND_LULLABY_WRAP_SOUND_H
|
||||
|
||||
// LOVE
|
||||
#include "Sound.h"
|
||||
#include "sound/wrap_Sound.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace sound
|
||||
{
|
||||
namespace lullaby
|
||||
{
|
||||
extern "C" LOVE_EXPORT int luaopen_love_sound(lua_State * L);
|
||||
|
||||
} // lullaby
|
||||
} // sound
|
||||
} // love
|
||||
|
||||
#endif // LOVE_SOUND_LULLABY_WRAP_SOUND_H
|
||||
@@ -20,14 +20,11 @@
|
||||
|
||||
#include "wrap_Sound.h"
|
||||
|
||||
// Implementations.
|
||||
#include "lullaby/Sound.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace sound
|
||||
{
|
||||
static Sound * instance = 0;
|
||||
Sound * instance = 0;
|
||||
|
||||
int w_newSoundData(lua_State * L)
|
||||
{
|
||||
@@ -100,45 +97,5 @@ namespace sound
|
||||
return 1;
|
||||
}
|
||||
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] = {
|
||||
{ "newSoundData", w_newSoundData },
|
||||
{ "newDecoder", w_newDecoder },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static const lua_CFunction types[] = {
|
||||
luaopen_sounddata,
|
||||
luaopen_decoder,
|
||||
0
|
||||
};
|
||||
|
||||
int luaopen_love_sound(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
instance = new lullaby::Sound();
|
||||
}
|
||||
catch(Exception & e)
|
||||
{
|
||||
return luaL_error(L, e.what());
|
||||
}
|
||||
}
|
||||
else
|
||||
instance->retain();
|
||||
|
||||
|
||||
WrappedModule w;
|
||||
w.module = instance;
|
||||
w.name = "sound";
|
||||
w.flags = MODULE_SOUND_T;
|
||||
w.functions = functions;
|
||||
w.types = types;
|
||||
|
||||
return luax_register_module(L, w);
|
||||
}
|
||||
|
||||
} // sound
|
||||
} // love
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace sound
|
||||
{
|
||||
int w_newSoundData(lua_State * L);
|
||||
int w_newDecoder(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_sound(lua_State * L);
|
||||
|
||||
} // sound
|
||||
} // love
|
||||
|
||||
@@ -286,7 +286,7 @@ function love.init()
|
||||
keyboard = "sdl",
|
||||
mouse = "sdl",
|
||||
physics = "box2d",
|
||||
sound = false,
|
||||
sound = "lullaby",
|
||||
timer = "sdl",
|
||||
thread = "sdl"
|
||||
}
|
||||
|
||||
+1793
-1793
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user