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:
rude
2011-03-26 17:06:05 +01:00
parent 2a42c64a35
commit 3fe9b2ff16
37 changed files with 2055 additions and 2454 deletions
-70
View File
@@ -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
-40
View File
@@ -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
+40 -1
View File
@@ -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