Merged default into minor

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2014-08-30 22:08:10 -03:00
9 changed files with 71 additions and 80 deletions
+3
View File
@@ -390,7 +390,10 @@ void luax_rawnewtype(lua_State *L, const char *name, bits flags, love::Object *o
void luax_pushtype(lua_State *L, const char *name, bits flags, love::Object *object)
{
if (object == nullptr)
{
lua_pushnil(L);
return;
}
// Fetch the registry table of instantiated types.
luax_getregistry(L, REGISTRY_TYPES);
+20
View File
@@ -109,6 +109,9 @@ void Graphics::restoreState(const DisplayState &s)
setColorMask(s.colorMask);
setWireframe(s.wireframe);
setDefaultFilter(s.defaultFilter);
setDefaultMipmapFilter(s.defaultMipmapFilter, s.defaultMipmapSharpness);
}
void Graphics::restoreStateChecked(const DisplayState &s)
@@ -166,6 +169,9 @@ void Graphics::restoreStateChecked(const DisplayState &s)
if (s.wireframe != cur.wireframe)
setWireframe(s.wireframe);
setDefaultFilter(s.defaultFilter);
setDefaultMipmapFilter(s.defaultMipmapFilter, s.defaultMipmapSharpness);
}
void Graphics::setViewportSize(int width, int height)
@@ -847,6 +853,7 @@ Graphics::BlendMode Graphics::getBlendMode() const
void Graphics::setDefaultFilter(const Texture::Filter &f)
{
Texture::setDefaultFilter(f);
states.back().defaultFilter = f;
}
const Texture::Filter &Graphics::getDefaultFilter() const
@@ -858,6 +865,9 @@ void Graphics::setDefaultMipmapFilter(Texture::FilterMode filter, float sharpnes
{
Image::setDefaultMipmapFilter(filter);
Image::setDefaultMipmapSharpness(sharpness);
states.back().defaultMipmapFilter = filter;
states.back().defaultMipmapSharpness = sharpness;
}
void Graphics::getDefaultMipmapFilter(Texture::FilterMode *filter, float *sharpness) const
@@ -1365,6 +1375,9 @@ Graphics::DisplayState::DisplayState()
, font(nullptr)
, shader(nullptr)
, wireframe(false)
, defaultFilter()
, defaultMipmapFilter(Texture::FILTER_NEAREST)
, defaultMipmapSharpness(0.0f)
{
// We should just directly initialize the array in the initializer list, but
// that feature of C++11 is broken in Visual Studio 2013...
@@ -1387,6 +1400,9 @@ Graphics::DisplayState::DisplayState(const DisplayState &other)
, shader(other.shader)
, canvases(other.canvases)
, wireframe(other.wireframe)
, defaultFilter(other.defaultFilter)
, defaultMipmapFilter(other.defaultMipmapFilter)
, defaultMipmapSharpness(other.defaultMipmapSharpness)
{
for (int i = 0; i < 4; i++)
colorMask[i] = other.colorMask[i];
@@ -1419,6 +1435,10 @@ Graphics::DisplayState &Graphics::DisplayState::operator = (const DisplayState &
wireframe = other.wireframe;
defaultFilter = other.defaultFilter;
defaultMipmapFilter = other.defaultMipmapFilter;
defaultMipmapSharpness = other.defaultMipmapSharpness;
return *this;
}
+7
View File
@@ -456,6 +456,13 @@ private:
bool wireframe;
// Default filter.
Texture::Filter defaultFilter;
// Default mipmap filter and sharpness.
Texture::FilterMode defaultMipmapFilter;
float defaultMipmapSharpness;
DisplayState();
DisplayState(const DisplayState &other);
~DisplayState();
-52
View File
@@ -529,58 +529,6 @@ void OpenGL::setTextureFilter(graphics::Texture::Filter &f)
f.anisotropy = 1.0f;
}
graphics::Texture::Filter OpenGL::getTextureFilter()
{
GLint gmin, gmag;
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, &gmin);
glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &gmag);
Texture::Filter f;
switch (gmin)
{
case GL_NEAREST:
f.min = Texture::FILTER_NEAREST;
f.mipmap = Texture::FILTER_NONE;
break;
case GL_NEAREST_MIPMAP_NEAREST:
f.min = f.mipmap = Texture::FILTER_NEAREST;
break;
case GL_NEAREST_MIPMAP_LINEAR:
f.min = Texture::FILTER_NEAREST;
f.mipmap = Texture::FILTER_LINEAR;
break;
case GL_LINEAR_MIPMAP_NEAREST:
f.min = Texture::FILTER_LINEAR;
f.mipmap = Texture::FILTER_NEAREST;
break;
case GL_LINEAR_MIPMAP_LINEAR:
f.min = f.mipmap = Texture::FILTER_LINEAR;
break;
case GL_LINEAR:
default:
f.min = Texture::FILTER_LINEAR;
f.mipmap = Texture::FILTER_NONE;
break;
}
switch (gmag)
{
case GL_NEAREST:
f.mag = Texture::FILTER_NEAREST;
break;
case GL_LINEAR:
default:
f.mag = Texture::FILTER_LINEAR;
break;
}
if (GLAD_EXT_texture_filter_anisotropic)
glGetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, &f.anisotropy);
return f;
}
void OpenGL::setTextureWrap(const graphics::Texture::Wrap &w)
{
GLint gs, gt;
-5
View File
@@ -276,11 +276,6 @@ public:
**/
void setTextureFilter(graphics::Texture::Filter &f);
/**
* Returns the texture filter mode for the currently bound texture.
**/
graphics::Texture::Filter getTextureFilter();
/**
* Sets the texture wrap mode for the currently bound texture.
**/
+1 -1
View File
@@ -58,7 +58,7 @@ public:
* a single block of memory containing all the images.
*
* @param[in] filedata The data to parse.
* @param[out] image The list of sub-images generated. Byte data is a pointer
* @param[out] images The list of sub-images generated. Byte data is a pointer
* to the returned data.
* @param[out] dataSize The total size in bytes of the returned data.
* @param[out] format The format of the Compressed Data.
+12 -8
View File
@@ -218,8 +218,8 @@ bool JoystickModule::setGamepadMapping(const std::string &guid, Joystick::Gamepa
joyinputstream << "b" << joyinput.button;
break;
case Joystick::INPUT_TYPE_HAT:
if (joyinput.hat.value >= 0 && Joystick::getConstant(joyinput.hat.value, sdlhat))
joyinputstream << "h" << joyinput.hat.value << "." << int(sdlhat);
if (joyinput.hat.index >= 0 && Joystick::getConstant(joyinput.hat.value, sdlhat))
joyinputstream << "h" << joyinput.hat.index << "." << int(sdlhat);
break;
default:
break;
@@ -297,7 +297,7 @@ Joystick::JoystickInput JoystickModule::getGamepadMapping(const std::string &gui
if (findpos == std::string::npos)
return jinput;
size_t endpos = mapstr.find_first_of(',', findpos);
size_t endpos = mapstr.find_first_of(',', findpos + 1);
if (endpos == std::string::npos)
{
// Assume end-of-string if we can't find the next comma.
@@ -364,19 +364,19 @@ Joystick::JoystickInput JoystickModule::JoystickInputFromString(const std::strin
{
case 'a':
jinput.type = Joystick::INPUT_TYPE_AXIS;
jinput.axis = atoi(bindvalues.c_str());
jinput.axis = (int) strtol(bindvalues.c_str(), nullptr, 10);
break;
case 'b':
jinput.type = Joystick::INPUT_TYPE_BUTTON;
jinput.button = atoi(bindvalues.c_str());
jinput.button = (int) strtol(bindvalues.c_str(), nullptr, 10);
break;
case 'h':
// Hat string syntax is "index.value".
if (bindvalues.length() < 3)
break;
jinput.type = Joystick::INPUT_TYPE_HAT;
jinput.hat.index = atoi(bindvalues.substr(0, 1).c_str());
sdlhat = (Uint8) atoi(bindvalues.substr(2, 1).c_str());
jinput.hat.index = (int) strtol(bindvalues.substr(0, 1).c_str(), nullptr, 10);
sdlhat = (Uint8) strtol(bindvalues.substr(2).c_str(), nullptr, 10);
if (!Joystick::getConstant(sdlhat, jinput.hat.value))
{
// Return an invalid value if we can't find the hat constant.
@@ -405,10 +405,14 @@ void JoystickModule::removeBindFromMapString(std::string &mapstr, const std::str
if (joybindpos == std::string::npos)
return;
// Find the start of the entire bind.
// Find the start of the entire bind by looking for the separator between
// the end of one section of the map string and the start of this section.
size_t bindstart = mapstr.rfind(',', joybindpos);
if (bindstart != std::string::npos && bindstart < mapstr.length() - 1)
{
// The start of the bind is directly after the separator.
bindstart++;
size_t bindend = mapstr.find(',', bindstart + 1);
if (bindend == std::string::npos)
bindend = mapstr.length() - 1;
+9 -6
View File
@@ -343,12 +343,11 @@ function love.init()
-- Yes, conf.lua might not exist, but there are other ways of making
-- love.conf appear, so we should check for it anyway.
local confok, conferr
if love.conf then
local ok, err = pcall(love.conf, c)
if not ok then
print(err)
-- continue
end
confok, conferr = pcall(love.conf, c)
-- If love.conf errors, we'll trigger the error after loading modules so
-- the error message can be displayed in the window.
end
if love.arg.options.console.set then
@@ -387,6 +386,10 @@ function love.init()
love.createhandlers()
end
if not confok and conferr then
error(conferr)
end
-- Setup window here.
if c.window and c.modules.window then
assert(love.window.setMode(c.window.width, c.window.height,
@@ -1552,7 +1555,7 @@ function love.errhand(msg)
local font = love.graphics.setNewFont(math.floor(14 * love.window.getPixelScale()))
local sRGB = select(3, love.window.getMode()).srgb
if sRGB then
if sRGB and love.math then
love.graphics.setBackgroundColor(love.math.gammaToLinear(89, 157, 220))
else
love.graphics.setBackgroundColor(89, 157, 220)
+19 -8
View File
@@ -617,14 +617,20 @@ const unsigned char boot_lua[] =
0x61, 0x72, 0x2c, 0x20, 0x73, 0x6f, 0x20, 0x77, 0x65, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x63,
0x68, 0x65, 0x63, 0x6b, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x69, 0x74, 0x20, 0x61, 0x6e, 0x79, 0x77, 0x61, 0x79,
0x2e, 0x0a,
0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x6b, 0x2c, 0x20, 0x63, 0x6f, 0x6e,
0x66, 0x65, 0x72, 0x72, 0x0a,
0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6f, 0x6b, 0x2c, 0x20, 0x65, 0x72, 0x72, 0x20, 0x3d, 0x20,
0x70, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2c, 0x20, 0x63,
0x29, 0x0a,
0x09, 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6f, 0x6b, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
0x09, 0x09, 0x09, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x28, 0x65, 0x72, 0x72, 0x29, 0x0a,
0x09, 0x09, 0x09, 0x2d, 0x2d, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x0a,
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
0x09, 0x09, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x6b, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x65, 0x72, 0x72, 0x20,
0x3d, 0x20, 0x70, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2c,
0x20, 0x63, 0x29, 0x0a,
0x09, 0x09, 0x2d, 0x2d, 0x20, 0x49, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x20,
0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2c, 0x20, 0x77, 0x65, 0x27, 0x6c, 0x6c, 0x20, 0x74, 0x72, 0x69, 0x67,
0x67, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x61, 0x66, 0x74, 0x65,
0x72, 0x20, 0x6c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x20,
0x73, 0x6f, 0x0a,
0x09, 0x09, 0x2d, 0x2d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x6d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61,
0x79, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x0a,
0x09, 0x65, 0x6e, 0x64, 0x0a,
0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x61, 0x72, 0x67, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x2e, 0x73, 0x65, 0x74, 0x20, 0x74, 0x68, 0x65,
@@ -669,6 +675,10 @@ const unsigned char boot_lua[] =
0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x68, 0x61, 0x6e, 0x64, 0x6c,
0x65, 0x72, 0x73, 0x28, 0x29, 0x0a,
0x09, 0x65, 0x6e, 0x64, 0x0a,
0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x6b, 0x20, 0x61, 0x6e, 0x64,
0x20, 0x63, 0x6f, 0x6e, 0x66, 0x65, 0x72, 0x72, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
0x09, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x28, 0x63, 0x6f, 0x6e, 0x66, 0x65, 0x72, 0x72, 0x29, 0x0a,
0x09, 0x65, 0x6e, 0x64, 0x0a,
0x09, 0x2d, 0x2d, 0x20, 0x53, 0x65, 0x74, 0x75, 0x70, 0x20, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x20, 0x68,
0x65, 0x72, 0x65, 0x2e, 0x0a,
0x09, 0x69, 0x66, 0x20, 0x63, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x63,
@@ -5258,7 +5268,8 @@ const unsigned char boot_lua[] =
0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x52, 0x47, 0x42, 0x20, 0x3d, 0x20, 0x73, 0x65, 0x6c, 0x65,
0x63, 0x74, 0x28, 0x33, 0x2c, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e,
0x67, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x28, 0x29, 0x29, 0x2e, 0x73, 0x72, 0x67, 0x62, 0x0a,
0x09, 0x69, 0x66, 0x20, 0x73, 0x52, 0x47, 0x42, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
0x09, 0x69, 0x66, 0x20, 0x73, 0x52, 0x47, 0x42, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e,
0x6d, 0x61, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65,
0x74, 0x42, 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x6c,
0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x67, 0x61, 0x6d, 0x6d, 0x61, 0x54, 0x6f, 0x4c, 0x69,