mirror of
https://github.com/love2d/love.git
synced 2026-08-20 20:49:54 +02:00
Move luaopen_love_image from love.image to love.image.devil
--HG-- branch : minor
This commit is contained in:
+2
-2
@@ -46,7 +46,7 @@
|
|||||||
#include <filesystem/physfs/wrap_Filesystem.h>
|
#include <filesystem/physfs/wrap_Filesystem.h>
|
||||||
#include <font/freetype/wrap_Font.h>
|
#include <font/freetype/wrap_Font.h>
|
||||||
#include <graphics/opengl/wrap_Graphics.h>
|
#include <graphics/opengl/wrap_Graphics.h>
|
||||||
#include <image/wrap_Image.h>
|
#include <image/devil/wrap_Image.h>
|
||||||
#include <joystick/sdl/wrap_Joystick.h>
|
#include <joystick/sdl/wrap_Joystick.h>
|
||||||
#include <keyboard/sdl/wrap_Keyboard.h>
|
#include <keyboard/sdl/wrap_Keyboard.h>
|
||||||
#include <mouse/sdl/wrap_Mouse.h>
|
#include <mouse/sdl/wrap_Mouse.h>
|
||||||
@@ -71,7 +71,7 @@ static const luaL_Reg modules[] = {
|
|||||||
{ "love.filesystem.physfs", love::filesystem::physfs::luaopen_love_filesystem },
|
{ "love.filesystem.physfs", love::filesystem::physfs::luaopen_love_filesystem },
|
||||||
{ "love.font.freetype", love::font::freetype::luaopen_love_font },
|
{ "love.font.freetype", love::font::freetype::luaopen_love_font },
|
||||||
{ "love.graphics.opengl", love::graphics::opengl::luaopen_love_graphics },
|
{ "love.graphics.opengl", love::graphics::opengl::luaopen_love_graphics },
|
||||||
{ "love.image", love::image::luaopen_love_image },
|
{ "love.image.devil", love::image::devil::luaopen_love_image },
|
||||||
{ "love.joystick.sdl", love::joystick::sdl::luaopen_love_joystick },
|
{ "love.joystick.sdl", love::joystick::sdl::luaopen_love_joystick },
|
||||||
{ "love.keyboard.sdl", love::keyboard::sdl::luaopen_love_keyboard },
|
{ "love.keyboard.sdl", love::keyboard::sdl::luaopen_love_keyboard },
|
||||||
{ "love.mouse.sdl", love::mouse::sdl::luaopen_love_mouse },
|
{ "love.mouse.sdl", love::mouse::sdl::luaopen_love_mouse },
|
||||||
|
|||||||
@@ -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_Image.h"
|
||||||
|
#include "image/EncodedImageData.h"
|
||||||
|
#include "image/wrap_EncodedImageData.h"
|
||||||
|
|
||||||
|
namespace love
|
||||||
|
{
|
||||||
|
namespace image
|
||||||
|
{
|
||||||
|
extern Image * instance;
|
||||||
|
|
||||||
|
namespace devil
|
||||||
|
{
|
||||||
|
// List of functions to wrap.
|
||||||
|
static const luaL_Reg functions[] = {
|
||||||
|
{ "newImageData", w_newImageData },
|
||||||
|
{ "newEncodedImageData", w_newEncodedImageData },
|
||||||
|
{ 0, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
|
static const lua_CFunction types[] = {
|
||||||
|
luaopen_imagedata,
|
||||||
|
luaopen_encodedimagedata,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
int luaopen_love_image(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
|
||||||
@@ -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_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(lua_State * L);
|
||||||
|
|
||||||
|
} //devil
|
||||||
|
} // image
|
||||||
|
} // love
|
||||||
|
|
||||||
|
#endif // LOVE_IMAGE_DEVIL_WRAP_IMAGE_H
|
||||||
@@ -26,14 +26,11 @@
|
|||||||
#include <common/Data.h>
|
#include <common/Data.h>
|
||||||
#include <common/StringMap.h>
|
#include <common/StringMap.h>
|
||||||
|
|
||||||
#include "devil/Image.h"
|
|
||||||
#include "devil/ImageData.h"
|
|
||||||
|
|
||||||
namespace love
|
namespace love
|
||||||
{
|
{
|
||||||
namespace image
|
namespace image
|
||||||
{
|
{
|
||||||
static Image * instance = 0;
|
Image * instance = 0;
|
||||||
|
|
||||||
int w_newImageData(lua_State * L)
|
int w_newImageData(lua_State * L)
|
||||||
{
|
{
|
||||||
@@ -89,45 +86,6 @@ namespace image
|
|||||||
luax_newtype(L, "EncodedImageData", IMAGE_ENCODED_IMAGE_DATA_T, (void*)eid);
|
luax_newtype(L, "EncodedImageData", IMAGE_ENCODED_IMAGE_DATA_T, (void*)eid);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of functions to wrap.
|
|
||||||
static const luaL_Reg functions[] = {
|
|
||||||
{ "newImageData", w_newImageData },
|
|
||||||
{ "newEncodedImageData", w_newEncodedImageData },
|
|
||||||
{ 0, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
static const lua_CFunction types[] = {
|
|
||||||
luaopen_imagedata,
|
|
||||||
luaopen_encodedimagedata,
|
|
||||||
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
|
} // image
|
||||||
} // love
|
} // love
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ function love.init()
|
|||||||
filesystem = "physfs",
|
filesystem = "physfs",
|
||||||
font = "freetype",
|
font = "freetype",
|
||||||
graphics = "opengl",
|
graphics = "opengl",
|
||||||
image = false,
|
image = "devil",
|
||||||
joystick = "sdl",
|
joystick = "sdl",
|
||||||
keyboard = "sdl",
|
keyboard = "sdl",
|
||||||
mouse = "sdl",
|
mouse = "sdl",
|
||||||
|
|||||||
+1793
-1793
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user