mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Reverted module selection feature. This is not really desired.
Users (or lovers) do not get to choose which implementation of a module they would like to use. The abstraction is for dealing with portability issues, not for giving people the ability to choose an alternative (inferior) backend. The best choice for any platform/situation should at all times be the *default* for that platform/situation. If this is not the case; it's a bug (that is easily fixed). Any module should provide the functionality promised in the docs. The lover (or user) should not care how, and if [s]he does, [s]he does still not get to choose. Also, a related note: duplication of wrapper code is something I especially wanted to avoid when I first (or should I say ... "eventually") formed the current architecture. --HG-- branch : minor
This commit is contained in:
@@ -1,98 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
|
||||
// LOVE
|
||||
#include "wrap_Audio.h"
|
||||
|
||||
#include "Audio.h"
|
||||
|
||||
#include <scripts/audio.lua.h>
|
||||
|
||||
#include <common/runtime.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace audio
|
||||
{
|
||||
extern Audio * instance;
|
||||
namespace null
|
||||
{
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] = {
|
||||
{ "getNumSources", w_getNumSources },
|
||||
{ "newSource1", w_newSource1 },
|
||||
{ "play", w_play },
|
||||
{ "stop", w_stop },
|
||||
{ "pause", w_pause },
|
||||
{ "resume", w_resume },
|
||||
{ "rewind", w_rewind },
|
||||
{ "setVolume", w_setVolume },
|
||||
{ "getVolume", w_getVolume },
|
||||
{ "setPosition", w_setPosition },
|
||||
{ "getPosition", w_getPosition },
|
||||
{ "setOrientation", w_setOrientation },
|
||||
{ "getOrientation", w_getOrientation },
|
||||
{ "setVelocity", w_setVelocity },
|
||||
{ "getVelocity", w_getVelocity },
|
||||
/*{ "record", w_record },
|
||||
{ "getRecordedData", w_getRecordedData },
|
||||
{ "stopRecording", w_stopRecording },*/
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static const lua_CFunction types[] = {
|
||||
luaopen_source,
|
||||
0
|
||||
};
|
||||
|
||||
int luaopen_love_audio_null(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
instance = new Audio();
|
||||
}
|
||||
catch(love::Exception & e)
|
||||
{
|
||||
return luaL_error(L, "Could not open any audio module.");
|
||||
}
|
||||
}
|
||||
else
|
||||
instance->retain();
|
||||
|
||||
WrappedModule w;
|
||||
w.module = instance;
|
||||
w.name = "audio";
|
||||
w.flags = MODULE_T;
|
||||
w.functions = functions;
|
||||
w.types = types;
|
||||
|
||||
luax_register_module(L, w);
|
||||
|
||||
if (luaL_loadbuffer(L, (const char *)audio_lua, sizeof(audio_lua), "audio.lua") == 0)
|
||||
lua_call(L, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // null
|
||||
} // audio
|
||||
} // love
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* 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_AUDIO_NULL_WRAP_AUDIO_H
|
||||
#define LOVE_AUDIO_NULL_WRAP_AUDIO_H
|
||||
|
||||
// LOVE
|
||||
#include "audio/wrap_Audio.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace audio
|
||||
{
|
||||
namespace null
|
||||
{
|
||||
extern "C" LOVE_EXPORT int luaopen_love_audio_null(lua_State * L);
|
||||
|
||||
} // openal
|
||||
} // audio
|
||||
} // love
|
||||
|
||||
#endif // LOVE_AUDIO_NULL_WRAP_AUDIO_H
|
||||
@@ -1,116 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
**/
|
||||
|
||||
// LOVE
|
||||
#include "wrap_Audio.h"
|
||||
|
||||
#include "Audio.h"
|
||||
#include "audio/null/Audio.h"
|
||||
|
||||
#include <scripts/audio.lua.h>
|
||||
|
||||
#include <common/runtime.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace audio
|
||||
{
|
||||
extern Audio * instance;
|
||||
namespace openal
|
||||
{
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] = {
|
||||
{ "getNumSources", w_getNumSources },
|
||||
{ "newSource1", w_newSource1 },
|
||||
{ "play", w_play },
|
||||
{ "stop", w_stop },
|
||||
{ "pause", w_pause },
|
||||
{ "resume", w_resume },
|
||||
{ "rewind", w_rewind },
|
||||
{ "setVolume", w_setVolume },
|
||||
{ "getVolume", w_getVolume },
|
||||
{ "setPosition", w_setPosition },
|
||||
{ "getPosition", w_getPosition },
|
||||
{ "setOrientation", w_setOrientation },
|
||||
{ "getOrientation", w_getOrientation },
|
||||
{ "setVelocity", w_setVelocity },
|
||||
{ "getVelocity", w_getVelocity },
|
||||
/*{ "record", w_record },
|
||||
{ "getRecordedData", w_getRecordedData },
|
||||
{ "stopRecording", w_stopRecording },*/
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static const lua_CFunction types[] = {
|
||||
luaopen_source,
|
||||
0
|
||||
};
|
||||
|
||||
int luaopen_love_audio_openal(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
// Try OpenAL first.
|
||||
try
|
||||
{
|
||||
instance = new love::audio::openal::Audio();
|
||||
}
|
||||
catch(love::Exception & e)
|
||||
{
|
||||
std::cout << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
instance->retain();
|
||||
|
||||
if(instance == 0)
|
||||
{
|
||||
// Fall back to nullaudio.
|
||||
try
|
||||
{
|
||||
instance = new love::audio::null::Audio();
|
||||
}
|
||||
catch(love::Exception & e)
|
||||
{
|
||||
std::cout << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if(instance == 0)
|
||||
return luaL_error(L, "Could not open any audio module.");
|
||||
|
||||
WrappedModule w;
|
||||
w.module = instance;
|
||||
w.name = "audio";
|
||||
w.flags = MODULE_T;
|
||||
w.functions = functions;
|
||||
w.types = types;
|
||||
|
||||
luax_register_module(L, w);
|
||||
|
||||
if (luaL_loadbuffer(L, (const char *)audio_lua, sizeof(audio_lua), "audio.lua") == 0)
|
||||
lua_call(L, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // openal
|
||||
} // audio
|
||||
} // love
|
||||
@@ -1,39 +0,0 @@
|
||||
/**
|
||||
* 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_AUDIO_OPENAL_WRAP_AUDIO_H
|
||||
#define LOVE_AUDIO_OPENAL_WRAP_AUDIO_H
|
||||
|
||||
// LOVE
|
||||
#include "audio/wrap_Audio.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace audio
|
||||
{
|
||||
namespace openal
|
||||
{
|
||||
extern "C" LOVE_EXPORT int luaopen_love_audio_openal(lua_State * L);
|
||||
|
||||
} // openal
|
||||
} // audio
|
||||
} // love
|
||||
|
||||
#endif // LOVE_AUDIO_OPENAL_WRAP_AUDIO_H
|
||||
@@ -21,6 +21,7 @@
|
||||
// LOVE
|
||||
#include "wrap_Audio.h"
|
||||
|
||||
#include "openal/Audio.h"
|
||||
#include "null/Audio.h"
|
||||
|
||||
#include <scripts/audio.lua.h>
|
||||
@@ -31,7 +32,7 @@ namespace love
|
||||
{
|
||||
namespace audio
|
||||
{
|
||||
Audio * instance = 0;
|
||||
static Audio * instance = 0;
|
||||
|
||||
int w_getNumSources(lua_State * L)
|
||||
{
|
||||
@@ -234,5 +235,81 @@ namespace audio
|
||||
}
|
||||
|
||||
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] = {
|
||||
{ "getNumSources", w_getNumSources },
|
||||
{ "newSource1", w_newSource1 },
|
||||
{ "play", w_play },
|
||||
{ "stop", w_stop },
|
||||
{ "pause", w_pause },
|
||||
{ "resume", w_resume },
|
||||
{ "rewind", w_rewind },
|
||||
{ "setVolume", w_setVolume },
|
||||
{ "getVolume", w_getVolume },
|
||||
{ "setPosition", w_setPosition },
|
||||
{ "getPosition", w_getPosition },
|
||||
{ "setOrientation", w_setOrientation },
|
||||
{ "getOrientation", w_getOrientation },
|
||||
{ "setVelocity", w_setVelocity },
|
||||
{ "getVelocity", w_getVelocity },
|
||||
/*{ "record", w_record },
|
||||
{ "getRecordedData", w_getRecordedData },
|
||||
{ "stopRecording", w_stopRecording },*/
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static const lua_CFunction types[] = {
|
||||
luaopen_source,
|
||||
0
|
||||
};
|
||||
|
||||
int luaopen_love_audio(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
// Try OpenAL first.
|
||||
try
|
||||
{
|
||||
instance = new love::audio::openal::Audio();
|
||||
}
|
||||
catch(love::Exception & e)
|
||||
{
|
||||
std::cout << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
instance->retain();
|
||||
|
||||
if(instance == 0)
|
||||
{
|
||||
// Fall back to nullaudio.
|
||||
try
|
||||
{
|
||||
instance = new love::audio::null::Audio();
|
||||
}
|
||||
catch(love::Exception & e)
|
||||
{
|
||||
std::cout << e.what() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if(instance == 0)
|
||||
return luaL_error(L, "Could not open any audio module.");
|
||||
|
||||
WrappedModule w;
|
||||
w.module = instance;
|
||||
w.name = "audio";
|
||||
w.flags = MODULE_T;
|
||||
w.functions = functions;
|
||||
w.types = types;
|
||||
|
||||
luax_register_module(L, w);
|
||||
|
||||
if (luaL_loadbuffer(L, (const char *)audio_lua, sizeof(audio_lua), "audio.lua") == 0)
|
||||
lua_call(L, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // audio
|
||||
} // love
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace audio
|
||||
int w_getRecordedData(lua_State * L);
|
||||
int w_stopRecording(lua_State * L);
|
||||
int w_canRecord(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_audio(lua_State * L);
|
||||
|
||||
} // audio
|
||||
} // love
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace sdl
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
int luaopen_love_event_sdl(lua_State * L)
|
||||
int luaopen_love_event(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace sdl
|
||||
int w_wait(lua_State * L);
|
||||
int w_push(lua_State * L);
|
||||
|
||||
extern "C" LOVE_EXPORT int luaopen_love_event_sdl(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_event(lua_State * L);
|
||||
|
||||
} // sdl
|
||||
} // event
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace physfs
|
||||
0
|
||||
};
|
||||
|
||||
int luaopen_love_filesystem_physfs(lua_State * L)
|
||||
int luaopen_love_filesystem(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace physfs
|
||||
int w_load(lua_State * L);
|
||||
int w_getLastModified(lua_State * L);
|
||||
int loader(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_filesystem_physfs(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_filesystem(lua_State * L);
|
||||
|
||||
} // physfs
|
||||
} // filesystem
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace freetype
|
||||
0
|
||||
};
|
||||
|
||||
int luaopen_love_font_freetype(lua_State * L)
|
||||
int luaopen_love_font(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace freetype
|
||||
int w_newRasterizer(lua_State * L);
|
||||
int w_newGlyphData(lua_State * L);
|
||||
int w_newFontData(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_font_freetype(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_font(lua_State * L);
|
||||
|
||||
} // freetype
|
||||
} // font
|
||||
|
||||
@@ -1053,7 +1053,7 @@ namespace opengl
|
||||
0
|
||||
};
|
||||
|
||||
int luaopen_love_graphics_opengl(lua_State * L)
|
||||
int luaopen_love_graphics(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace opengl
|
||||
int w_scale(lua_State * L);
|
||||
int w_translate(lua_State * L);
|
||||
int w_hasFocus(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_graphics_opengl(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_graphics(lua_State * L);
|
||||
|
||||
} // opengl
|
||||
} // graphics
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/**
|
||||
* 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_Image.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace image
|
||||
{
|
||||
extern Image * instance;
|
||||
|
||||
namespace devil
|
||||
{
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] = {
|
||||
{ "newImageData", w_newImageData },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static const lua_CFunction types[] = {
|
||||
luaopen_imagedata,
|
||||
0
|
||||
};
|
||||
|
||||
int luaopen_love_image_devil(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
instance = new Image();
|
||||
}
|
||||
catch(Exception & e)
|
||||
{
|
||||
return luaL_error(L, e.what());
|
||||
}
|
||||
}
|
||||
else
|
||||
instance->retain();
|
||||
|
||||
WrappedModule w;
|
||||
w.module = instance;
|
||||
w.name = "image";
|
||||
w.flags = MODULE_IMAGE_T;
|
||||
w.functions = functions;
|
||||
w.types = types;
|
||||
|
||||
return luax_register_module(L, w);
|
||||
}
|
||||
|
||||
} // devil
|
||||
} // image
|
||||
} // love
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* 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_IMAGE_DEVIL_WRAP_IMAGE_H
|
||||
#define LOVE_IMAGE_DEVIL_WRAP_IMAGE_H
|
||||
|
||||
// LOVE
|
||||
#include "image/wrap_Image.h"
|
||||
#include "Image.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace image
|
||||
{
|
||||
namespace devil
|
||||
{
|
||||
extern "C" LOVE_EXPORT int luaopen_love_image_devil(lua_State * L);
|
||||
|
||||
} //devil
|
||||
} // image
|
||||
} // love
|
||||
|
||||
#endif // LOVE_IMAGE_DEVIL_WRAP_IMAGE_H
|
||||
@@ -23,11 +23,13 @@
|
||||
#include <common/Data.h>
|
||||
#include <common/StringMap.h>
|
||||
|
||||
#include "devil/Image.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace image
|
||||
{
|
||||
Image * instance = 0;
|
||||
static Image * instance = 0;
|
||||
|
||||
int w_newImageData(lua_State * L)
|
||||
{
|
||||
@@ -73,6 +75,43 @@ namespace image
|
||||
luax_newtype(L, "ImageData", IMAGE_IMAGE_DATA_T, (void*)t);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// List of functions to wrap.
|
||||
static const luaL_Reg functions[] = {
|
||||
{ "newImageData", w_newImageData },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static const lua_CFunction types[] = {
|
||||
luaopen_imagedata,
|
||||
0
|
||||
};
|
||||
|
||||
int luaopen_love_image(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
instance = new love::image::devil::Image();
|
||||
}
|
||||
catch(Exception & e)
|
||||
{
|
||||
return luaL_error(L, e.what());
|
||||
}
|
||||
}
|
||||
else
|
||||
instance->retain();
|
||||
|
||||
WrappedModule w;
|
||||
w.module = instance;
|
||||
w.name = "image";
|
||||
w.flags = MODULE_IMAGE_T;
|
||||
w.functions = functions;
|
||||
w.types = types;
|
||||
|
||||
return luax_register_module(L, w);
|
||||
}
|
||||
|
||||
} // image
|
||||
} // love
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace sdl
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
int luaopen_love_joystick_sdl(lua_State * L)
|
||||
int luaopen_love_joystick(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace sdl
|
||||
int w_isDown(lua_State * L);
|
||||
int w_getHat(lua_State * L);
|
||||
int w_close(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_joystick_sdl(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_joystick(lua_State * L);
|
||||
|
||||
} // sdl
|
||||
} // joystick
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace sdl
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
int luaopen_love_keyboard_sdl(lua_State * L)
|
||||
int luaopen_love_keyboard(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace sdl
|
||||
int w_isDown(lua_State * L);
|
||||
int w_setKeyRepeat(lua_State * L);
|
||||
int w_getKeyRepeat(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_keyboard_sdl(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_keyboard(lua_State * L);
|
||||
|
||||
} // sdl
|
||||
} // keyboard
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace sdl
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
int luaopen_love_mouse_sdl(lua_State * L)
|
||||
int luaopen_love_mouse(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace sdl
|
||||
int w_isVisible(lua_State * L);
|
||||
int w_setGrap(lua_State * L);
|
||||
int w_isGrabbed(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_mouse_sdl(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_mouse(lua_State * L);
|
||||
|
||||
} // sdl
|
||||
} // mouse
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace box2d
|
||||
0
|
||||
};
|
||||
|
||||
int luaopen_love_physics_box2d(lua_State * L)
|
||||
int luaopen_love_physics(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace box2d
|
||||
int w_newPrismaticJoint(lua_State * L);
|
||||
int w_newPulleyJoint(lua_State * L);
|
||||
int w_newGearJoint(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_physics_box2d(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_physics(lua_State * L);
|
||||
|
||||
} // box2d
|
||||
} // physics
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/**
|
||||
* 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_lullaby(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
|
||||
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* 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_lullaby(lua_State * L);
|
||||
|
||||
} // lullaby
|
||||
} // sound
|
||||
} // love
|
||||
|
||||
#endif // LOVE_SOUND_LULLABY_WRAP_SOUND_H
|
||||
@@ -20,11 +20,14 @@
|
||||
|
||||
#include "wrap_Sound.h"
|
||||
|
||||
// Implementations.
|
||||
#include "lullaby/Sound.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace sound
|
||||
{
|
||||
Sound * instance = 0;
|
||||
static Sound * instance = 0;
|
||||
|
||||
int w_newSoundData(lua_State * L)
|
||||
{
|
||||
@@ -97,5 +100,45 @@ 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,6 +33,7 @@ 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
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#ifdef LOVE_BUILD_STANDALONE
|
||||
extern "C" int luaopen_love(lua_State * L);
|
||||
#endif // LOVE_BUILD_STANDALONE
|
||||
extern "C" int luaopen_love_thread_sdl(lua_State *L);
|
||||
extern "C" int luaopen_love_thread(lua_State *L);
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -41,7 +41,7 @@ namespace sdl
|
||||
love::luax_preload(L, luaopen_love, "love");
|
||||
luaopen_love(L);
|
||||
#endif // LOVE_BUILD_STANDALONE
|
||||
luaopen_love_thread_sdl(L);
|
||||
luaopen_love_thread(L);
|
||||
{
|
||||
size_t len;
|
||||
const char *name = comm->getName(&len);
|
||||
|
||||
@@ -356,7 +356,7 @@ namespace sdl
|
||||
0
|
||||
};
|
||||
|
||||
int luaopen_love_thread_sdl(lua_State *L)
|
||||
int luaopen_love_thread(lua_State *L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace sdl
|
||||
int w_getThreads(lua_State *L);
|
||||
int w_getThread(lua_State *L);
|
||||
|
||||
extern "C" LOVE_EXPORT int luaopen_love_thread_sdl(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_thread(lua_State * L);
|
||||
} // sdl
|
||||
} // thread
|
||||
} // love
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace sdl
|
||||
};
|
||||
|
||||
|
||||
int luaopen_love_timer_sdl(lua_State * L)
|
||||
int luaopen_love_timer(lua_State * L)
|
||||
{
|
||||
if(instance == 0)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace sdl
|
||||
int w_sleep(lua_State * L);
|
||||
int w_getTime(lua_State * L);
|
||||
int w_getMicroTime(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_timer_sdl(lua_State * L);
|
||||
extern "C" LOVE_EXPORT int luaopen_love_timer(lua_State * L);
|
||||
|
||||
} // sdl
|
||||
} // timer
|
||||
|
||||
Reference in New Issue
Block a user