当前位置: 首页>>代码示例>>C++>>正文


C++ fn_call::get_root方法代码示例

本文整理汇总了C++中fn_call::get_root方法的典型用法代码示例。如果您正苦于以下问题:C++ fn_call::get_root方法的具体用法?C++ fn_call::get_root怎么用?C++ fn_call::get_root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fn_call的用法示例。


在下文中一共展示了fn_call::get_root方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: as_global_clearinterval

	void  as_global_clearinterval(const fn_call& fn)
	{
		if (fn.nargs > 0)
		{
			fn.get_root()->remove_listener(fn.arg(0).to_object());
		}
	}
开发者ID:DreamCastleShanghai,项目名称:dkomClient,代码行数:7,代码来源:as_global.cpp

示例2:

	void	sprite_start_drag(const fn_call& fn)
	{
		sprite_instance* sprite = sprite_getptr(fn);

		character::drag_state ds;
		ds.SetCharacter(sprite);

		if (fn.nargs > 0)
		{
			// arguments have been given to startDrag
			ds.SetLockCentered(fn.arg(0).to_bool());

			if (fn.nargs >= 5)
			{
				// bounds have been given
				tu_float x0 = PIXELS_TO_TWIPS(fn.arg(1).to_float());
				tu_float y0 = PIXELS_TO_TWIPS(fn.arg(2).to_float());
				tu_float x1 = PIXELS_TO_TWIPS(fn.arg(3).to_float());
				tu_float y1 = PIXELS_TO_TWIPS(fn.arg(4).to_float());

				float bx0, bx1, by0, by1;
				if (x0 < x1)
				{
					bx0 = x0; bx1 = x1; 
				}
				else
				{
					bx0 = x1; bx1 = x0; 
				}

				if (y0 < y1)
				{
					by0 = y0; by1 = y1; 
				}
				else
				{
					by0 = y1; by1 = y0; 
				}

				// we've got bounds
				ds.SetBounds(bx0, by0, bx1, by1);
			}
		}

		// inform the root
		fn.get_root()->set_drag_state(ds);
	}
开发者ID:DreamCastleShanghai,项目名称:dkomClient,代码行数:47,代码来源:gameswf_as_sprite.cpp

示例3: as_global_setinterval

	// setInterval(functionReference:Function, interval:Number, [param1:Object, param2, ..., paramN]) : Number
	// setInterval(objectReference:Object, methodName:String, interval:Number, [param1:Object, param2, ..., paramN]) : Number
	void  as_global_setinterval(const fn_call& fn)
	{
		if (fn.nargs >= 2)
		{
			gc_ptr<as_timer> t = new as_timer(fn.get_player());

			int first_arg_index = 2;
			if (fn.arg(0).is_function())
			{
				t->m_func = fn.arg(0).to_function();
				t->m_interval = fn.arg(1).to_float() / 1000.0f;
				assert(fn.env);
				t->m_this_ptr = fn.env->get_target();
			}
			else
			if (fn.arg(0).to_object() != NULL)
			{
				as_value func;
				as_object* this_ptr = fn.arg(0).to_object();
				this_ptr->get_member(fn.arg(1).to_tu_string(), &func);

				t->m_func = func.to_function();
				t->m_interval = fn.arg(2).to_float() / 1000.0f;
				t->m_this_ptr = this_ptr;
				first_arg_index = 3;
			}
			else
			{
				// invalid args
				return;
			}

			// pass args
			t->m_arg.resize(fn.nargs - first_arg_index);
			for (int i = first_arg_index; i < fn.nargs; i++)
			{
				t->m_arg.push_back(fn.arg(i));
			}

			fn.get_root()->add_listener(t);
			fn.result->set_as_object(t);
		}
	}
开发者ID:DreamCastleShanghai,项目名称:dkomClient,代码行数:45,代码来源:as_global.cpp


注:本文中的fn_call::get_root方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。