示例#1
0
void moScriptManager::RegisterLunaClasses()
{
	lua_State *state = (lua_State *) m_vm;

	REGISTER_CLASS(moLuaMath, state);
	REGISTER_CLASS(moLuaParserFunction, state);
	REGISTER_CLASS(moLuaP5, state);
}
bool TFObjectFactory::Initialize()
{
    REGISTER_CLASS(CRole);
    REGISTER_CLASS(CBulletBase);
    REGISTER_CLASS(TFMonster);
    REGISTER_CLASS(TFItemInGame);
    REGISTER_CLASS(TFHPBar);
    REGISTER_CLASS(CGun);
    REGISTER_CLASS(CSpriteObject);
    REGISTER_CLASS(CScale9SpriteObject);
    REGISTER_CLASS(EPPlane);
    REGISTER_CLASS(EPLand);
    return true;
}
示例#3
0
LTreeView::LTreeView(lua_State *L)
    : LComponent(L, this),
      TreeView( /* TODO: add args */ )
{
    TreeView::setName(myName());
    REGISTER_CLASS( LTreeView );
}
示例#4
0
LListBox::LListBox(lua_State *L)
    : LComponent(L, this),
      ListBox("LListBox", this)
{
    ListBox::setName(myName());
    REGISTER_CLASS(LListBox);
}
void physobj::REGISTER_SCRIPTABLES(qScriptEngine *engine)
{
	REGISTER_CLASS(engine, "physobj", physobj);
	
	REGISTER_METHOD(engine, "physobj", physobj, "void render()", getX);
	REGISTER_METHOD(engine, "physobj", physobj, "void AddRef()", Addref);
	//Addref
}
示例#6
0
LTextButton::LTextButton(lua_State *L)
    : LButton(L, this),
      TextButton()
{
    TextButton::setName(myName());
    TextButton::addListener(this);
    REGISTER_CLASS(LTextButton);
}
示例#7
0
LHyperlinkButton::LHyperlinkButton(lua_State *L)
    : LButton(L, this),
      HyperlinkButton()
{
    HyperlinkButton::setName(myName());
    HyperlinkButton::addListener(this);

    REGISTER_CLASS(LHyperlinkButton);
}
示例#8
0
LAudioAppComponent::LAudioAppComponent(lua_State *L)
    : LComponent(L, this),
      audioOpen(false),
      stopped(true),
      volume(-1.0)
{
    Ls = L;

    REGISTER_CLASS(LAudioAppComponent);
}
示例#9
0
文件: main.c 项目: jesskay/wren
static WrenForeignClassMethods bindForeignClass(
    WrenVM* vm, const char* module, const char* className)
{
  WrenForeignClassMethods methods = { NULL, NULL };
  if (strcmp(module, "main") != 0) return methods;

  REGISTER_CLASS(foreign_class, foreignClass);

  return methods;
}
示例#10
0
文件: main.cpp 项目: avansc/qLib
void player::REGISTER_SCRIPTABLES(qScriptEngine *engine)
{
	REGISTER_CLASS(engine, "player", player);
	
	
	REGISTER_METHOD(engine, "player", player, "float getX(void)", getX);
	REGISTER_METHOD(engine, "player", player, "float getY(void)", getY);
	
	REGISTER_METHOD(engine, "player", player, "int getXDir(void)", getXDir);
	REGISTER_METHOD(engine, "player", player, "int getYDir(void)", getYDir);
	
	REGISTER_METHOD(engine, "player", player, "void setX(float _x)", setX);
	REGISTER_METHOD(engine, "player", player, "void setY(float _y)", setY);
	
	REGISTER_METHOD(engine, "player", player, "void move(float _dt)", move);
	REGISTER_METHOD(engine, "player", player, "void setDir(int _dx, int _dy)", setDir);
}
示例#11
0
LOpenGLComponent::LOpenGLComponent(lua_State *L) 
    : LComponent(L, this),
      Component()
{
    Component::setName(myName());

    Component::setOpaque(true); // test perfs without
    
    openGLContext.setRenderer(this);
    openGLContext.setComponentPaintingEnabled(true);
    openGLContext.setMultisamplingEnabled(true);
    openGLContext.setContinuousRepainting(true);

    openGLContext.attachTo(*this);
    //openGLContext.attachTo(*Component::getTopLevelComponent());

    REGISTER_CLASS(LOpenGLComponent);
}
示例#12
0
LJComponent::LJComponent(lua_State *L) 
    : LComponent(L, this)
{
    Component::setName( myName() );
    REGISTER_CLASS(LJComponent);
}
示例#13
0
void
YogBuiltins_boot(YogEnv* env, YogHandle* builtins)
{
    SAVE_LOCALS(env);
    YogVal errno_ = YUNDEF;
    YogVal e = YUNDEF;
    PUSH_LOCALS2(env, errno_, e);

#define DEFINE_FUNCTION(name, f)    do { \
    YogPackage_define_function(env, HDL2VAL(builtins), name, f); \
} while (0)
    DEFINE_FUNCTION("classmethod", classmethod);
    DEFINE_FUNCTION("disable_gc_stress", disable_gc_stress);
    DEFINE_FUNCTION("enable_gc_stress", enable_gc_stress);
    DEFINE_FUNCTION("get_current_thread", get_current_thread);
    DEFINE_FUNCTION("include_module", include_module);
    DEFINE_FUNCTION("join_path", join_path);
    DEFINE_FUNCTION("property", property);
    DEFINE_FUNCTION("puts", puts_);
    DEFINE_FUNCTION("raise_exception", raise_exception);
