📄 shape.cpp
字号:
/*
** Lua binding: shape
** Generated automatically by tolua 5.0a on 04/11/05 23:06:27.
*/
#ifndef __cplusplus
#include "stdlib.h"
#endif
#include <lua/tolua.h>
/* Exported function */
TOLUA_API int tolua_shape_open (lua_State* tolua_S);
#include <lua/lua.h>
#include <lua/tolua.h>
#include "shape.h"
/* function to release collected object via destructor */
#ifdef __cplusplus
static int tolua_collect_Line (lua_State* tolua_S)
{
Line* self = (Line*) tolua_tousertype(tolua_S,1,0);
delete self;
return 0;
}
#endif
/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
tolua_usertype(tolua_S,"Line");
tolua_usertype(tolua_S,"Shape");
}
/* method: new of class Shape */
static int tolua_shape_Shape_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"Shape",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
{
Shape* tolua_ret = (Shape*) new Shape();
tolua_pushusertype(tolua_S,(void*)tolua_ret,"Shape");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
/* method: draw of class Shape */
static int tolua_shape_Shape_draw00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Shape",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
Shape* self = (Shape*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'draw'",NULL);
#endif
{
self->draw();
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'draw'.",&tolua_err);
return 0;
#endif
}
/* method: draw of class Shape */
static int tolua_shape_Shape_draw01(lua_State* tolua_S)
{
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Shape",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,5,&tolua_err)
)
goto tolua_lerror;
else
{
Shape* self = (Shape*) tolua_tousertype(tolua_S,1,0);
double red = ((double) tolua_tonumber(tolua_S,2,0));
double green = ((double) tolua_tonumber(tolua_S,3,0));
double blue = ((double) tolua_tonumber(tolua_S,4,0));
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'draw'",NULL);
#endif
{
self->draw(red,green,blue);
}
}
return 0;
tolua_lerror:
return tolua_shape_Shape_draw00(tolua_S);
}
/* method: isSelected of class Shape */
static int tolua_shape_Shape_isSelected00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Shape",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
Shape* self = (Shape*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'isSelected'",NULL);
#endif
{
int tolua_ret = (int) self->isSelected();
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'isSelected'.",&tolua_err);
return 0;
#endif
}
/* method: new of class Line */
static int tolua_shape_Line_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertable(tolua_S,1,"Line",0,&tolua_err) ||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isnumber(tolua_S,4,0,&tolua_err) ||
!tolua_isnumber(tolua_S,5,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,6,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
double x1 = ((double) tolua_tonumber(tolua_S,2,0));
double y1 = ((double) tolua_tonumber(tolua_S,3,0));
double x2 = ((double) tolua_tonumber(tolua_S,4,0));
double y2 = ((double) tolua_tonumber(tolua_S,5,0));
{
Line* tolua_ret = (Line*) new Line(x1,y1,x2,y2);
tolua_pushusertype(tolua_S,(void*)tolua_ret,"Line");
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
return 0;
#endif
}
/* method: delete of class Line */
static int tolua_shape_Line_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Line",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
Line* self = (Line*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'",NULL);
#endif
delete self;
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
return 0;
#endif
}
/* Open function */
TOLUA_API int tolua_shape_open (lua_State* tolua_S)
{
tolua_open(tolua_S);
tolua_reg_types(tolua_S);
tolua_module(tolua_S,NULL,0);
tolua_beginmodule(tolua_S,NULL);
tolua_constant(tolua_S,"FALSE",FALSE);
tolua_constant(tolua_S,"TRUE",TRUE);
tolua_cclass(tolua_S,"Shape","Shape","",NULL);
tolua_beginmodule(tolua_S,"Shape");
tolua_function(tolua_S,"new",tolua_shape_Shape_new00);
tolua_function(tolua_S,"draw",tolua_shape_Shape_draw00);
tolua_function(tolua_S,"draw",tolua_shape_Shape_draw01);
tolua_function(tolua_S,"isSelected",tolua_shape_Shape_isSelected00);
tolua_endmodule(tolua_S);
#ifdef __cplusplus
tolua_cclass(tolua_S,"Line","Line","Shape",tolua_collect_Line);
#else
tolua_cclass(tolua_S,"Line","Line","Shape",NULL);
#endif
tolua_beginmodule(tolua_S,"Line");
tolua_function(tolua_S,"new",tolua_shape_Line_new00);
tolua_function(tolua_S,"delete",tolua_shape_Line_delete00);
tolua_endmodule(tolua_S);
tolua_endmodule(tolua_S);
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -