Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some wxGraphicsContext methods accept Lua table as an array of wxPoint2DDoubles #53

Merged
merged 4 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions wxLua/bindings/genwxbind.lua
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ function InitDataTypes()
--AllocDataType("wxArrayInt", "special", true) -- special, but we only convert input, not output
AllocDataType("IntArray_FromLuaTable", "special", true)
AllocDataType("wxPointArray_FromLuaTable", "special", true);
AllocDataType("wxPoint2DDoubleArray_FromLuaTable", "special", true);
AllocDataType("voidptr_long", "special", true)
AllocDataType("any", "special", true)

Expand Down Expand Up @@ -3746,6 +3747,12 @@ if ((double)(lua_Integer)(%s) == (double)(%s)) {
declare = "wxLuaSharedPtr<std::vector<wxPoint> >"
argListOverride = "(int)("..argName.." ? "..argName.."->size() : 0), ("..argName.." && (!"..argName.."->empty())) ? &"..argName .. "->at(0) : NULL"

elseif (argType == "wxPoint2DDoubleArray_FromLuaTable") then
overload_argList = overload_argList.."&wxluatype_TTABLE, "
argItem = "wxlua_getwxPoint2DDoubleArray(L, "..argNum..")"
declare = "wxLuaSharedPtr<std::vector<wxPoint2DDouble> >"
argListOverride = "(size_t)("..argName.." ? "..argName.."->size() : 0), ("..argName.." && (!"..argName.."->empty())) ? &"..argName .. "->at(0) : NULL"

elseif argType == "LuaTable" then
-- THIS MUST BE AN OVERRIDE AND HANDLED THERE, we just set overload_argList
-- the code genererated here is nonsense
Expand Down
5 changes: 5 additions & 0 deletions wxLua/bindings/wxwidgets/wx_datatypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4066,6 +4066,11 @@ wx_dataTypeTable =
Name = "wxPoint2DDouble",
ValueType = "class",
},
wxPoint2DDoubleArray_FromLuaTable = {
IsNumber = true,
Name = "wxPoint2DDoubleArray_FromLuaTable",
ValueType = "special",
},
wxPoint2DInt = {
Condition = "wxLUA_USE_Geometry && wxUSE_GEOMETRY",
IsNumber = false,
Expand Down
14 changes: 11 additions & 3 deletions wxLua/bindings/wxwidgets/wxcore_graphics.i
Original file line number Diff line number Diff line change
Expand Up @@ -566,13 +566,21 @@ class %delete wxGraphicsContext : public wxGraphicsObject
virtual void StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2);

// stroke lines connecting each of the points
virtual void StrokeLines( size_t n, const wxPoint2DDouble *points);
// virtual void StrokeLines( size_t n, const wxPoint2DDouble *points);
// Provide a Lua Table of {{1,2},{3,4},...}, {{x=1,y=2},{x=3,y=4},...}, or {wx.wxPoint2DDouble(1,2),wx.wxPoint2DDouble(3,4),...}
virtual void StrokeLines( wxPoint2DDoubleArray_FromLuaTable points );

// stroke disconnected lines from begin to end points
virtual void StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints);
// virtual void StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints);
// Provide a Lua Table of {{1,2},{3,4},...}, {{x=1,y=2},{x=3,y=4},...}, or {wx.wxPoint2DDouble(1,2),wx.wxPoint2DDouble(3,4),...}
// Note: We need an override here, because the C++ API accepts only one 'n',
// both for beginPoints and endPoints.
virtual void StrokeLines( wxPoint2DDoubleArray_FromLuaTable beginPoints, wxPoint2DDoubleArray_FromLuaTable endPoints );

// draws a polygon
virtual void DrawLines( size_t n, const wxPoint2DDouble *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
// virtual void DrawLines( size_t n, const wxPoint2DDouble *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
// Provide a Lua Table of {{1,2},{3,4},...}, {{x=1,y=2},{x=3,y=4},...}, or {wx.wxPoint2DDouble(1,2),wx.wxPoint2DDouble(3,4),...}
virtual void DrawLines(wxPoint2DDoubleArray_FromLuaTable points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );

// draws a rectangle
virtual void DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h);
Expand Down
18 changes: 18 additions & 0 deletions wxLua/bindings/wxwidgets/wxcore_override.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2921,3 +2921,21 @@ static int LUACALL wxLua_wxGraphicsContext_GetTextExtent(lua_State *L)
return 4;
}
%end

%override wxLua_wxGraphicsContext_StrokeLines1
// virtual void StrokeLines( wxPoint2DDoubleArray_FromLuaTable beginPoints, wxPoint2DDoubleArray_FromLuaTable endPoints );
static int LUACALL wxLua_wxGraphicsContext_StrokeLines1(lua_State *L)
{
// wxPoint2DDoubleArray_FromLuaTable endPoints
wxLuaSharedPtr<std::vector<wxPoint2DDouble> > endPoints = wxlua_getwxPoint2DDoubleArray(L, 3);
// wxPoint2DDoubleArray_FromLuaTable beginPoints
wxLuaSharedPtr<std::vector<wxPoint2DDouble> > beginPoints = wxlua_getwxPoint2DDoubleArray(L, 2);
// get this
wxGraphicsContext * self = (wxGraphicsContext *)wxluaT_getuserdatatype(L, 1, wxluatype_wxGraphicsContext);
// call StrokeLines
self->StrokeLines((size_t)(beginPoints ? beginPoints->size() : 0), (beginPoints && (!beginPoints->empty())) ? &beginPoints->at(0) : NULL, (endPoints && (!endPoints->empty())) ? &endPoints->at(0) : NULL);

return 0;
}
%end

82 changes: 31 additions & 51 deletions wxLua/modules/wxbind/src/wxcore_graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2726,32 +2726,27 @@ static int LUACALL wxLua_wxGraphicsContext_DrawIcon(lua_State *L)

#endif // (wxLUA_USE_wxIcon) && (wxUSE_GRAPHICS_CONTEXT)

#if ((wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxLUA_USE_wxDC)) && (wxUSE_GRAPHICS_CONTEXT)
static wxLuaArgType s_wxluatypeArray_wxLua_wxGraphicsContext_DrawLines[] = { &wxluatype_wxGraphicsContext, &wxluatype_TINTEGER, &wxluatype_wxPoint2DDouble, &wxluatype_TINTEGER, NULL };
#if (wxLUA_USE_wxDC) && (wxUSE_GRAPHICS_CONTEXT)
static wxLuaArgType s_wxluatypeArray_wxLua_wxGraphicsContext_DrawLines[] = { &wxluatype_wxGraphicsContext, &wxluatype_TTABLE, &wxluatype_TINTEGER, NULL };
static int LUACALL wxLua_wxGraphicsContext_DrawLines(lua_State *L);
static wxLuaBindCFunc s_wxluafunc_wxLua_wxGraphicsContext_DrawLines[1] = {{ wxLua_wxGraphicsContext_DrawLines, WXLUAMETHOD_METHOD, 3, 4, s_wxluatypeArray_wxLua_wxGraphicsContext_DrawLines }};
// virtual void DrawLines( size_t n, const wxPoint2DDouble *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
static wxLuaBindCFunc s_wxluafunc_wxLua_wxGraphicsContext_DrawLines[1] = {{ wxLua_wxGraphicsContext_DrawLines, WXLUAMETHOD_METHOD, 2, 3, s_wxluatypeArray_wxLua_wxGraphicsContext_DrawLines }};
// virtual void DrawLines(wxPoint2DDoubleArray_FromLuaTable points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
static int LUACALL wxLua_wxGraphicsContext_DrawLines(lua_State *L)
{
// get number of arguments
int argCount = lua_gettop(L);
// wxPolygonFillMode fillStyle = wxODDEVEN_RULE
wxPolygonFillMode fillStyle = (argCount >= 4 ? (wxPolygonFillMode)wxlua_getenumtype(L, 4) : wxODDEVEN_RULE);
// const wxPoint2DDouble points
const wxPoint2DDouble * points = (const wxPoint2DDouble *)wxluaT_getuserdatatype(L, 3, wxluatype_wxPoint2DDouble);
// size_t n
size_t n = (size_t)wxlua_getuintegertype(L, 2);
wxPolygonFillMode fillStyle = (argCount >= 3 ? (wxPolygonFillMode)wxlua_getenumtype(L, 3) : wxODDEVEN_RULE);
// wxPoint2DDoubleArray_FromLuaTable points
wxLuaSharedPtr<std::vector<wxPoint2DDouble> > points = wxlua_getwxPoint2DDoubleArray(L, 2);
// get this
wxGraphicsContext * self = (wxGraphicsContext *)wxluaT_getuserdatatype(L, 1, wxluatype_wxGraphicsContext);
// call DrawLines
self->DrawLines(n, points, fillStyle);
self->DrawLines((size_t)(points ? points->size() : 0), (points && (!points->empty())) ? &points->at(0) : NULL, fillStyle);

return 0;
}

