本文整理汇总了C++中fn_call类的典型用法代码示例。如果您正苦于以下问题:C++ fn_call类的具体用法?C++ fn_call怎么用?C++ fn_call使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了fn_call类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: as_point_subtract
void as_point_subtract(const fn_call& fn)
{
if (fn.nargs < 1)
{
return;
}
as_point* point = cast_to<as_point>(fn.this_ptr);
if (point == NULL)
{
return;
}
if (fn.arg(0).to_object() == NULL)
{
return;
}
as_point* other_point = cast_to<as_point>(fn.arg(0).to_object());
if (other_point)
{
smart_ptr<as_point> obj;
obj = new as_point(fn.get_player(),
point->m_point.m_x - other_point->m_point.m_x,
point->m_point.m_y - other_point->m_point.m_y);
fn.result->set_as_object(obj.get_ptr());
}
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:29,代码来源:as_point.cpp
示例3: string_last_index_of
void string_last_index_of(const fn_call& fn)
{
const tu_string& sstr = fn.this_value.to_tu_string();
if (fn.nargs < 1)
{
fn.result->set_double(-1);
} else {
int start_index = 0;
if (fn.nargs > 1)
{
start_index = fn.arg(1).to_int();
}
const char* str = sstr.c_str();
const char* last_hit = NULL;
const char* haystack = str;
for (;;) {
const char* p = strstr(haystack, fn.arg(0).to_string());
if (p == NULL || (start_index !=0 && p > str + start_index ) ) // FIXME: not UTF-8 correct!
{
break;
}
last_hit = p;
haystack = p + 1;
}
if (last_hit == NULL) {
fn.result->set_double(-1);
} else {
fn.result->set_double(tu_string::utf8_char_count(str, (int) (last_hit - str)));
}
}
}
开发者ID:Cucurbitace,项目名称:attract,代码行数:32,代码来源:as_string.cpp
示例4: string_index_of
void string_index_of(const fn_call& fn)
{
const tu_string& sstr = fn.this_value.to_tu_string();
if (fn.nargs < 1)
{
fn.result->set_double(-1);
}
else
{
int start_index = 0;
if (fn.nargs > 1)
{
start_index = fn.arg(1).to_int();
}
const char* str = sstr.c_str();
const char* p = strstr(
str + start_index, // FIXME: not UTF-8 correct!
fn.arg(0).to_string());
if (p == NULL)
{
fn.result->set_double(-1);
return;
}
fn.result->set_double(tu_string::utf8_char_count(str, (int) (p - str)));
}
}
开发者ID:Cucurbitace,项目名称:attract,代码行数:27,代码来源:as_string.cpp
示例5: string_slice
void string_slice(const fn_call& fn)
{
const tu_string& this_str = fn.this_value.to_tu_string();
int len = this_str.utf8_length();
int start = 0;
if (fn.nargs >= 1)
{
start = fn.arg(0).to_int();
if (start < 0)
{
start = len + start;
}
}
int end = len;
if (fn.nargs >= 2)
{
end = fn.arg(1).to_int();
if (end < 0)
{
end = len + end;
}
}
start = iclamp(start, 0, len);
end = iclamp(end, start, len);
fn.result->set_tu_string(this_str.utf8_substring(start, end));
}
开发者ID:Cucurbitace,项目名称:attract,代码行数:29,代码来源:as_string.cpp
示例6: as_mcloader_loadclip
void as_mcloader_loadclip(const fn_call& fn)
{
as_mcloader* mcl = cast_to<as_mcloader>(fn.this_ptr);
assert(mcl);
fn.result->set_bool(false); // on default
if (fn.nargs == 2)
{
array<as_value> event_args; // for event handler args
event_args.push_back(as_value()); // undefined
tu_string infile = get_full_url(fn.get_player()->get_workdir(), fn.arg(0).to_string());
movie_definition* md = fn.get_player()->create_movie(infile.c_str());
if (md == NULL)
{
IF_VERBOSE_ACTION(log_msg("can't create movie from %s\n", fn.arg(0).to_string()));
event_args.push_back("URLNotFound"); // 2-d param
mcl->m_listeners.notify(event_id(event_id::ONLOAD_ERROR, &event_args));
return;
}
as_mcloader::loadable_movie lm;
lm.m_def = cast_to<movie_def_impl>(md);
lm.m_target = cast_to<character>(fn.env->find_target(fn.arg(1)));
mcl->m_lm.push_back(lm);
mcl->m_listeners.notify(event_id(event_id::ONLOAD_START, &event_args));
fn.result->set_bool(true);
}
}
开发者ID:JamesLinus,项目名称:nui3,代码行数:30,代码来源:as_mcloader.cpp
示例7: as_s_function_call
// Invokes the function represented by a Function object.
// public call(thisObject:Object, [parameter1:Object]) : Object
void as_s_function_call(const fn_call& fn)
{
assert(fn.this_ptr);
if (fn.nargs > 0)
{
as_object* properties = fn.this_ptr;
if (properties->m_this_ptr != NULL)
{
as_object* func = properties->m_this_ptr.get_ptr();
if (func)
{
as_environment env(fn.get_player());
int nargs = 0;
if (fn.nargs > 1)
{
nargs = 1;
env.push(fn.arg(1));
}
*fn.result = call_method(func, &env, fn.arg(0).to_object(),
nargs, env.get_top_index());
}
}
}
}
开发者ID:Heartbroken,项目名称:bikini-iii,代码行数:27,代码来源:gameswf_function.cpp
示例8: as_map_material
void as_map_material(const fn_call& fn)
{
x3ds_instance* x3ds = cast_to<x3ds_instance>(fn.this_ptr);
if (x3ds && fn.nargs == 2)
{
x3ds->m_map[fn.arg(0).to_tu_string()] = fn.arg(1);
}
}
开发者ID:CneoC,项目名称:shinzui,代码行数:8,代码来源:gameswf_3ds_inst.cpp
示例9: as_global_movieclip_ctor
void as_global_movieclip_ctor(const fn_call& fn)
// Constructor for ActionScript class XMLSocket
{
root* rm = fn.get_player()->get_root();
sprite_definition* empty_sprite_def = new sprite_definition(fn.get_player(), NULL);
character* ch = new sprite_instance(fn.get_player(), empty_sprite_def,
rm, rm->get_root_movie(), 0);
fn.result->set_as_object(ch);
}
开发者ID:DreamCastleShanghai,项目名称:dkomClient,代码行数:9,代码来源:gameswf_as_sprite.cpp
示例10: sprite_add_script
// flash9
void sprite_add_script(const fn_call& fn)
{
sprite_instance* sprite = sprite_getptr(fn);
if (fn.nargs == 2)
{
// arg #1 - frame number, 0 based
// arg #2 - function
sprite->add_script(fn.arg(0).to_int(), fn.arg(1).to_function());
}
}
开发者ID:DreamCastleShanghai,项目名称:dkomClient,代码行数:11,代码来源:gameswf_as_sprite.cpp
示例11: sound_attach
void sound_attach(const fn_call& fn)
{
if (fn.nargs < 1)
{
log_error("attach sound needs one argument\n");
return;
}
as_sound* snd = cast_to<as_sound>(fn.this_ptr);
assert(snd);
assert(fn.env);
// find target movieclip
character* target = snd->m_target.get_ptr();
if (target == NULL)
{
target = fn.env->get_target();
}
// find resource
character_def* res = NULL;
if (target)
{
res = target->find_exported_resource(fn.arg(0).to_string());
}
if (res == NULL)
{
IF_VERBOSE_ACTION(log_msg("import error: resource '%s' is not exported\n",
fn.arg(0).to_string()));
return;
}
int si = 0;
sound_sample* ss = cast_to<sound_sample>(res);
if (ss != NULL)
{
si = ss->m_sound_handler_id;
}
else
{
log_error("sound sample is NULL\n");
return;
}
snd->clear();
// sanity check
assert(si >= 0 && si < 1000);
snd->m_id = si;
snd->m_is_loaded_sound = false;
}
开发者ID:Heartbroken,项目名称:bikini-iii,代码行数:55,代码来源:as_sound.cpp
示例12: as_object_watch
// public watch(name:String, callback:Function, [userData:Object]) : Boolean
// Registers an event handler to be invoked when a specified property of
// an ActionScript object changes. When the property changes,
// the event handler is invoked with myObject as the containing object.
void as_object_watch(const fn_call& fn)
{
bool ret = false;
if (fn.nargs >= 2)
{
assert(fn.this_ptr);
ret = fn.this_ptr->watch(fn.arg(0).to_tu_string(),
fn.arg(1).to_function(), fn.nargs > 2 ? fn.arg(2) : as_value());
}
fn.result->set_bool(ret);
}
开发者ID:ChenliTemple,项目名称:gameswf,代码行数:16,代码来源:gameswf_object.cpp
示例13: as_global_transform_ctor
// Transform( mc:MovieClip )
void as_global_transform_ctor(const fn_call& fn)
{
if (fn.nargs == 1)
{
gc_ptr<as_transform> obj;
if (character* movie = cast_to<character>(fn.arg(0).to_object()))
{
obj = new as_transform(fn.get_player(), movie);
}
fn.result->set_as_object(obj.get_ptr());
}
}
开发者ID:Cucurbitace,项目名称:attract,代码行数:13,代码来源:as_transform.cpp
示例14: assert
void as_listener::broadcast(const fn_call& fn)
{
assert(fn.env);
if (m_reentrance)
{
// keep call args
// we must process one event completely then another
array<as_value> arg;
for (int i = 0; i < fn.nargs; i++)
{
arg.push_back(fn.arg(i));
}
m_suspended_event.push(arg);
return;
}
m_reentrance = true;
// event handler may affects 'fn.arg' using broadcastMessage
// so we iterate through the copy of args
tu_string event_name = fn.arg(0).to_tu_string();
for (int j = fn.nargs - 1; j > 0; j--)
{
fn.env->push(fn.arg(j));
}
m_listeners.notify(event_name,
fn_call(NULL, 0, fn.env, fn.nargs - 1, fn.env->get_top_index()));
fn.env->drop(fn.nargs - 1);
// check reentrances
while (m_suspended_event.size() > 0)
{
// event handler may affects m_suspended_event using broadcastMessage
// so we iterate through the copy of args
array<as_value>& arg = m_suspended_event.front();
tu_string event_name = arg[0].to_tu_string();
for (int j = arg.size() - 1; j > 0; j--)
{
fn.env->push(arg[j]);
}
m_listeners.notify(event_name,
fn_call(NULL, 0, fn.env, arg.size() - 1, fn.env->get_top_index()));
fn.env->drop(fn.nargs - 1);
m_suspended_event.pop();
}
m_reentrance = false;
}
开发者ID:85964596,项目名称:cocos2dx-swf,代码行数:52,代码来源:as_broadcaster.cpp
示例15: launcher_verify_md5sum
as_value
launcher_verify_md5sum(const fn_call& fn)
{
GNASH_REPORT_FUNCTION;
boost::intrusive_ptr<launcher_as_object> ptr = ensureType<launcher_as_object>(fn.this_ptr);
if (fn.nargs > 0) {
string filespec = fn.arg(0).to_string();
string md5 = fn.arg(1).to_string();
return as_value(ptr->obj.verify_md5sum(filespec.c_str(), md5.c_str()));
}
return as_value(true);
}
开发者ID:adamh,项目名称:gnash-fork,代码行数:13,代码来源:launcher_ext.cpp
示例16: gtkext_container_add
// this takes two arguments
as_value gtkext_container_add(const fn_call& fn)
{
// GNASH_REPORT_FUNCTION;
boost::intrusive_ptr<GtkExt> ptr = ensureType<GtkExt>(fn.this_ptr);
if (fn.nargs > 0) {
GtkExt *parent = dynamic_cast<GtkExt *>(fn.arg(0).to_object(*getGlobal(fn)).get());
GtkExt *child = dynamic_cast<GtkExt *>(fn.arg(1).to_object(*getGlobal(fn)).get());
gtk_container_add (GTK_CONTAINER (parent->getWindow()), child->getWindow());
return as_value(true);
}
return as_value(false);
}
开发者ID:diocles,项目名称:gnash,代码行数:14,代码来源:gtkext.cpp
示例17: sprite_create_empty_movieclip
//createEmptyMovieClip(name:String, depth:Number) : MovieClip
void sprite_create_empty_movieclip(const fn_call& fn)
{
sprite_instance* sprite = sprite_getptr(fn);
if (fn.nargs != 2)
{
log_error("createEmptyMovieClip needs 2 args\n");
return;
}
character* ch = sprite->add_empty_movieclip(fn.arg(0).to_string(),
fn.arg(1).to_int() + ADJUST_DEPTH_VALUE);
fn.result->set_as_object(ch);
}
开发者ID:DreamCastleShanghai,项目名称:dkomClient,代码行数:14,代码来源:gameswf_as_sprite.cpp
示例18: as_xmlsock_connect
void as_xmlsock_connect(const fn_call& fn)
{
if (fn.nargs != 2)
{
fn.result->set_bool(false);
return;
}
as_xmlsock* xmls = cast_to<as_xmlsock>(fn.this_ptr);
assert(xmls);
fn.result->set_bool(xmls->connect(fn.arg(0).to_string(), fn.arg(1).to_int()));
}
开发者ID:cpascal,项目名称:CCSWF,代码行数:13,代码来源:as_xmlsocket.cpp
示例19: as_global_parse_int
void as_global_parse_int(const fn_call& fn)
{
if (fn.nargs > 0)
{
int res;
int base = fn.nargs > 1 ? fn.arg(1).to_int() : 10;
if (string_to_number(&res, fn.arg(0).to_string(), base))
{
fn.result->set_int(res);
return;
}
}
fn.result->set_nan();
}
开发者ID:Cucurbitace,项目名称:attract,代码行数:14,代码来源:as_number.cpp
示例20: as_global_textformat_ctor
void as_global_textformat_ctor(const fn_call& fn)
{
gc_ptr<as_textformat> obj = new as_textformat(fn.get_player());
assert(unsigned(fn.nargs) <= TU_ARRAYSIZE(as_global_textformat_ctor_paramnames));
// TODO: check parameters type
for (int i = 0; i < fn.nargs; i++)
{
obj->set_member(as_global_textformat_ctor_paramnames[i], fn.arg(i));
}
fn.result->set_as_object(obj.get_ptr());
}
开发者ID:85964596,项目名称:cocos2dx-swf,代码行数:14,代码来源:as_textformat.cpp
注:本文中的fn_call类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论