mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Merge in default
--HG-- branch : minor
This commit is contained in:
@@ -361,6 +361,9 @@ int w_newImageFont(lua_State *L)
|
||||
Image::Filter img_filter;
|
||||
bool setFilter = false;
|
||||
|
||||
// For the filter modes..
|
||||
int startIndex = 2;
|
||||
|
||||
// Convert to ImageData if necessary.
|
||||
if (lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_T) || (luax_istype(L, 1, DATA_T) && !luax_istype(L, 1, IMAGE_IMAGE_DATA_T)))
|
||||
luax_convobj(L, 1, "image", "newImageData");
|
||||
@@ -379,16 +382,17 @@ int w_newImageFont(lua_State *L)
|
||||
{
|
||||
int idxs[] = {1, 2};
|
||||
luax_convobj(L, idxs, 2, "font", "newRasterizer");
|
||||
startIndex = 3; // There's a glyphs args in there, move up
|
||||
}
|
||||
|
||||
love::font::Rasterizer *rasterizer = luax_checktype<love::font::Rasterizer>(L, 1, "Rasterizer", FONT_RASTERIZER_T);
|
||||
|
||||
if (lua_isstring(L, 2) && lua_isstring(L, 3))
|
||||
if (lua_isstring(L, startIndex) && lua_isstring(L, startIndex+1))
|
||||
{
|
||||
Image::FilterMode min;
|
||||
Image::FilterMode mag;
|
||||
const char *minstr = luaL_checkstring(L, 2);
|
||||
const char *magstr = luaL_checkstring(L, 3);
|
||||
const char *minstr = luaL_checkstring(L, startIndex);
|
||||
const char *magstr = luaL_checkstring(L, startIndex+1);
|
||||
if (!Image::getConstant(minstr, min))
|
||||
return luaL_error(L, "Invalid filter mode: %s", minstr);
|
||||
if (!Image::getConstant(magstr, mag))
|
||||
@@ -449,14 +453,18 @@ int w_newParticleSystem(lua_State *L)
|
||||
int w_newCanvas(lua_State *L)
|
||||
{
|
||||
// check if width and height are given. else default to screen dimensions.
|
||||
int width = luaL_optint(L, 1, instance->getWidth());
|
||||
int height = luaL_optint(L, 2, instance->getHeight());
|
||||
glGetError(); // clear opengl error flag
|
||||
int width = luaL_optint(L, 1, instance->getWidth());
|
||||
int height = luaL_optint(L, 2, instance->getHeight());
|
||||
const char *str = luaL_optstring(L, 3, "normal");
|
||||
|
||||
Canvas::TextureType texture_type;
|
||||
if (!Canvas::getConstant(str, texture_type))
|
||||
return luaL_error(L, "Invalid canvas type: %s", str);
|
||||
|
||||
Canvas *canvas = NULL;
|
||||
try
|
||||
{
|
||||
canvas = instance->newCanvas(width, height);
|
||||
canvas = instance->newCanvas(width, height, texture_type);
|
||||
}
|
||||
catch(Exception &e)
|
||||
{
|
||||
@@ -874,6 +882,10 @@ int w_isSupported(lua_State *L)
|
||||
if (!Canvas::isSupported())
|
||||
supported = false;
|
||||
break;
|
||||
case Graphics::SUPPORT_HDR_CANVAS:
|
||||
if (!Canvas::isHdrSupported())
|
||||
supported = false;
|
||||
break;
|
||||
case Graphics::SUPPORT_PIXELEFFECT:
|
||||
if (!PixelEffect::isSupported())
|
||||
supported = false;
|
||||
|
||||
Reference in New Issue
Block a user