#undef DEFINE_FUNCTION
#define DEFINE_FUNCTION2(name, f, ...) do { \
    YogPackage_define_function2(env, builtins, (name), (f), __VA_ARGS__); \
} while (0)
    DEFINE_FUNCTION2("import_package", import_package, "name", NULL);
    DEFINE_FUNCTION2("load_lib", load_lib, "path", NULL);
    DEFINE_FUNCTION2("locals", locals, NULL);
    DEFINE_FUNCTION2("major_gc", major_gc, NULL);
    DEFINE_FUNCTION2("minor_gc", minor_gc, NULL);
    DEFINE_FUNCTION2("mkdir", mkdir_, "path", NULL);
    DEFINE_FUNCTION2("print", print, "*", NULL);
#undef DEFINE_FUNCTION2

#define REGISTER_CLASS(c)   do { \
    YogVal klass = env->vm->c; \
    ID name = PTR_AS(YogClass, klass)->name; \
    YogObj_set_attr_id(env, HDL2VAL(builtins), name, klass); \
} while (0)
    REGISTER_CLASS(cArray);
    REGISTER_CLASS(cBinary);
    REGISTER_CLASS(cBuffer);
    REGISTER_CLASS(cCoroutine);
    REGISTER_CLASS(cDatetime);
    REGISTER_CLASS(cDict);
    REGISTER_CLASS(cDir);
    REGISTER_CLASS(cFile);
    REGISTER_CLASS(cInt);
    REGISTER_CLASS(cObject);
    REGISTER_CLASS(cPath);
    REGISTER_CLASS(cPointer);
    REGISTER_CLASS(cProcess);
    REGISTER_CLASS(cRegexp);
    REGISTER_CLASS(cSet);
    REGISTER_CLASS(cString);
    REGISTER_CLASS(cStructClass);
    REGISTER_CLASS(cSymbol);
    REGISTER_CLASS(cThread);
    REGISTER_CLASS(cUnionClass);
    REGISTER_CLASS(eAttributeError);
    REGISTER_CLASS(eException);
    REGISTER_CLASS(eImportError);
    REGISTER_CLASS(eIndexError);
    REGISTER_CLASS(eKeyError);
    REGISTER_CLASS(eNotImplementedError);
    REGISTER_CLASS(eSyntaxError);
    REGISTER_CLASS(eSystemError);
    REGISTER_CLASS(eValueError);
#undef REGISTER_CLASS
#define REGISTER_MODULE(m) do { \
    YogVal mod = env->vm->m; \
    ID name = PTR_AS(YogModule, mod)->name; \
    YogObj_set_attr_id(env, HDL2VAL(builtins), name, mod); \
} while (0)
    REGISTER_MODULE(mComparable);
    REGISTER_MODULE(mEnumerable);