#endif // ((wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxLUA_USE_wxDC)) && (wxUSE_GRAPHICS_CONTEXT)

#if (wxLUA_USE_wxDC) && (wxUSE_GRAPHICS_CONTEXT)
static wxLuaArgType s_wxluatypeArray_wxLua_wxGraphicsContext_DrawPath[] = { &wxluatype_wxGraphicsContext, &wxluatype_wxGraphicsPath, &wxluatype_TINTEGER, NULL };
static int LUACALL wxLua_wxGraphicsContext_DrawPath(lua_State *L);
static wxLuaBindCFunc s_wxluafunc_wxLua_wxGraphicsContext_DrawPath[1] = {{ wxLua_wxGraphicsContext_DrawPath, WXLUAMETHOD_METHOD, 2, 3, s_wxluatypeArray_wxLua_wxGraphicsContext_DrawPath }};
Expand Down Expand Up @@ -3605,48 +3600,42 @@ static int LUACALL wxLua_wxGraphicsContext_StrokeLine(lua_State *L)
return 0;
}


#if (wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxUSE_GRAPHICS_CONTEXT)
static wxLuaArgType s_wxluatypeArray_wxLua_wxGraphicsContext_StrokeLines1[] = { &wxluatype_wxGraphicsContext, &wxluatype_TINTEGER, &wxluatype_wxPoint2DDouble, &wxluatype_wxPoint2DDouble, NULL };
static wxLuaArgType s_wxluatypeArray_wxLua_wxGraphicsContext_StrokeLines1[] = { &wxluatype_wxGraphicsContext, &wxluatype_TTABLE, &wxluatype_TTABLE, NULL };
static int LUACALL wxLua_wxGraphicsContext_StrokeLines1(lua_State *L);
// static wxLuaBindCFunc s_wxluafunc_wxLua_wxGraphicsContext_StrokeLines1[1] = {{ wxLua_wxGraphicsContext_StrokeLines1, WXLUAMETHOD_METHOD, 4, 4, s_wxluatypeArray_wxLua_wxGraphicsContext_StrokeLines1 }};
// virtual void StrokeLines( size_t n, const wxPoint2DDouble *beginPoints, const wxPoint2DDouble *endPoints);
// static wxLuaBindCFunc s_wxluafunc_wxLua_wxGraphicsContext_StrokeLines1[1] = {{ wxLua_wxGraphicsContext_StrokeLines1, WXLUAMETHOD_METHOD, 3, 3, s_wxluatypeArray_wxLua_wxGraphicsContext_StrokeLines1 }};
// %override wxLua_wxGraphicsContext_StrokeLines1
// virtual void StrokeLines( wxPoint2DDoubleArray_FromLuaTable beginPoints, wxPoint2DDoubleArray_FromLuaTable endPoints );
static int LUACALL wxLua_wxGraphicsContext_StrokeLines1(lua_State *L)
{
// const wxPoint2DDouble endPoints
const wxPoint2DDouble * endPoints = (const wxPoint2DDouble *)wxluaT_getuserdatatype(L, 4, wxluatype_wxPoint2DDouble);
// const wxPoint2DDouble beginPoints
const wxPoint2DDouble * beginPoints = (const wxPoint2DDouble *)wxluaT_getuserdatatype(L, 3, wxluatype_wxPoint2DDouble);
// size_t n
size_t n = (size_t)wxlua_getuintegertype(L, 2);
// wxPoint2DDoubleArray_FromLuaTable endPoints
wxLuaSharedPtr<std::vector<wxPoint2DDouble> > endPoints = wxlua_getwxPoint2DDoubleArray(L, 3);
// wxPoint2DDoubleArray_FromLuaTable beginPoints
wxLuaSharedPtr<std::vector<wxPoint2DDouble> > beginPoints = wxlua_getwxPoint2DDoubleArray(L, 2);
// get this
wxGraphicsContext * self = (wxGraphicsContext *)wxluaT_getuserdatatype(L, 1, wxluatype_wxGraphicsContext);
// call StrokeLines
self->StrokeLines(n, beginPoints, endPoints);
self->StrokeLines((size_t)(beginPoints ? beginPoints->size() : 0), (beginPoints && (!beginPoints->empty())) ? &beginPoints->at(0) : NULL, (endPoints && (!endPoints->empty())) ? &endPoints->at(0) : NULL);

return 0;
}

