mirror of
https://github.com/love2d/love.git
synced 2026-08-14 10:13:46 +02:00
Converted code for Shader:send from Lua to C++
This commit is contained in:
@@ -197,7 +197,7 @@ int w_Shader_sendMatrix(lua_State *L)
|
||||
|
||||
if (dimension < 2 || dimension > 4)
|
||||
return luaL_error(L, "Invalid matrix size: %dx%d (only 2x2, 3x3 and 4x4 matrices are supported).",
|
||||
count, count);
|
||||
dimension, dimension);
|
||||
|
||||
float *values = new float[dimension * dimension * count];
|
||||
for (int i = 0; i < count; ++i)
|
||||
@@ -275,15 +275,102 @@ int w_Shader_sendCanvas(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Convert matrices on the stack for use with sendMatrix.
|
||||
static void w_convertMatrices(lua_State *L, int idx)
|
||||
{
|
||||
int matrixcount = lua_gettop(L) - (idx - 1);
|
||||
|
||||
for (int matrix = idx; matrix < idx + matrixcount; matrix++)
|
||||
{
|
||||
luaL_checktype(L, matrix, LUA_TTABLE);
|
||||
int dimension = lua_objlen(L, matrix);
|
||||
|
||||
int newi = 1;
|
||||
lua_createtable(L, dimension * dimension, 0);
|
||||
|
||||
// Collapse {{a,b,c}, {d,e,f}, ...} to {a,b,c, d,e,f, ...}
|
||||
for (size_t i = 1; i <= lua_objlen(L, matrix); i++)
|
||||
{
|
||||
// Push args[matrix][i] onto the stack.
|
||||
lua_rawgeti(L, matrix, i);
|
||||
luaL_checktype(L, -1, LUA_TTABLE);
|
||||
|
||||
for (size_t j = 1; j <= lua_objlen(L, -1); j++)
|
||||
{
|
||||
// Push args[matrix[i][j] onto the stack.
|
||||
lua_rawgeti(L, -1, j);
|
||||
luaL_checktype(L, -1, LUA_TNUMBER);
|
||||
|
||||
// newtable[newi] = args[matrix][i][j]
|
||||
lua_rawseti(L, -3, newi++);
|
||||
}
|
||||
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
// newtable.dimension = #args[matrix]
|
||||
lua_pushinteger(L, dimension);
|
||||
lua_setfield(L, -2, "dimension");
|
||||
|
||||
// Replace args[i] with the new table
|
||||
lua_replace(L, matrix);
|
||||
}
|
||||
}
|
||||
|
||||
int w_Shader_send(lua_State *L)
|
||||
{
|
||||
int ttype = lua_type(L, 3);
|
||||
Proxy *p = 0;
|
||||
|
||||
switch (ttype)
|
||||
{
|
||||
case LUA_TNUMBER:
|
||||
case LUA_TBOOLEAN:
|
||||
// Scalar float/boolean.
|
||||
return w_Shader_sendFloat(L);
|
||||
break;
|
||||
case LUA_TUSERDATA:
|
||||
// Image or Canvas.
|
||||
p = (Proxy *) lua_touserdata(L, 3);
|
||||
|
||||
if (p->flags[GRAPHICS_IMAGE_ID])
|
||||
return w_Shader_sendImage(L);
|
||||
else if (p->flags[GRAPHICS_CANVAS_ID])
|
||||
return w_Shader_sendCanvas(L);
|
||||
|
||||
break;
|
||||
case LUA_TTABLE:
|
||||
// Vector or Matrix.
|
||||
lua_rawgeti(L, 3, 1);
|
||||
ttype = lua_type(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
if (ttype == LUA_TNUMBER || ttype == LUA_TBOOLEAN)
|
||||
return w_Shader_sendFloat(L);
|
||||
else if (ttype == LUA_TTABLE)
|
||||
{
|
||||
w_convertMatrices(L, 3);
|
||||
return w_Shader_sendMatrix(L);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return luaL_argerror(L, 3, "number, boolean, table, image, or canvas expected");
|
||||
}
|
||||
|
||||
static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "getWarnings", w_Shader_getWarnings },
|
||||
{ "sendInt", w_Shader_sendInt },
|
||||
{ "sendBoolean", w_Shader_sendInt },
|
||||
{ "sendFloat", w_Shader_sendFloat },
|
||||
{ "sendMatrix", w_Shader_sendMatrix },
|
||||
{ "sendImage", w_Shader_sendImage },
|
||||
{ "sendCanvas", w_Shader_sendCanvas },
|
||||
{ "send", w_Shader_send },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ int w_Shader_sendInt(lua_State *L);
|
||||
int w_Shader_sendFloat(lua_State *L);
|
||||
int w_Shader_sendMatrix(lua_State *L);
|
||||
int w_Shader_sendImage(lua_State *L);
|
||||
int w_Shader_send(lua_State *L);
|
||||
extern "C" int luaopen_shader(lua_State *L);
|
||||
|
||||
} // opengl
|
||||
|
||||
@@ -1452,72 +1452,4 @@ void main() {
|
||||
if #lines == 1 then return message end
|
||||
return table_concat(lines, "\n")
|
||||
end
|
||||
|
||||
-- helper to transform a matrix from {{a,b,c}, {d,e,f}, ...} to
|
||||
-- {a, b, c, d, e, f, ...}
|
||||
local function flattenMatrices(mat, ...)
|
||||
if not mat then return end
|
||||
|
||||
local tonumber = tonumber
|
||||
|
||||
local ret,l = {}, 1
|
||||
ret.dimension = #mat
|
||||
|
||||
for i = 1,#mat do
|
||||
for k = 1,#mat[i] do
|
||||
ret[l], l = tonumber(mat[i][k]), l+1
|
||||
end
|
||||
end
|
||||
|
||||
return ret, flattenMatrices(...)
|
||||
end
|
||||
|
||||
-- automagic uniform setter
|
||||
local function shader_dispatch_send(self, name, value, ...)
|
||||
local valuetype = type(value)
|
||||
if valuetype == "number" or valuetype == "boolean" then -- scalar
|
||||
self:sendFloat(name, value, ...)
|
||||
elseif valuetype == "userdata" and value:typeOf("Image") then
|
||||
self:sendImage(name, value)
|
||||
elseif valuetype == "userdata" and value:typeOf("Canvas") then
|
||||
self:sendCanvas(name, value)
|
||||
elseif valuetype == "table" then -- vector or matrix
|
||||
valuetype = type(value[1])
|
||||
if valuetype == "number" or valuetype == "boolean" then
|
||||
self:sendFloat(name, value, ...)
|
||||
elseif valuetype == "table" then
|
||||
self:sendMatrix(name, flattenMatrices(value, ...))
|
||||
else
|
||||
error("Cannot send value (unsupported type: {"..valuetype.."}).")
|
||||
end
|
||||
else
|
||||
if valuetype == "userdata" and value.type then valuetype = value.type end
|
||||
error("Cannot send value (unsupported type: "..valuetype..").")
|
||||
end
|
||||
end
|
||||
|
||||
local function shader_send_protected(self, name, value, ...)
|
||||
local success, err = pcall(shader_dispatch_send, self, name, value, ...)
|
||||
if not success then
|
||||
if err and type(err) == "string" then
|
||||
err = err:gsub("^(.-):(%d+): ", "")
|
||||
end
|
||||
error(err, 2)
|
||||
end
|
||||
end
|
||||
|
||||
local newShader = love.graphics.newShader
|
||||
function love.graphics.newShader(vertexcode, pixelcode)
|
||||
love.graphics.newShader = newShader
|
||||
|
||||
local success, shader = pcall(love.graphics.newShader, vertexcode, pixelcode)
|
||||
if success then
|
||||
local meta = getmetatable(shader)
|
||||
meta.send = shader_send_protected
|
||||
meta.sendBoolean = meta.sendFloat
|
||||
return shader
|
||||
else
|
||||
return error(shader, 2)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6589,145 +6589,6 @@ const unsigned char graphics_lua[] =
|
||||
0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x6f, 0x6e,
|
||||
0x63, 0x61, 0x74, 0x28, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x2c, 0x20, 0x22, 0x5c, 0x6e, 0x22, 0x29, 0x0a,
|
||||
0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x2d, 0x2d, 0x20, 0x68, 0x65, 0x6c, 0x70, 0x65, 0x72, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x72, 0x61, 0x6e,
|
||||
0x73, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x61, 0x20, 0x6d, 0x61, 0x74, 0x72, 0x69, 0x78, 0x20, 0x66, 0x72, 0x6f,
|
||||
0x6d, 0x20, 0x7b, 0x7b, 0x61, 0x2c, 0x62, 0x2c, 0x63, 0x7d, 0x2c, 0x20, 0x7b, 0x64, 0x2c, 0x65, 0x2c, 0x66,
|
||||
0x7d, 0x2c, 0x20, 0x2e, 0x2e, 0x2e, 0x7d, 0x20, 0x74, 0x6f, 0x0a,
|
||||
0x09, 0x2d, 0x2d, 0x20, 0x7b, 0x61, 0x2c, 0x20, 0x62, 0x2c, 0x20, 0x63, 0x2c, 0x20, 0x64, 0x2c, 0x20, 0x65,
|
||||
0x2c, 0x20, 0x66, 0x2c, 0x20, 0x2e, 0x2e, 0x2e, 0x7d, 0x0a,
|
||||
0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6c,
|
||||
0x61, 0x74, 0x74, 0x65, 0x6e, 0x4d, 0x61, 0x74, 0x72, 0x69, 0x63, 0x65, 0x73, 0x28, 0x6d, 0x61, 0x74, 0x2c,
|
||||
0x20, 0x2e, 0x2e, 0x2e, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6d, 0x61, 0x74, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20,
|
||||
0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x74, 0x6f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x3d,
|
||||
0x20, 0x74, 0x6f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x0a,
|
||||
0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x72, 0x65, 0x74, 0x2c, 0x6c, 0x20, 0x3d, 0x20, 0x7b, 0x7d,
|
||||
0x2c, 0x20, 0x31, 0x0a,
|
||||
0x09, 0x09, 0x72, 0x65, 0x74, 0x2e, 0x64, 0x69, 0x6d, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20,
|
||||
0x23, 0x6d, 0x61, 0x74, 0x0a,
|
||||
0x09, 0x09, 0x66, 0x6f, 0x72, 0x20, 0x69, 0x20, 0x3d, 0x20, 0x31, 0x2c, 0x23, 0x6d, 0x61, 0x74, 0x20, 0x64,
|
||||
0x6f, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x66, 0x6f, 0x72, 0x20, 0x6b, 0x20, 0x3d, 0x20, 0x31, 0x2c, 0x23, 0x6d, 0x61, 0x74, 0x5b,
|
||||
0x69, 0x5d, 0x20, 0x64, 0x6f, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x09, 0x72, 0x65, 0x74, 0x5b, 0x6c, 0x5d, 0x2c, 0x20, 0x6c, 0x20, 0x3d, 0x20, 0x74, 0x6f,
|
||||
0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x28, 0x6d, 0x61, 0x74, 0x5b, 0x69, 0x5d, 0x5b, 0x6b, 0x5d, 0x29, 0x2c,
|
||||
0x20, 0x6c, 0x2b, 0x31, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x72, 0x65, 0x74, 0x2c, 0x20, 0x66, 0x6c, 0x61, 0x74,
|
||||
0x74, 0x65, 0x6e, 0x4d, 0x61, 0x74, 0x72, 0x69, 0x63, 0x65, 0x73, 0x28, 0x2e, 0x2e, 0x2e, 0x29, 0x0a,
|
||||
0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x2d, 0x2d, 0x20, 0x61, 0x75, 0x74, 0x6f, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x20, 0x75, 0x6e, 0x69, 0x66,
|
||||
0x6f, 0x72, 0x6d, 0x20, 0x73, 0x65, 0x74, 0x74, 0x65, 0x72, 0x0a,
|
||||
0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x73, 0x68,
|
||||
0x61, 0x64, 0x65, 0x72, 0x5f, 0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x65, 0x6e, 0x64,
|
||||
0x28, 0x73, 0x65, 0x6c, 0x66, 0x2c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x2c, 0x20, 0x2e, 0x2e, 0x2e, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x74, 0x79, 0x70, 0x65, 0x20,
|
||||
0x3d, 0x20, 0x74, 0x79, 0x70, 0x65, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x69, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x3d, 0x20,
|
||||
0x22, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x20, 0x6f, 0x72, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x74,
|
||||
0x79, 0x70, 0x65, 0x20, 0x3d, 0x3d, 0x20, 0x22, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x22, 0x20, 0x74,
|
||||
0x68, 0x65, 0x6e, 0x20, 0x2d, 0x2d, 0x20, 0x73, 0x63, 0x61, 0x6c, 0x61, 0x72, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x73, 0x65, 0x6c, 0x66, 0x3a, 0x73, 0x65, 0x6e, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x28,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x2e, 0x2e, 0x2e, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x65, 0x6c, 0x73, 0x65, 0x69, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x74, 0x79, 0x70, 0x65,
|
||||
0x20, 0x3d, 0x3d, 0x20, 0x22, 0x75, 0x73, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x22, 0x20, 0x61, 0x6e, 0x64,
|
||||
0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x74, 0x79, 0x70, 0x65, 0x4f, 0x66, 0x28, 0x22, 0x49, 0x6d, 0x61,
|
||||
0x67, 0x65, 0x22, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x73, 0x65, 0x6c, 0x66, 0x3a, 0x73, 0x65, 0x6e, 0x64, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x28,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x65, 0x6c, 0x73, 0x65, 0x69, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x74, 0x79, 0x70, 0x65,
|
||||
0x20, 0x3d, 0x3d, 0x20, 0x22, 0x75, 0x73, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x22, 0x20, 0x61, 0x6e, 0x64,
|
||||
0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x74, 0x79, 0x70, 0x65, 0x4f, 0x66, 0x28, 0x22, 0x43, 0x61, 0x6e,
|
||||
0x76, 0x61, 0x73, 0x22, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x73, 0x65, 0x6c, 0x66, 0x3a, 0x73, 0x65, 0x6e, 0x64, 0x43, 0x61, 0x6e, 0x76, 0x61, 0x73,
|
||||
0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x65, 0x6c, 0x73, 0x65, 0x69, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x74, 0x79, 0x70, 0x65,
|
||||
0x20, 0x3d, 0x3d, 0x20, 0x22, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x2d, 0x2d, 0x20, 0x76, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x20, 0x6f, 0x72, 0x20, 0x6d,
|
||||
0x61, 0x74, 0x72, 0x69, 0x78, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x74, 0x79, 0x70,
|
||||
0x65, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5b, 0x31, 0x5d, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x3d,
|
||||
0x20, 0x22, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x20, 0x6f, 0x72, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65,
|
||||
0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x3d, 0x20, 0x22, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x22, 0x20,
|
||||
0x74, 0x68, 0x65, 0x6e, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x09, 0x73, 0x65, 0x6c, 0x66, 0x3a, 0x73, 0x65, 0x6e, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74,
|
||||
0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x2e, 0x2e, 0x2e, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x65, 0x6c, 0x73, 0x65, 0x69, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x74, 0x79, 0x70,
|
||||
0x65, 0x20, 0x3d, 0x3d, 0x20, 0x22, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x09, 0x73, 0x65, 0x6c, 0x66, 0x3a, 0x73, 0x65, 0x6e, 0x64, 0x4d, 0x61, 0x74, 0x72, 0x69,
|
||||
0x78, 0x28, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x66, 0x6c, 0x61, 0x74, 0x74, 0x65, 0x6e, 0x4d, 0x61, 0x74,
|
||||
0x72, 0x69, 0x63, 0x65, 0x73, 0x28, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x2e, 0x2e, 0x2e, 0x29, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x65, 0x6c, 0x73, 0x65, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x28, 0x22, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x20,
|
||||
0x73, 0x65, 0x6e, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x28, 0x75, 0x6e, 0x73, 0x75, 0x70, 0x70,
|
||||
0x6f, 0x72, 0x74, 0x65, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x7b, 0x22, 0x2e, 0x2e, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x2e, 0x22, 0x7d, 0x29, 0x2e, 0x22, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x09, 0x65, 0x6c, 0x73, 0x65, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x3d,
|
||||
0x20, 0x22, 0x75, 0x73, 0x65, 0x72, 0x64, 0x61, 0x74, 0x61, 0x22, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x76, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x74, 0x79, 0x70, 0x65, 0x20, 0x3d, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x74, 0x79, 0x70, 0x65,
|
||||
0x20, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x28, 0x22, 0x43, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x20, 0x73,
|
||||
0x65, 0x6e, 0x64, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x28, 0x75, 0x6e, 0x73, 0x75, 0x70, 0x70, 0x6f,
|
||||
0x72, 0x74, 0x65, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, 0x22, 0x2e, 0x2e, 0x76, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x74, 0x79, 0x70, 0x65, 0x2e, 0x2e, 0x22, 0x29, 0x2e, 0x22, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x73, 0x68,
|
||||
0x61, 0x64, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x65,
|
||||
0x64, 0x28, 0x73, 0x65, 0x6c, 0x66, 0x2c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x2c, 0x20, 0x2e, 0x2e, 0x2e, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x2c, 0x20, 0x65,
|
||||
0x72, 0x72, 0x20, 0x3d, 0x20, 0x70, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x5f,
|
||||
0x64, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x2c, 0x20, 0x73, 0x65, 0x6c,
|
||||
0x66, 0x2c, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x2c, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2c, 0x20, 0x2e, 0x2e,
|
||||
0x2e, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x20, 0x74,
|
||||
0x68, 0x65, 0x6e, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x69, 0x66, 0x20, 0x65, 0x72, 0x72, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x74, 0x79, 0x70, 0x65,
|
||||
0x28, 0x65, 0x72, 0x72, 0x29, 0x20, 0x3d, 0x3d, 0x20, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x20,
|
||||
0x74, 0x68, 0x65, 0x6e, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x09, 0x65, 0x72, 0x72, 0x20, 0x3d, 0x20, 0x65, 0x72, 0x72, 0x3a, 0x67, 0x73, 0x75, 0x62,
|
||||
0x28, 0x22, 0x5e, 0x28, 0x2e, 0x2d, 0x29, 0x3a, 0x28, 0x25, 0x64, 0x2b, 0x29, 0x3a, 0x20, 0x22, 0x2c, 0x20,
|
||||
0x22, 0x22, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x28, 0x65, 0x72, 0x72, 0x2c, 0x20, 0x32, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6e, 0x65, 0x77, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x3d,
|
||||
0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77,
|
||||
0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x0a,
|
||||
0x09, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61,
|
||||
0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x28, 0x76, 0x65,
|
||||
0x72, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x70, 0x69, 0x78, 0x65, 0x6c, 0x63, 0x6f, 0x64,
|
||||
0x65, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65,
|
||||
0x77, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x6e, 0x65, 0x77, 0x53, 0x68, 0x61, 0x64, 0x65,
|
||||
0x72, 0x0a,
|
||||
0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x2c, 0x20, 0x73,
|
||||
0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x3d, 0x20, 0x70, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x6c, 0x6f, 0x76, 0x65,
|
||||
0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x6e, 0x65, 0x77, 0x53, 0x68, 0x61, 0x64, 0x65,
|
||||
0x72, 0x2c, 0x20, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x64, 0x65, 0x2c, 0x20, 0x70, 0x69, 0x78,
|
||||
0x65, 0x6c, 0x63, 0x6f, 0x64, 0x65, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x69, 0x66, 0x20, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x20, 0x3d, 0x20, 0x67, 0x65,
|
||||
0x74, 0x6d, 0x65, 0x74, 0x61, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x28, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x73, 0x65, 0x6e, 0x64, 0x20, 0x3d, 0x20, 0x73, 0x68, 0x61,
|
||||
0x64, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x65, 0x63, 0x74, 0x65, 0x64, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x73, 0x65, 0x6e, 0x64, 0x42, 0x6f, 0x6f, 0x6c, 0x65, 0x61,
|
||||
0x6e, 0x20, 0x3d, 0x20, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x73, 0x65, 0x6e, 0x64, 0x46, 0x6c, 0x6f, 0x61, 0x74, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x73, 0x68, 0x61, 0x64, 0x65, 0x72, 0x0a,
|
||||
0x09, 0x09, 0x65, 0x6c, 0x73, 0x65, 0x0a,
|
||||
0x09, 0x09, 0x09, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x28, 0x73, 0x68,
|
||||
0x61, 0x64, 0x65, 0x72, 0x2c, 0x20, 0x32, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x65, 0x6e, 0x64, 0x0a,
|
||||
}; // [graphics.lua]
|
||||
} // love
|
||||
Reference in New Issue
Block a user