#undef REGISTER_MODULE

    e = YogEnv_new(env);
    YogObj_set_attr(env, HDL2VAL(builtins), "ENV", e);
    YogObj_set_attr(env, HDL2VAL(builtins), "ENCODINGS", env->vm->encodings);
    YogVal enc = env->vm->default_encoding;
    YogObj_set_attr(env, HDL2VAL(builtins), "DEFAULT_ENCODING", enc);
    YogVal STDIN = create_stdio(env, stdin);
    YogObj_set_attr(env, HDL2VAL(builtins), "STDIN", STDIN);
    YogVal STDOUT = create_stdio(env, stdout);
    YogObj_set_attr(env, HDL2VAL(builtins), "STDOUT", STDOUT);
    YogVal STDERR = create_stdio(env, stderr);
    YogObj_set_attr(env, HDL2VAL(builtins), "STDERR", STDERR);

    set_path_separator(env, builtins);

#define REGISTER_ERRNO(e) do { \
    errno_ = YogVal_from_int(env, (e)); \
    YogObj_set_attr(env, HDL2VAL(builtins), #e, errno_); \
} while (0)
#include "errno.inc"
#undef REGISTER_ERRNO

    const char* src = 
#include "builtins.inc"
    ;
    YogMisc_eval_source(env, builtins, src);

    RETURN_VOID(env);
}
示例#14
0
LDrawablePath::LDrawablePath(lua_State *L, const DrawablePath& dp)
    : LDrawableShape(L, this),
      DrawablePath(dp)
{
    REGISTER_CLASS(LDrawablePath);
}
示例#15
0
LDrawablePath::LDrawablePath(lua_State *L)
    : LDrawableShape(L, this),
      DrawablePath()
{
    REGISTER_CLASS(LDrawablePath);
}
示例#16
0
文件: jsparser.cpp 项目: dyne/FreeJ
void JsExecutionContext::init_class() {

  /* Initialize the built-in JS objects and the global object
   * As a side effect, JS_InitStandardClasses establishes obj as
   * the global object for cx, if one is not already established. */
  JS_InitStandardClasses(cx, obj);

  /* Declare shell functions */
  if (!JS_DefineFunctions(cx, obj, global_functions)) {
    JS_EndRequest(cx);
      error("JsParser :: error defining global functions");
	return ;
  }

  ///////////////////////////////////////////////////////////
  // Initialize classes

  JSObject *object_proto; // reminder for inher.
  JSObject *layer_object; // used in REGISTER_CLASS macro
  // Screen (in C++ ViewPort) has only one class type
  // all implementations are masked behind the factory
  REGISTER_CLASS("Screen",
    screen_class,
    screen_constructor,
    screen_properties,
    screen_methods,
    NULL);

  REGISTER_CLASS("Parameter",
    parameter_class,
    parameter_constructor,
    parameter_properties,
    parameter_methods,
    NULL);

  REGISTER_CLASS("Layer",
    layer_class,
    layer_constructor,
    layer_properties,
    layer_methods,
    NULL);
  object_proto = layer_object; // following registrations inherit from parent class Layer

  REGISTER_CLASS("GeometryLayer",
    geometry_layer_class,
    geometry_layer_constructor,
    NULL,
    geometry_layer_methods,
    object_proto);

  REGISTER_CLASS("GeneratorLayer",
    generator_layer_class,
    generator_layer_constructor,
    NULL,
    generator_layer_methods,
    object_proto);

  REGISTER_CLASS("ImageLayer",
    image_layer_class,
    image_layer_constructor,
    NULL,
    image_layer_methods,
    object_proto);

#ifdef WITH_FLASH
  REGISTER_CLASS("FlashLayer",
    flash_layer_class,
    flash_layer_constructor,
    NULL,
    flash_layer_methods,
    object_proto);
#endif

#ifdef WITH_GOOM
  REGISTER_CLASS("GoomLayer",
    goom_layer_class,
    goom_layer_constructor,
    NULL, // properties
    goom_layer_methods,
    object_proto);
#endif

#ifdef WITH_AUDIO
  REGISTER_CLASS("AudioJack",
    js_audio_jack_class,
    js_audio_jack_constructor,
    NULL, // properties
    js_audio_jack_methods,
    object_proto);
#endif

  REGISTER_CLASS("CamLayer",
    cam_layer_class,
    cam_layer_constructor,
    cam_layer_properties,
    cam_layer_methods,
    object_proto);

// #ifdef WITH_FFMPEG
//   REGISTER_CLASS("MovieLayer",
//     video_layer_class,
//     video_layer_constructor,
//     NULL, // properties
//     video_layer_methods,
//     object_proto);
// #endif

#ifdef WITH_AVIFILE
  REGISTER_CLASS("MovieLayer",
    avi_layer_class,
    avi_layer_constructor,
    NULL, // properties
    avi_layer_methods,
    object_proto);

#endif

#if defined WITH_TEXTLAYER
  REGISTER_CLASS("TextLayer",
    txt_layer_class,
    txt_layer_constructor,
    NULL, // properties
    txt_layer_methods,
    object_proto);
#endif

#ifdef WITH_XGRAB
  REGISTER_CLASS("XGrabLayer",
    js_xgrab_class,
    js_xgrab_constructor,
    NULL, // properties
    js_xgrab_methods,
    object_proto);
#endif

#ifdef WITH_CAIRO
  REGISTER_CLASS("VectorLayer",
    vector_layer_class,
    vector_layer_constructor,
    vector_layer_properties,
    vector_layer_methods,
    object_proto);
#endif

  REGISTER_CLASS("Filter",
    filter_class,
    filter_constructor,
    filter_properties,
    filter_methods,
    NULL);

// controller classes
  REGISTER_CLASS("Controller",
    js_ctrl_class,
    NULL,
    NULL, // properties
    js_ctrl_methods,
    NULL);
  object_proto = layer_object;

  REGISTER_CLASS("KeyboardController",
    js_kbd_ctrl_class,
    js_kbd_ctrl_constructor,
    NULL, // properties
    js_kbd_ctrl_methods,
    object_proto);

  REGISTER_CLASS("MouseController",
    js_mouse_ctrl_class,
    js_mouse_ctrl_constructor,
    NULL, // properties
    js_mouse_ctrl_methods,
    object_proto);

  REGISTER_CLASS("JoystickController",
    js_joy_ctrl_class,
    js_joy_ctrl_constructor,
    NULL, // properties
    js_joy_ctrl_methods,
    object_proto);

  REGISTER_CLASS("TriggerController",
    js_trigger_ctrl_class,
    js_trigger_ctrl_constructor,
    NULL, // properties
    js_trigger_ctrl_methods,
    object_proto);

  REGISTER_CLASS("ViMoController",
    js_vimo_ctrl_class,
    js_vimo_ctrl_constructor,
    NULL, // properties
    js_vimo_ctrl_methods,
    object_proto);

#ifdef WITH_MIDI
  REGISTER_CLASS("MidiController",
    js_midi_ctrl_class,
    js_midi_ctrl_constructor,
    NULL, // properties
    js_midi_ctrl_methods,
    object_proto);
#endif

  REGISTER_CLASS("OscController",
    js_osc_ctrl_class,
    js_osc_ctrl_constructor,
    NULL, // properties
    js_osc_ctrl_methods,
    object_proto);

#ifdef WITH_CWIID
  REGISTER_CLASS("WiiController",
    js_wii_ctrl_class,
    js_wii_ctrl_constructor,
    NULL, // properties
    js_wii_ctrl_methods,
    object_proto);
#endif

#ifdef WITH_OGGTHEORA
// encoder class
  REGISTER_CLASS("VideoEncoder",
    js_vid_enc_class,
    js_vid_enc_constructor,
    NULL, // properties
    js_vid_enc_methods,
    NULL);
#endif

  //JS_DefineProperties(global_context, layer_object, layer_properties);
  return;
}
示例#17
0
LDrawableRectangle::LDrawableRectangle(lua_State *L, const DrawableRectangle& dp)
    : LDrawableShape(L, this),
      DrawableRectangle(dp)
{
    REGISTER_CLASS(LDrawableRectangle);
}
示例#18
0
LDrawableRectangle::LDrawableRectangle(lua_State *L)
    : LDrawableShape(L, this),
      DrawableRectangle()
{
    REGISTER_CLASS(LDrawableRectangle);
}