static wxLuaArgType s_wxluatypeArray_wxLua_wxGraphicsContext_StrokeLines[] = { &wxluatype_wxGraphicsContext, &wxluatype_TINTEGER, &wxluatype_wxPoint2DDouble, NULL };

static wxLuaArgType s_wxluatypeArray_wxLua_wxGraphicsContext_StrokeLines[] = { &wxluatype_wxGraphicsContext, &wxluatype_TTABLE, NULL };
static int LUACALL wxLua_wxGraphicsContext_StrokeLines(lua_State *L);
// static wxLuaBindCFunc s_wxluafunc_wxLua_wxGraphicsContext_StrokeLines[1] = {{ wxLua_wxGraphicsContext_StrokeLines, WXLUAMETHOD_METHOD, 3, 3, s_wxluatypeArray_wxLua_wxGraphicsContext_StrokeLines }};
// virtual void StrokeLines( size_t n, const wxPoint2DDouble *points);
// static wxLuaBindCFunc s_wxluafunc_wxLua_wxGraphicsContext_StrokeLines[1] = {{ wxLua_wxGraphicsContext_StrokeLines, WXLUAMETHOD_METHOD, 2, 2, s_wxluatypeArray_wxLua_wxGraphicsContext_StrokeLines }};
// virtual void StrokeLines( wxPoint2DDoubleArray_FromLuaTable points );
static int LUACALL wxLua_wxGraphicsContext_StrokeLines(lua_State *L)
{
// const wxPoint2DDouble points
const wxPoint2DDouble * points = (const wxPoint2DDouble *)wxluaT_getuserdatatype(L, 3, wxluatype_wxPoint2DDouble);
// size_t n
size_t n = (size_t)wxlua_getuintegertype(L, 2);
// wxPoint2DDoubleArray_FromLuaTable points
wxLuaSharedPtr<std::vector<wxPoint2DDouble> > points = wxlua_getwxPoint2DDoubleArray(L, 2);
// get this
wxGraphicsContext * self = (wxGraphicsContext *)wxluaT_getuserdatatype(L, 1, wxluatype_wxGraphicsContext);
// call StrokeLines
self->StrokeLines(n, points);
self->StrokeLines((size_t)(points ? points->size() : 0), (points && (!points->empty())) ? &points->at(0) : NULL);

return 0;
}

#endif // (wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxUSE_GRAPHICS_CONTEXT)

static wxLuaArgType s_wxluatypeArray_wxLua_wxGraphicsContext_StrokePath[] = { &wxluatype_wxGraphicsContext, &wxluatype_wxGraphicsPath, NULL };
static int LUACALL wxLua_wxGraphicsContext_StrokePath(lua_State *L);
static wxLuaBindCFunc s_wxluafunc_wxLua_wxGraphicsContext_StrokePath[1] = {{ wxLua_wxGraphicsContext_StrokePath, WXLUAMETHOD_METHOD, 2, 2, s_wxluatypeArray_wxLua_wxGraphicsContext_StrokePath }};
Expand Down Expand Up @@ -3860,22 +3849,16 @@ static int s_wxluafunc_wxLua_wxGraphicsContext_SetPen_overload_count = sizeof(s_

#endif // ((wxLUA_USE_wxColourPenBrush) && (wxUSE_GRAPHICS_CONTEXT))||(wxUSE_GRAPHICS_CONTEXT)

#if ((wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxUSE_GRAPHICS_CONTEXT))
#if (wxUSE_GRAPHICS_CONTEXT)
// function overload table
static wxLuaBindCFunc s_wxluafunc_wxLua_wxGraphicsContext_StrokeLines_overload[] =
{

#if (wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxUSE_GRAPHICS_CONTEXT)
{ wxLua_wxGraphicsContext_StrokeLines1, WXLUAMETHOD_METHOD, 4, 4, s_wxluatypeArray_wxLua_wxGraphicsContext_StrokeLines1 },
#endif // (wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxUSE_GRAPHICS_CONTEXT)

#if (wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxUSE_GRAPHICS_CONTEXT)
{ wxLua_wxGraphicsContext_StrokeLines, WXLUAMETHOD_METHOD, 3, 3, s_wxluatypeArray_wxLua_wxGraphicsContext_StrokeLines },
#endif // (wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxUSE_GRAPHICS_CONTEXT)
{ wxLua_wxGraphicsContext_StrokeLines1, WXLUAMETHOD_METHOD, 3, 3, s_wxluatypeArray_wxLua_wxGraphicsContext_StrokeLines1 },
{ wxLua_wxGraphicsContext_StrokeLines, WXLUAMETHOD_METHOD, 2, 2, s_wxluatypeArray_wxLua_wxGraphicsContext_StrokeLines },
};
static int s_wxluafunc_wxLua_wxGraphicsContext_StrokeLines_overload_count = sizeof(s_wxluafunc_wxLua_wxGraphicsContext_StrokeLines_overload)/sizeof(wxLuaBindCFunc);

#endif // ((wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxUSE_GRAPHICS_CONTEXT))
#endif // (wxUSE_GRAPHICS_CONTEXT)

void wxLua_wxGraphicsContext_delete_function(void** p)
{
Expand Down Expand Up @@ -3952,11 +3935,8 @@ wxLuaBindMethod wxGraphicsContext_methods[] = {
{ "DrawIcon", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxGraphicsContext_DrawIcon, 1, NULL },
#endif // (wxLUA_USE_wxIcon) && (wxUSE_GRAPHICS_CONTEXT)

#if ((wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxLUA_USE_wxDC)) && (wxUSE_GRAPHICS_CONTEXT)
{ "DrawLines", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxGraphicsContext_DrawLines, 1, NULL },
#endif // ((wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxLUA_USE_wxDC)) && (wxUSE_GRAPHICS_CONTEXT)

#if (wxLUA_USE_wxDC) && (wxUSE_GRAPHICS_CONTEXT)
{ "DrawLines", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxGraphicsContext_DrawLines, 1, NULL },
{ "DrawPath", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxGraphicsContext_DrawPath, 1, NULL },
#endif // (wxLUA_USE_wxDC) && (wxUSE_GRAPHICS_CONTEXT)

Expand Down Expand Up @@ -4035,9 +4015,9 @@ wxLuaBindMethod wxGraphicsContext_methods[] = {
{ "StartPage", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxGraphicsContext_StartPage, 1, NULL },
{ "StrokeLine", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxGraphicsContext_StrokeLine, 1, NULL },

#if ((wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxUSE_GRAPHICS_CONTEXT))
#if (wxUSE_GRAPHICS_CONTEXT)
{ "StrokeLines", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxGraphicsContext_StrokeLines_overload, s_wxluafunc_wxLua_wxGraphicsContext_StrokeLines_overload_count, 0 },
#endif // ((wxLUA_USE_Geometry && wxUSE_GEOMETRY) && (wxUSE_GRAPHICS_CONTEXT))
#endif // (wxUSE_GRAPHICS_CONTEXT)

{ "StrokePath", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxGraphicsContext_StrokePath, 1, NULL },
{ "Translate", WXLUAMETHOD_METHOD, s_wxluafunc_wxLua_wxGraphicsContext_Translate, 1, NULL },
Expand Down
1 change: 1 addition & 0 deletions wxLua/modules/wxlua/wxlbind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ int* p_wxluatype_wxSortedArrayString = &wxluatype_TUNKNOWN;
int* p_wxluatype_wxArrayInt = &wxluatype_TUNKNOWN;
int* p_wxluatype_wxArrayDouble = &wxluatype_TUNKNOWN;
int* p_wxluatype_wxPoint = &wxluatype_TUNKNOWN;
int* p_wxluatype_wxPoint2DDouble = &wxluatype_TUNKNOWN;

// ----------------------------------------------------------------------------
// wxlua_tableErrorHandler
Expand Down
1 change: 1 addition & 0 deletions wxLua/modules/wxlua/wxlbind.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxSortedArrayString; // wxLua ty
extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxArrayInt; // wxLua type for wxArrayInt
extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxArrayDouble; // wxLua type for wxArrayDouble
extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxPoint; // wxLua type for wxPoint
extern WXDLLIMPEXP_DATA_WXLUA(int*) p_wxluatype_wxPoint2DDouble; // wxLua type for wxPoint2DDouble

// ----------------------------------------------------------------------------
// wxLuaArgType a pointer to a declared wxLua type, see wxLuaBindCFunc::argtypes
Expand Down
Loading